tonymy01 wrote:Hi Peter, the ROMFS extract (bw_rootfs) seems to not extract the whole ROMFS.
By just truncating the beginning gaff out of linux.bin and loopmounting that file, I see the mounted usr/local/bin directory contains:
root@tonysLinux:/mnt/beyonwiztoolchain/BWFWTools/romfsd/usr/local/bin# l
total 0
drwxr-xr-x 1 root root 32 1970-01-01 10:00 ./
drwxr-xr-x 1 root root 32 1970-01-01 10:00 ../
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 auto_wnet -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 eepromtest -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 fastunzip -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 flash_eraseall -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 flash_update -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 flash_write -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 iwconfig -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 iwlist -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 iwpriv -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 mount.cifs -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 setgpio -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 setuartgpio -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 sil9030test -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 sys_up -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 testtest -> /flash/bin/rompkg
Where as with your PERL script extracted ROMFS, I see only:
root@tonysLinux:/mnt/beyonwiztoolchain/BWFWTools/romfsd/usr/local/bin# l
ls: cannot read symbolic link testtest: Input/output error
total 0
drwxr-xr-x 1 root root 32 1970-01-01 10:00 ./
drwxr-xr-x 1 root root 32 1970-01-01 10:00 ../
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 auto_wnet -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 flash_eraseall -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 flash_update -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 flash_write -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 iwconfig -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 iwlist -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 iwpriv -> /flash/bin/rompkg
lrwxrwxrwx 1 root root 17 1970-01-01 10:00 testtest
So there is something wrong there.
Also just purging the beginning out of linux.bin, the file size is 18,135,408 bytes for .197 S1, where as your extraction generates a file 16,313,184 bytes. I can see there is still definitely parts of the filesystem in the linux.bin file that are not in the bw_rootfs generated file just by scanning past where your script stops in the linux.bin file.
I will still give it a go to see if it can update the image inside linux.bin better, but I am not holding my breath yet, as I didn't realise that your extraction didn't extract the files, but rather a singe file (the ROMFS image) which I have to loop mount, copy somewhere, modify, and then rely on genromfs to build something again that is going to be a legal ROMFS file to use your perl script to put back into linux.bin.
Regards
When I extract the root fs using bw_rootfs and wiz_unpack, I get:
Code: Select all
prl$ ls -l DPS1_Firmware_28Dec2007_ver_01.05.197.root1/usr/local/bin
total 120
lrwxr-xr-x 1 prl prl 17 Mar 9 08:44 auto_wnet -> /flash/bin/rompkg
lrwxr-xr-x 1 prl prl 17 Mar 9 08:44 eepromtest -> /flash/bin/rompkg
lrwxr-xr-x 1 prl prl 17 Mar 9 08:44 fastunzip -> /flash/bin/rompkg
lrwxr-xr-x 1 prl prl 17 Mar 9 08:44 flash_eraseall -> /flash/bin/rompkg
lrwxr-xr-x 1 prl prl 17 Mar 9 08:44 flash_update -> /flash/bin/rompkg
lrwxr-xr-x 1 prl prl 17 Mar 9 08:44 flash_write -> /flash/bin/rompkg
lrwxr-xr-x 1 prl prl 17 Mar 9 08:44 iwconfig -> /flash/bin/rompkg
lrwxr-xr-x 1 prl prl 17 Mar 9 08:44 iwlist -> /flash/bin/rompkg
lrwxr-xr-x 1 prl prl 17 Mar 9 08:44 iwpriv -> /flash/bin/rompkg
lrwxr-xr-x 1 prl prl 17 Mar 9 08:44 mount.cifs -> /flash/bin/rompkg
lrwxr-xr-x 1 prl prl 17 Mar 9 08:44 setgpio -> /flash/bin/rompkg
lrwxr-xr-x 1 prl prl 17 Mar 9 08:44 setuartgpio -> /flash/bin/rompkg
lrwxr-xr-x 1 prl prl 17 Mar 9 08:44 sil9030test -> /flash/bin/rompkg
lrwxr-xr-x 1 prl prl 17 Mar 9 08:44 sys_up -> /flash/bin/rompkg
lrwxr-xr-x 1 prl prl 17 Mar 9 08:44 testtest -> /flash/bin/rompkg
The symlinks you are missing
are in the last bit of the file system. Are you also missing the directories flash, proc, root and opt from the top level-directory when you unpack?
I also get a file size of 16,313,184 bytes for the file extracted from linux.bin (1.05.197) using bw_rootfs.
I did an
ls -R of the directories extracted by bw_rootfs, and with my old tool that just strips the front part off linux.bin (18,135,408 bytes), and the two listings are identical.
I've just realised what the problem is! When you loopmount, the driver does all its I/O in whole (4096-byte?) blocks. The root romfs I extract isn't packed out to a full block boundary, it's just the bytes in the actual filesystem. I've used a modified (see below) BW-Background-Changer/WizTools/src/wiz_unpack to unpack, and that works just fine. Could you try that and see whether you get all the files (you may need to patch the distributed wiz_unpack)?
I think the best solution would be to add an option to pad to the 4k block boundary so that loopback mounting works. Any opinions on that, anyone?
If you want to modify and repack the root filesystem, then it needs to be unpacked. Unfortunately the wiz_unpack in the version of BW-Background-Changer I have doesn't extract symlinks. I've modified my copy to do that. Here are the context diffs for the mod.
Code: Select all
*** BW-Background-Changer/WizTools/src/wiz_unpack.c Tue Dec 11 08:12:30 2007
--- BW-Background-Changer/WizTools/src/wiz_unpack.c.orig Tue Nov 20 22:00:08 2007
***************
*** 183,195 ****
chmod(ni.name, mode);
break;
case ROMFH_LNK:
! printf("symbolic link: %s\n", (char*)ni.file);
! if(symlink((char*)ni.file, ni.name) < 0) {
! fprintf(stderr, "can't link `%s' to `%s': %s\n",
! ni.name, (char*)ni.file,
! strerror(errno));
! return -1;
! }
break;
case ROMFH_BLK:
printf("block device\n");
--- 183,189 ----
chmod(ni.name, mode);
break;
case ROMFH_LNK:
! printf("symbolic link\n");
break;
case ROMFH_BLK:
printf("block device\n");
Actually, I'm now wondering how BW-Backgroud-Changer works if wiz_unpack doesn't extract symlinks!