1. fdisk -e /dev/disk4
2. auto hfs
3. w
4. newfs_hfs /dev/disk4s1
5. diskutil mountDisk disk4s1
2008年4月21日 星期一
2008年3月30日 星期日
xcode build and gcc for universal binary
xCode
General-->Cross-Develop Using Target SDK:
Max-OS x 10.5
Then you can use features available on 10.5
build -> Architectures ( from target file):
按住mouse,之後手動輸入i386, x86_64, ppc ppc64
build --> Mac OS X Deployment Target
Mac os X 10.4
This is the minimum OS version you want to support
gcc
use -arch i386 -arch ppc
ex:
the object file generated is test.o
file test.o:
test.o (for architecture ppc7400): Mach-O object ppc
test.o (for architecture i386): Mach-O object i386
General-->Cross-Develop Using Target SDK:
Max-OS x 10.5
Then you can use features available on 10.5
build -> Architectures ( from target file):
按住mouse,之後手動輸入i386, x86_64, ppc ppc64
build --> Mac OS X Deployment Target
Mac os X 10.4
This is the minimum OS version you want to support
gcc
use -arch i386 -arch ppc
ex:
the object file generated is test.o
file test.o:
test.o (for architecture ppc7400): Mach-O object ppc
test.o (for architecture i386): Mach-O object i386
判斷 intel or power pc on mac
// for powerPC
#if __BIG_ENDIAN__
printf("big endian\n");
// for Intel
#else
printf("little endian\n");
#endif
#if __BIG_ENDIAN__
printf("big endian\n");
// for Intel
#else
printf("little endian\n");
#endif
2008年3月27日 星期四
pdisk
Apple partition table editor
(the disk must use Apple_partition_scheme. If it uses GUID_partition_scheme, pdisk can not use)
(1) input e
edit device's map
input /dev/disk2
the name of device to change is /dev/disk2
(2input c)
create a partition, with default= Apple_HFS
First block: 64
Length in blocks: 20000
Name of partition: par1
input t
change partition type
input MyPartitionType
(3) input w
write the partition table
(the disk must use Apple_partition_scheme. If it uses GUID_partition_scheme, pdisk can not use)
(1) input e
edit device's map
input /dev/disk2
the name of device to change is /dev/disk2
(2input c)
create a partition, with default= Apple_HFS
First block: 64
Length in blocks: 20000
Name of partition: par1
input t
change partition type
input MyPartitionType
(3) input w
write the partition table
2008年3月21日 星期五
registerService
為了要讓clients可以找到driver,
要先呼叫registerService()
ex:
有個driver com_MySoftwareCompany_driver_SampleINQUIRYDriver,
在它的start function呼叫registerService()
bool com_MySoftwareCompany_driver_SampleINQUIRYDriver::start(IOService* provider)
{
bool success;
IOLog("SampleINQUIRYDriver::start()\n");
success = super::start(provider);
if (success) {
// Publish ourselves so clients can find us
registerService();
}
return success;
}
要先呼叫registerService()
ex:
有個driver com_MySoftwareCompany_driver_SampleINQUIRYDriver,
在它的start function呼叫registerService()
bool com_MySoftwareCompany_driver_SampleINQUIRYDriver::start(IOService* provider)
{
bool success;
IOLog("SampleINQUIRYDriver::start()\n");
success = super::start(provider);
if (success) {
// Publish ourselves so clients can find us
registerService();
}
return success;
}
info.plist's IOMatchCategory and IOProbeScore
IOMatchCategory is a special property list element that allows multiple drivers to match on a single nub.
Hence, if there are two drivers for IOSCSILogicalUnitNumber, they are both attached to device.
If you want only the most suitable driver, do not set IOMatchCategory. And use IOProbeScore to give the driver you want higher score
Hence, if there are two drivers for IOSCSILogicalUnitNumber, they are both attached to device.
If you want only the most suitable driver, do not set IOMatchCategory. And use IOProbeScore to give the driver you want higher score
2008年3月19日 星期三
size and IOConnectMethodStructureIStructureO
傳入IOConnectMethodStructureIStructureO之類function的output buffer size大小,
即為此buffer的大小,
所以即使buffer容量為10 byte,
若size傳入5 byte,
最後只會寫入5 byte的資料到buffer。
即為此buffer的大小,
所以即使buffer容量為10 byte,
若size傳入5 byte,
最後只會寫入5 byte的資料到buffer。
SCSITaskStatus
in SCSITask.h
kSCSITaskStatus_GOOD = 0x00,
kSCSITaskStatus_CHECK_CONDITION = 0x02,
kSCSITaskStatus_CONDITION_MET = 0x04,
kSCSITaskStatus_BUSY = 0x08,
kSCSITaskStatus_INTERMEDIATE = 0x10,
kSCSITaskStatus_INTERMEDIATE_CONDITION_MET = 0x14,
kSCSITaskStatus_RESERVATION_CONFLICT = 0x18,
kSCSITaskStatus_TASK_SET_FULL = 0x28,
kSCSITaskStatus_ACA_ACTIVE = 0x30,
kSCSITaskStatus_TaskTimeoutOccurred = 0x01,
kSCSITaskStatus_ProtocolTimeoutOccurred = 0x02,
kSCSITaskStatus_DeviceNotResponding = 0x03,
kSCSITaskStatus_DeviceNotPresent = 0x04,
kSCSITaskStatus_DeliveryFailure = 0x05,
kSCSITaskStatus_No_Status = 0xFF
kSCSITaskStatus_GOOD = 0x00,
kSCSITaskStatus_CHECK_CONDITION = 0x02,
kSCSITaskStatus_CONDITION_MET = 0x04,
kSCSITaskStatus_BUSY = 0x08,
kSCSITaskStatus_INTERMEDIATE = 0x10,
kSCSITaskStatus_INTERMEDIATE_CONDITION_MET = 0x14,
kSCSITaskStatus_RESERVATION_CONFLICT = 0x18,
kSCSITaskStatus_TASK_SET_FULL = 0x28,
kSCSITaskStatus_ACA_ACTIVE = 0x30,
kSCSITaskStatus_TaskTimeoutOccurred = 0x01,
kSCSITaskStatus_ProtocolTimeoutOccurred = 0x02,
kSCSITaskStatus_DeviceNotResponding = 0x03,
kSCSITaskStatus_DeviceNotPresent = 0x04,
kSCSITaskStatus_DeliveryFailure = 0x05,
kSCSITaskStatus_No_Status = 0xFF
2008年3月17日 星期一
LOSleep and IOLog
Sleep the calling thread for a number of milliseconds
void IOSleep(unsigned milliseconds);
use IOSleep let the message write to log by IOLog complete
void IOSleep(unsigned milliseconds);
use IOSleep let the message write to log by IOLog complete
2008年3月13日 星期四
OSTypeAlloc
Allocate an instance of the desired object.
#define OSTypeAlloc(type)
ex:
OSTypeAlloc(com_apple_dts_SCSIEmulator);
#define OSTypeAlloc(type)
ex:
OSTypeAlloc(com_apple_dts_SCSIEmulator);
appleRAID

