LimHD:EXT2: Difference between revisions
No edit summary |
No edit summary |
||
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== ext2 == | == ext2 == | ||
Since I only use OsX at home, and do not really use Windows, it does not make much sense to use '''NTFS''' on the internal HDD. The Linux kernel has '''ext2''' support, and since the limits of '''ext2''' are quite acceptable | Since I only use OsX at home, and do not really use Windows, it does not make much sense to use '''NTFS''' on the internal HDD. The Linux kernel has '''ext2''' support, and since the limits of '''ext2''' are quite acceptable [http://en.wikipedia.org/wiki/Ext2#File_system_limits] I formatted it ext2 with block size of '''2048'''. | ||
As it turns out, I actually had a lot of other problems, in that the HDD stops working after being on for about 10 minutes. Usually with "lost interrupt", "resetting MBUS" messages. Either the HDD is bad and dying, or my '''LimHD200i''' is bad. Either way, since I want a writable HDD, and run FTP and SMB, '''ext2''' makes much more sense. | As it turns out, I actually had a lot of other problems, in that the HDD stops working after being on for about 10 minutes. Usually with "lost interrupt", "resetting MBUS" messages. Either the HDD is bad and dying, or my '''LimHD200i''' is bad. Either way, since I want a writable HDD, and run FTP and SMB, '''ext2''' makes much more sense. | ||
Line 38: | Line 37: | ||
xseg000:00056908 BNE loc_56934 ; Branch | xseg000:00056908 BNE loc_56934 ; Branch | ||
In binary | |||
00056910: 0610 a0e1 9020 9fe5 '''07'''30 a0e3 4e4d 09eb ..... ...0..NM.. | |||
00056920: 0000 50e3 0800 000a 8030 9fe5 0030 8de5 ..P......0...0.. | |||
00056930: 6000 4be2 8010 4be2 7420 9fe5 '''07'''30 a0e3 `.K...K.t ...0.. | |||
EXT2-fs: Unrecognized mount option | |||
Basically, it uses mount flags '''#7''' which is '''READONLY NOSUID NODEV''', tries to mount it with type '''vfat''' and mount options '''iocharset=utf8'''. If that fails, it tries '''#7''' with '''ntfs''' and '''nls=utf8'''. Changing '''ntfs''' to '''ext2''' will result in: | |||
EXT2-fs: Unrecognized mount option nls=utf8 | |||
So, we need to replace the mount option '''nls=utf8''' as well. According to '''linux-2.4.22-em86xx/fs/ext2/super.c''' we can chose from: | So, we need to replace the mount option '''nls=utf8''' as well. According to '''linux-2.4.22-em86xx/fs/ext2/super.c''' we can chose from: | ||
Line 46: | Line 51: | ||
bsddf nouid32 check debug errors=continue/remount-ro/panic) grpid bsdgroups minixdf nocheck nogrpid sysvgroups resgid resuid sb grpquota noquota quota usrquota | bsddf nouid32 check debug errors=continue/remount-ro/panic) grpid bsdgroups minixdf nocheck nogrpid sysvgroups resgid resuid sb grpquota noquota quota usrquota | ||
I went with ''' | I went with '''nocheck''' for now. There are a few in there that would be relatively harmless. | ||
So basically, I have decided to change '''vfat''' to '''ext2''' so that you can still mount '''ntfs''' as well as '''ext2'''. I have changed the first '''#7''' to '''#6''' to make '''ext2''' mount in '''read-write''' mode. | |||
=== Restarting curacao === | |||
The next problem is restarting '''curacao'''. It needs to be shut down in such a way that we can open '''/dev/ir''' again, which is only allowed to be opened once. | The next problem is restarting '''curacao'''. It needs to be shut down in such a way that we can open '''/dev/ir''' again, which is only allowed to be opened once. | ||
Line 60: | Line 71: | ||
'''/mnt/smbfs/curacao-ext2 /mnt /dev/ir''' | '''/mnt/smbfs/curacao-ext2 /mnt /dev/ir''' | ||
I can not provide the patched binary of '''curacao''' sorry[[ | I can not provide the patched binary of '''curacao''' sorry, but go here [[LimHD:Firmware|Firmware]] | ||
Naturally, eventually I will roll my own firmware with my version of '''curacao''' but you really want to make sure it works before you do that, since without a working '''curacao''' you '''can not flash a new firmware!'''. This is why I did it this way for now. | |||
I also need to compile '''e2fsck''' and run it at boot. Maybe even '''mke2fs''' because I am nice. | |||
I have compiled a version of busybox with '''fdisk''', '''e2fsck''' and '''mkfs.ext2''' so that simple ext2 setup can be performed. I have thus made my HDD have partition 1 as '''ntfs''' and partition 2 as '''ext2''' so that I can keep testing my code against both. '''curacao''' mounts both. | |||
=== read-only === | |||
/dev/ide/host0/bus0/target0/lun0/part1 on /mnt/HD1 type ext2 (ro,nosuid) | |||
Alas, it is mounted '''read-only'''. I need to find this option next. | |||
#define MS_RDONLY 1 /* Mount read-only */ | |||
#define MS_NOSUID 2 /* Ignore suid and sgid bits */ | |||
So, most likely there is a '''3''' somewhere (actually, it is '''7''', as seen above) . Definitely in '''R3'''. | |||
/dev/ide/host0/bus0/target0/lun0/part1 39.1G 4.3G 34.8G 11% /mnt/HD1 | |||
/dev/ide/host0/bus0/target0/lun0/part2 111.8G 18.0M 106.1G 0% /mnt/HD2 | |||
In retrospect, mounting the HDD in read/write isn't a great idea. Since this device needs plenty of reboots, and you can not do that cleanly. I have '''fsck''' but it needs a huge amount of memory. If you kill everything, '''curacao''', smbmount etc, I could '''just''' run it. That's on a 100Gb partition, so not very nice. Seriously, you will need '''swap''' partition. So I will go back to read-only, and use '''FTP SITE MOUNT''' to make it read/write temporarily. |
Latest revision as of 07:44, 5 November 2007
ext2
Since I only use OsX at home, and do not really use Windows, it does not make much sense to use NTFS on the internal HDD. The Linux kernel has ext2 support, and since the limits of ext2 are quite acceptable [1] I formatted it ext2 with block size of 2048.
As it turns out, I actually had a lot of other problems, in that the HDD stops working after being on for about 10 minutes. Usually with "lost interrupt", "resetting MBUS" messages. Either the HDD is bad and dying, or my LimHD200i is bad. Either way, since I want a writable HDD, and run FTP and SMB, ext2 makes much more sense.
But, curacao does not recognise ext2 on the internal HDD. Only vfat and ntfs. The check for that is located here:
xseg000:000568A4 loc_568A4 ; CODE XREF: print_mounted+C8vj xseg000:000568A4 MOV R0, R7 ; loops here until R5 is 10 xseg000:000568A8 LDR R1, =aDevIdeHost0Bus ; Load from Memory xseg000:000568AC MOV R2, R5 ; Rd = Op2 xseg000:000568B0 BL sprintf_2A3314 ; R1 = /dev/ide/%R5 (R2) xseg000:000568B4 MOV R0, R6 ; R6 = /dev/ide/host%d xseg000:000568B8 LDR R1, =aMntHdD ; Load from Memory xseg000:000568BC MOV R2, R5 ; Rd = Op2 xseg000:000568C0 BL sprintf_2A3314 ; /mnt/HD%R5 xseg000:000568C4 LDR R3, =aIocharsetUtf8_0 ; Load from Memory xseg000:000568C8 STR R3, [SP,#0x88+var_88] ; Store to Memory xseg000:000568CC MOV R0, R7 ; Rd = Op2 xseg000:000568D0 MOV R1, R6 ; Rd = Op2 xseg000:000568D4 LDR R2, =aVfat_0 ; Load from Memory xseg000:000568D8 MOV R3, #7 ; Rd = Op2 xseg000:000568DC BL testfstype_2A9E1C ; Branch with Link xseg000:000568E0 CMP R0, #0 ; Set cond. codes on Op1 - Op2 xseg000:000568E4 BEQ loc_5690C ; Branch xseg000:000568E8 LDR R3, =aNlsUtf8 ; Load from Memory xseg000:000568EC STR R3, [SP,#0x88+var_88] ; Store to Memory xseg000:000568F0 SUB R0, R11, #0x60 ; Rd = Op1 - Op2 xseg000:000568F4 SUB R1, R11, #0x80 ; Rd = Op1 - Op2 xseg000:000568F8 LDR R2, =aNtfs_0 ; Load from Memory xseg000:000568FC MOV R3, #7 ; Rd = Op2 xseg000:00056900 BL testfstype_2A9E1C ; Branch with Link xseg000:00056904 CMP R0, #0 ; Set cond. codes on Op1 - Op2 xseg000:00056908 BNE loc_56934 ; Branch
In binary
00056910: 0610 a0e1 9020 9fe5 0730 a0e3 4e4d 09eb ..... ...0..NM.. 00056920: 0000 50e3 0800 000a 8030 9fe5 0030 8de5 ..P......0...0.. 00056930: 6000 4be2 8010 4be2 7420 9fe5 0730 a0e3 `.K...K.t ...0..
Basically, it uses mount flags #7 which is READONLY NOSUID NODEV, tries to mount it with type vfat and mount options iocharset=utf8. If that fails, it tries #7 with ntfs and nls=utf8. Changing ntfs to ext2 will result in:
EXT2-fs: Unrecognized mount option nls=utf8
So, we need to replace the mount option nls=utf8 as well. According to linux-2.4.22-em86xx/fs/ext2/super.c we can chose from:
bsddf nouid32 check debug errors=continue/remount-ro/panic) grpid bsdgroups minixdf nocheck nogrpid sysvgroups resgid resuid sb grpquota noquota quota usrquota
I went with nocheck for now. There are a few in there that would be relatively harmless.
So basically, I have decided to change vfat to ext2 so that you can still mount ntfs as well as ext2. I have changed the first #7 to #6 to make ext2 mount in read-write mode.
Restarting curacao
The next problem is restarting curacao. It needs to be shut down in such a way that we can open /dev/ir again, which is only allowed to be opened once.
First you kill the curacao process, usually the lowest pid. Then you should kill all the udhcpc processes, (I used highest pid to lowest order, does this matter?) and if you ran cat /proc/kmsg & before then, you should get this message:
<7>ir: Disable NEC decoder <7>ir: Disable RC5 decoder <7>ir: Disable RC6 decoder
Sweet, now you can start curacao again, I use Samba mount.
/mnt/smbfs/curacao-ext2 /mnt /dev/ir
I can not provide the patched binary of curacao sorry, but go here Firmware
Naturally, eventually I will roll my own firmware with my version of curacao but you really want to make sure it works before you do that, since without a working curacao you can not flash a new firmware!. This is why I did it this way for now.
I also need to compile e2fsck and run it at boot. Maybe even mke2fs because I am nice.
I have compiled a version of busybox with fdisk, e2fsck and mkfs.ext2 so that simple ext2 setup can be performed. I have thus made my HDD have partition 1 as ntfs and partition 2 as ext2 so that I can keep testing my code against both. curacao mounts both.
read-only
/dev/ide/host0/bus0/target0/lun0/part1 on /mnt/HD1 type ext2 (ro,nosuid)
Alas, it is mounted read-only. I need to find this option next.
#define MS_RDONLY 1 /* Mount read-only */ #define MS_NOSUID 2 /* Ignore suid and sgid bits */
So, most likely there is a 3 somewhere (actually, it is 7, as seen above) . Definitely in R3.
/dev/ide/host0/bus0/target0/lun0/part1 39.1G 4.3G 34.8G 11% /mnt/HD1 /dev/ide/host0/bus0/target0/lun0/part2 111.8G 18.0M 106.1G 0% /mnt/HD2
In retrospect, mounting the HDD in read/write isn't a great idea. Since this device needs plenty of reboots, and you can not do that cleanly. I have fsck but it needs a huge amount of memory. If you kill everything, curacao, smbmount etc, I could just run it. That's on a 100Gb partition, so not very nice. Seriously, you will need swap partition. So I will go back to read-only, and use FTP SITE MOUNT to make it read/write temporarily.