Some points, which I may add to the wiki at some point:
The ls-chl partitions are represented by one mtd device, mtd0. In Debian, you can use fw_printenv and fw_setenv to set u-boot environment variables for this device by using the following, saved as '/etc/fw_env.config'
# Configuration file for fw_(printenv/saveenv) utility.
# Up to two entries are valid, in this case the redundant
# environment sector is assumed present.
# MTD device name Device offset Env. size Flash sector size
/dev/mtd0 0x3F000 0x1000 0x1000
If you mess these settings up, you can add a serial port to the device and reset them within u-boot. I think the resetenv even makes this quite easy.
Using this, I can now get Debian's initramfs to not show up as corrupt on boot
The settings I updated (new values shown) are:
bootargs_root=root=/dev/sda2 rw initrd=0x00800040 panic=5
(from bootargs_root=root=/dev/sda2 rw initrd=0x00800040,15M panic=5)
bootcmd=ide reset; ext2load ide 0:1 0x00100000 /$(kernel); ext2load ide 0:1 0x00800000 /$(initrd); setenv bootargs $(bootargs_base) $(bootargs_root) $(bootargs_func) $(bootargs_debug) $(buffalo_ver); bootm 0x00100000 0x00800000
(I changed occurrences of 'ide 1:1' to 'ide 0:1', so that it loaded from the (first) disk's second partition, you may need something different!)
fw_setenv allows you to set a whole bunch of variables at the same time using a file. I have used the following file ('env.txt') to successfully update u-boot settings on my second ls-chl. This box runs Debian and has a similar partition layout (boot, root, swap, data), meaning the file was safe to use on it:
bootargs $(bootargs_base) $(bootargs_root)
bootargs_root root=/dev/sda2 rw initrd=0x00800040 panic=5
bootcmd ide reset; ext2load ide 0:1 0x00100000 /$(kernel); ext2load ide 0:1 0x00800000 /$(initrd); setenv bootargs $(bootargs_base) $(bootargs_root) $(bootargs_func) $(bootargs_debug) $(buffalo_ver); bootm 0x00100000 0x00800000
def_tftp tftp 0x00100000 $(kernel); tftp 0x00800000 $(initrd); setenv bootargs $(bootargs_base) $(bootargs_root) $(buffalo_ver) tftpboot=yes; bootm 0x00100000 0x00800000
This is flashed with:
sudo fw_setenv -s env.txt
Finally, I have had problems when I unplug my device, plug it in and power cycle. I think the root cause is the rtc on the device has no battery. The hardware clock will be wrong after removing power, so ntpd should be used. If it's wrong very far in the future, then the filesystem mount time will be in the future and when you next restart, fsck will halt and want you to intervene because of this, resulting in the device not booting. This can be fixed by taking the drive out and running fsck on it... but then you've removed power so might run into the same thing again....
As a solution (for Debian at least), I have added '/etc/e2fsck.conf' with:
broken_system_clock = 1
I have also added '/etc/initramfs-tools/hooks/e2fsck', which must be executable (chmod +x):
case $1 in
copy_exec /etc/e2fsck.conf /etc/e2fsck.conf
This script adds the config file to Debian's initramfs when it is rebuilt, allowing the initramfs to deal with these problems on its own (hopefully!!!). You can rebuild the initramfs with:
sudo update-initramfs -u