command:
diskutil createRAID mirror MyArray JHFS+ disk2s4 disk2s5
new RAID is disk3
it is composed of Untitled@4(disk2s4) and Untitled@5(disk2s5)
command:
delete raid:
diskutil destroyRAID disk3
appleRAID test program: artest
create new RAID set
artest --create --name myRAID --level mirror disk2s4 disk2s5
test AppleRAID-3.0.19 driver
when creating RAID, not use mirror
Because there are some errors in AppleRAIDMirrorSet.cpp
2008年3月11日 星期二
2008年3月6日 星期四
SCSI Domain Identifier
SCSI Domain Identifier = bus id = kIOPropertySCSIDomainIdentifierKey
SCSI Target identifier = scsi target id = kIOPropertySCSITargetIdentifierKey
SCSI Logical Unit Number = lun = kIOPropertySCSILogicalUnitNumberKey
SCSI Target identifier = scsi target id = kIOPropertySCSITargetIdentifierKey
SCSI Logical Unit Number = lun = kIOPropertySCSILogicalUnitNumberKey
2008年3月5日 星期三
IOSleep
IOSleep(unsigned milliseconds);
puts the currently executing thread to sleep for a certain period of time
puts the currently executing thread to sleep for a certain period of time
2008年2月19日 星期二
2008年2月18日 星期一
compile with framework
compile files that connect to user client in the kernel:
IOKit, CoreFoundation, ApplicationServices
IOKit, CoreFoundation, ApplicationServices
2008年2月12日 星期二
2008年2月1日 星期五
2008年1月31日 星期四
訂閱:
文章 (Atom)
