LimHD:Firmware: Difference between revisions

From Lundman Wiki
No edit summary
No edit summary
 
(16 intermediate revisions by the same user not shown)
Line 12: Line 12:
Want to just download binary version?
Want to just download binary version?


  [http://www.lundman.net/ftp/lim/update-1026-plus.bin update-1026-plus.bin] Patched 2007/10/26 firmware.
[http://www.lundman.net/ftp/lim/update-1206-08-plus.bin update-1206-08-plus.bin] Patched 2007/12/17 firmware. Untested. You have to rename it to '''update.bin''' 2008/01/04
 
[http://www.lundman.net/ftp/lim/update-1206-plus.bin update-1206-plus.bin] Patched 2007/12/06 firmware. Untested. You have to rename it to '''update.bin''' 2007/12/21
[http://www.lundman.net/ftp/lim/update-1130-plus.bin update-1130-plus.bin] Patched 2007/11/30 firmware. Untested. You have to rename it to '''update.bin''' 2007/11/30
  [http://www.lundman.net/ftp/lim/update-1026-plus.bin update-1026-plus.bin] Patched 2007/10/26 firmware. I personally run this one. You have to rename it to '''update.bin''' 2007/11/10


Got a newer firmware you want to patch yourself? Just run the patch script inside. Does everything on this page, except hex edit '''curacao''' for ext2. See below.
Got a newer firmware you want to patch yourself? Just run the patch script inside. Does everything on this page, except hex edit '''curacao''' for ext2. See below.


  [http://www.lundman.net/ftp/lim/lim-firmware-utils.tgz lim-firmware-utils.tgz]
  [http://www.lundman.net/ftp/lim/lim-firmware-utils.tgz lim-firmware-utils.tgz] 2007/11/10
 
Read about how to use [[LimHD:Firmware#Using_your_special_LimHD200i_Firmware|FTP]] here




Line 101: Line 109:
  002c89a0: 0000 0000 6e6c 733d 7574 6638 0000 0000  ....nls=utf8....
  002c89a0: 0000 0000 6e6c 733d 7574 6638 0000 0000  ....nls=utf8....


Don't forget to null-terminate the '''nocheck''' string. Key sequence usage for emacs is:
Don't forget to null-terminate the '''nocheck''' string.  


  emacs -nw curacao
If you are using '''emacs hexl-mode''' it is important that you use '''find-file-literally''' to load the file so that emacs does not attempt to do locale conversions.
 
Key sequence usage for emacs is:
 
  emacs -nw  
M-x find-file-literally
curacao
  M-x hexl-mode      (M-x means ESC-x, or if setup correctly, ALT-x)
  M-x hexl-mode      (M-x means ESC-x, or if setup correctly, ALT-x)
  C-s vfat          (C-s is ctrl-s, or Search.)
  C-s vfat          (C-s is ctrl-s, or Search.)
Line 115: Line 129:
  M-C-x              (or, ESC then ctrl-x to input hex number)
  M-C-x              (or, ESC then ctrl-x to input hex number)
  00                (insert hex 00)
  00                (insert hex 00)
  C-x C-s            (Save buffer, answer yet to losing undo buffer)
  C-x C-s            (Save buffer, answer yes to losing undo buffer)
  C-x C-c            (Quit emacs)
  C-x C-c            (Quit emacs)


=== Read/Write ext2 ===
=== Read/Write ext2 ===
Line 136: Line 148:
  00057eb0: 7d64 09eb 0000 50e3 0800 000a 8030 9fe5  }d....P......0..
  00057eb0: 7d64 09eb 0000 50e3 0800 000a 8030 9fe5  }d....P......0..


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.


=== Pack new firmware up ===
=== Pack new firmware up ===
Line 194: Line 207:
You can '''telnet''' to you lim and login as '''root'''. You can FTP to the lim, login as '''root''' using any password (But not empty).
You can '''telnet''' to you lim and login as '''root'''. You can FTP to the lim, login as '''root''' using any password (But not empty).


To remount the HDD issue
To remount the HDD send the commands:


  ftp> '''site mount'''
  ftp> '''site mount'''
Line 216: Line 229:
  /mnt/HD1 ntfs-3g (read/write)
  /mnt/HD1 ntfs-3g (read/write)
  200 MOUNT ' ' finished.
  200 MOUNT ' ' finished.
If you are using '''ntfs-3g''' I would recommend you unmount the HDD cleanly, before playing. You can do this by;
ftp> '''site mount /mnt/HD1'''
200- Executing remount command:
Attempting remount of /dev/ide/host0/bus0/target0/lun0/part1:fuse
Unmounting /mnt/HD1 ...
Mounting as ntfs
Return code 0
200 MOUNT '/mnt/HD1' finished.
Ie. The same command again. It switches between kernel read-only ntfs, and fuse's read/write ntfs-3g.
Also note, for some reason the FTP command is touchy. You might have to issue the mount command a couple of times before it sees the '''/mnt/HD1''' argument. Not sure why, it works perfectly when it is not from boot.


Word of warning. The FTP transfer speeds are abysmal, but I have no time to attempt to speed things up.
Word of warning. The FTP transfer speeds are abysmal, but I have no time to attempt to speed things up.

Latest revision as of 02:16, 4 January 2008

Building a new Firmware

What this patch gives you:

  • enable telnetd
  • enable ftpd
  • remount ntfs with read/write using fuse
  • enable ext2 support
  • optional add ext2 support to curacao


Want to just download binary version?

update-1206-08-plus.bin Patched 2007/12/17 firmware. Untested. You have to rename it to update.bin 2008/01/04
update-1206-plus.bin Patched 2007/12/06 firmware. Untested. You have to rename it to update.bin 2007/12/21

update-1130-plus.bin Patched 2007/11/30 firmware. Untested. You have to rename it to update.bin 2007/11/30

update-1026-plus.bin Patched 2007/10/26 firmware. I personally run this one. You have to rename it to update.bin 2007/11/10

Got a newer firmware you want to patch yourself? Just run the patch script inside. Does everything on this page, except hex edit curacao for ext2. See below.

lim-firmware-utils.tgz 2007/11/10

Read about how to use FTP here


Unpack firmware

unrar x update.rar
mount -o loop -t romfs update.bin /mnt
rsync -arv /mnt limdata

Now all the work is in limdata/ For example, you should have limdata/linux.bin.gz


telnetd

Make sure you have a symlink for telnetd.

cd limdata/sbin/
ln -s ../bin/busybox telnetd

Add it to start up:

cd limdata/etc/init.d/
vi S30network

add five line, between the existing lines near the end:

insmod gpio_int.o
insmod fuse.o
mkdir /tmp/dev/
mknod /tmp/dev/fuse -m 0666 c 10 229
/usr/sbin/telnetd &
/usr/sbin/inetd /etc/inetd.conf & 
cd /curacao
./curacao /mnt /dev/ir

Don't forget the & sign.

fuse support

Copy the fuse binaries:

cd /downloaded_files/
cp fuse.o limdata/
cp fusermount ntfs-3g remount limdata/usr/bin/
cp ftpd limdata/usr/bin/
cp busybox_ext2 limdata/bin/
cp inetd.conf limdata/etc/

Create symlinks

cd /sbin/
ln -s ../bin/busybox_ext2 e2fsck
ln -s ../bin/busybox_ext2 e2label
ln -s ../bin/busybox_ext2 fdisk
ln -s ../bin/busybox_ext2 fsck
ln -s ../bin/busybox_ext2 fsck.ext2
ln -s ../bin/busybox_ext2 mke2fs
ln -s ../bin/busybox_ext2 mkfs.ext2
ln -s ../bin/busybox_ext2 tune2fs

ext2 support in curacao

If you want to be able to use internal HDD with ext2 filesystem type, you need to do this patch. Edit curacao with your favorite hex editor. I use emacs, in hexl-mode, but anything will work. (Not vi though). For details you can view ext2 link, but essentially, find the string vfat near the /dev/ide/ section. (Which is after /dev/scsi/ - ie USB), and replace this string with "ext2". Also change iocharset=utf8 with nocheck.

BEFORE:

002c8940: 6172 740a 0000 0000 2f64 6576 2f69 6465  art...../dev/ide
002c8950: 2f68 6f73 7430 2f62 7573 302f 7461 7267  /host0/bus0/targ
002c8960: 6574 302f 6c75 6e30 2f70 6172 7425 6400  et0/lun0/part%d.
002c8970: 2f6d 6e74 2f48 4425 642f 0000 7666 6174  /mnt/HD%d/..vfat
002c8980: 0000 0000 696f 6368 6172 7365 743d 7574  ....iocharset=ut
002c8990: 6638 0000 2573 2564 0000 0000 6e74 6673  f8..%s%d....ntfs
002c89a0: 0000 0000 6e6c 733d 7574 6638 0000 0000  ....nls=utf8....

AFTER:

002c8940: 6172 740a 0000 0000 2f64 6576 2f69 6465  art...../dev/ide
002c8950: 2f68 6f73 7430 2f62 7573 302f 7461 7267  /host0/bus0/targ
002c8960: 6574 302f 6c75 6e30 2f70 6172 7425 6400  et0/lun0/part%d.
002c8970: 2f6d 6e74 2f48 4425 642f 0000 6578 7432  /mnt/HD%d/..ext2
002c8980: 0000 0000 6e6f 6368 6563 6b00 743d 7574  ....nocheck.t=ut
002c8990: 6638 0000 2573 2564 0000 0000 6e74 6673  f8..%s%d....ntfs
002c89a0: 0000 0000 6e6c 733d 7574 6638 0000 0000  ....nls=utf8....

Don't forget to null-terminate the nocheck string.

If you are using emacs hexl-mode it is important that you use find-file-literally to load the file so that emacs does not attempt to do locale conversions.

Key sequence usage for emacs is:

emacs -nw 
M-x find-file-literally
curacao
M-x hexl-mode      (M-x means ESC-x, or if setup correctly, ALT-x)
C-s vfat           (C-s is ctrl-s, or Search.)
C-s                (Second C-s searches for 2nd occurence of VFAT)
C-g                (Stop search)
M-x overwrite-mode
Position cursor to start of vfat
ext2
Position cursor to start of iocharset=ut8
nocheck
M-C-x              (or, ESC then ctrl-x to input hex number)
00                 (insert hex 00)
C-x C-s            (Save buffer, answer yes to losing undo buffer)
C-x C-c            (Quit emacs)

Read/Write ext2

You can optionally make curacao mount the ext2 filesystem as read/write, but since you can remount it from the ftpd this is strictly not required. See ext2 page for more information.

Near the address 0x56910 look for 07 and make it 06. The first one is for the vfat mount, which we changed above. The second is for ntfs. Don't bother with the second as the kernel only has read-only support for ntfs.

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..

In the 1026 firmware it is here:

00057e90: 0520 a0e1 9d49 09eb 9c30 9fe5 0730 8de5  . ...I...0...0..
00057ea0: 0700 a0e1 0610 a0e1 9020 9fe5 0030 a0e3  ......... ...0..
00057eb0: 7d64 09eb 0000 50e3 0800 000a 8030 9fe5  }d....P......0..

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.

Pack new firmware up

genromfs -f update.bin -d limdata/ -V MAMBO

As a safety, if you run:

hexdump -C ~/update.bin |head
00000000  2d 72 6f 6d 31 66 73 2d  00 ce b5 d0 4f 0a 22 d5  |-rom1fs-....O.".|
00000010  4d 41 4d 42 4f 00 00 00  00 00 00 00 00 00 00 00  |MAMBO...........|
00000020  00 00 00 49 00 00 00 20  00 00 00 00 d1 ff ff 97  |...I... ........|
00000030  2e 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000040  00 00 00 60 00 00 00 20  00 00 00 00 d1 d1 ff 80  |...`... ........|
00000050  2e 2e 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000060  00 15 22 e2 00 00 00 00  00 15 22 58 d2 8e 17 f7  |.."......."X....|
00000070  62 69 74 6d 61 70 2e 62  69 6e 00 00 00 00 00 00  |bitmap.bin......|
00000080  52 41 57 44 8c 87 87 17  3c 0a 00 00 00 00 00 00  |RAWD....<.......|

Since bitmap.bin is in the root of limdata/ it looks correct.


Flash the lim

Copy update.bin to your LimHD200i's internal HDD, into a directory called update so you end up with /update/update.bin then using the LimHD200i's menu, select Update App.

If you download the binary package for updating firmwares, you can also run the script that does all this for you. Except for binary patch curacao. Binary patch curacao yourself and name it curacao_ext2 in the same directory that contains the binary package files.

[lundman@test utils]$ ./firmware_install ../update1026/update.bin
Attempting to mount
Password:
Creating limdata/ directory (please wait)
Making sure telnetd symlink is there (ignore error)
Copying files...
Patching limdata/etc/init.d/S30network ...
If you have patched curacao to mount ext2, name it curacao_ext2 in this directory
Copying in patched curacao_ext2
Packing up new firmware
-rw-rw-r-- 1 lundman lundman 14523392 Nov  1 15:27 update.bin
00000000  2d 72 6f 6d 31 66 73 2d  00 dd 9a 10 4e fb 3e 95  |-rom1fs-....N.>.|
00000010  4d 41 4d 42 4f 00 00 00  00 00 00 00 00 00 00 00  |MAMBO...........|
00000020  00 00 00 49 00 00 00 20  00 00 00 00 d1 ff ff 97  |...I... ........|
00000030  2e 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000040  00 00 00 60 00 00 00 20  00 00 00 00 d1 d1 ff 80  |...`... ........|
00000050  2e 2e 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000060  00 15 22 e2 00 00 00 00  00 15 22 58 d2 8e 17 f7  |.."......."X....|
00000070  62 69 74 6d 61 70 2e 62  69 6e 00 00 00 00 00 00  |bitmap.bin......|
00000080  52 41 57 44 8c 87 87 17  3c 0a 00 00 00 00 00 00  |RAWD....<.......|
00000090  09 00 00 00 00 00 00 00  d8 8c 87 17 4e 00 00 00  |............N...|


Good luck.


Using your special LimHD200i Firmware

You can telnet to you lim and login as root. You can FTP to the lim, login as root using any password (But not empty).

To remount the HDD send the commands:

ftp> site mount
200- Executing remount command:
Currently mounted filesystems are: 
/mnt/HD2 ext2
/mnt/HD1 ntfs
200 MOUNT ' ' finished.

ftp> site mount /mnt/HD1
200- Executing remount command:
Attempting remount of /dev/ide/host0/bus0/target0/lun0/part1 as ntfs
Unmounting /mnt/HD1 ...
Return code 0
200 MOUNT '/mnt/HD1' finished.

ftp> site mount
200- Executing remount command:
Currently mounted filesystems are: 
/mnt/HD2 ext2
/mnt/HD1 ntfs-3g (read/write)
200 MOUNT ' ' finished.

If you are using ntfs-3g I would recommend you unmount the HDD cleanly, before playing. You can do this by;

ftp> site mount /mnt/HD1
200- Executing remount command:
Attempting remount of /dev/ide/host0/bus0/target0/lun0/part1:fuse
Unmounting /mnt/HD1 ...
Mounting as ntfs
Return code 0
200 MOUNT '/mnt/HD1' finished.

Ie. The same command again. It switches between kernel read-only ntfs, and fuse's read/write ntfs-3g.

Also note, for some reason the FTP command is touchy. You might have to issue the mount command a couple of times before it sees the /mnt/HD1 argument. Not sure why, it works perfectly when it is not from boot.


Word of warning. The FTP transfer speeds are abysmal, but I have no time to attempt to speed things up.

FTP upload   NTFS-3G:  500 KB/s
FTP upload   ext2   : 2000 KB/s
FTP download NTFS-3G: 1100 KB/s
FTP download ext2   : 3500 KB/s
FTP download ntfs   : 3200 KB/s

Perhaps the upload buffer-size can be tweaked? Or is it fuse? fuse can do about 600 KB/s with block-size of 8192, 16384 and 32768. Block-size of 4096 is about half that speed. Ok, I made FTPD use 8192, and now I went from 100 KB/s to 500 KB/s. This is about the speed of fuse, so if you want more, you have to opimise fuse and/or ntfs-3g. Perhaps try compiling it with -O.