Hi Tom and Zhiwei

I think I managed to replicate your problem(s). It seems tmpfs is not being mounted correctly, which also explains your ntpd problems. The kernel then falls-back in a failsafe mode with root mounted ro. I suspect you have an old kernel without tmpfs support (see my email on 01 December, http://www.mail-archive.com/[email protected]/msg01058.html with full list of updates). Try: http://casper.berkeley.edu/svn/trunk/roach/sw/binaries/linux/uImage-20091006-mmcfix .

Also, the usbboot string was still bad. I've updated the wiki. You want:
setenv usbboot setenv bootargs console=ttyS0,115200 mtdparts=\$\ {partitions\} rootdelay=8 root='/dev/sda1 rw'\; bootm 0xfc000000



The fact that your bootargs weren't being honoured gave-away the error in the usbboot string and the give-away with the kernel error was this error message:
mount: wrong fs type, bad option, bad superblock on tmpfs,
    missing codepage or other error
    In some cases useful info is found in syslog - try
    dmesg | tail  or so




Apologies for the ethaddr=xx. You are correct, there should not be an equals sign. Also, apologies wrt the confusion with the setenv bootargs command. The proposed command would have changed the default bootargs, but the usbboot macro overwrites it. If you want to boot with the defaults, do a "run boot". To explain...

If you look at your environment (printenv), it should look something like this:

        bootdelay=10
        baudrate=115200
        loads_echo=
        preboot=run initboot
        hostname=roach
        netdev=eth0
init_eeprom=echo Programming EEPROM for configuration H;imw 0x52 0.1 87; imw 0x52 1.1 78; imw 0x52 2.1 52; imw 0x51 bit=report clear;check serial-output echo serial check;check cpld- probe roachcpld;mw.l 0x201000 0 400; check mem-zt
        kernel_addr=0xfc000000
partitions=physmap-flash.0:1792k(linux),2...@0x1c0000(fdt), 81...@0x200000(root),546...@0xa00000(usr),2...@0x3f60000
        boot=bootm ${kernel_addr}
bootargs=console=ttyS0,115200 mtdparts=physmap-flash.0:1792k(linux), 2...@0x1c0000(fdt),81...@0x200000(root),54656k2
        yget=loady 0x200000
update=protect off 0xfffa0000 0xffffffff;era 0xfffa0000 0xffffffff;cp.b 0x200000 0xfffa0000 ${filesize};protect onf soloboot=setenv bootargs console=ttyS0,115200 mtdparts=${partitions} root=/dev/mtdblock2; bootm 0xfc000000 usbboot=setenv bootargs console=ttyS0,115200 mtdparts=${partitions} rootdelay=8 root=/dev/sda1; bootm 0xfc000000 netboot=dhcp 0x400000; setenv bootargs console=ttyS0,115200 mtdparts=$ {partitions} root=${rootpath} ip=dhcp; bootm0
        newuboot=cp.b 0xfffa0000 0x200000 0x60000; run yget update
newkernel=run yget; era 0xfc000000 0xfc1bffff; cp.b 0x200000 0xfc000000 0x1c0000 newroot=run yget; era 0xfc200000 0xfc9fffff; cp.b 0x200000 0xfc200000 ${filesize} initboot=echo; echo type run netboot to boot via dhcp+tftp+nfs; echo type run soloboot to run from flash without
        clearenv=erase 0xfff60000 0xfff9ffff
        ethaddr=02:00:00:02:02:17
        ethact=ppc_4xx_eth0
        bootcmd=run netboot
        mem=524264k
        ver=U-Boot 2008.10-svn2226 (Nov 13 2009 - 09:27:45)

The ROACH uboot boot procedure is something like this (and you'll see this macros in the printenv listing above):

   1) uboot runs "preboot".
   2) "preboot" is a macro which runs "initboot".
3) "initboot" is another macro which brings up the boot options list. ROACH then waits "bootdelay" time and then runs the "bootcmd" macro. 4) "bootcmd" defaults to booting off flash at 0xfc000000. You can change this default to any one of four boot options by doing a "setenv bootcmd XXXXX":

The four boot options (usb, mmc/sd, network, flash) are all also macros. They generally change environment variables as required and then execute a boot command (eg from onboard flash at 0xfc000000), with boot arguments from the "bootargs" uboot environment variable.


Hope this sorts you out.
Jason




On 15 Jan 2010, at 23:36, Tom Downes wrote:

Jason:

I continue to be baffled. I tried your instructions, including the clearenv, except for 3 changes:

1. You had "setenv ethaddr=XX:XX..." when there should be no equal sign.
2. I did not default to usbboot.
3. I modified your setenv line to be preceded by "setenv usbboot" so that when I run usbboot it follows those instructions. I did saveenv the changes to memory.

It continues to mount the old USB stick rw and the new USB stick (same model so far as I can tell) ro. I am running 2.6.25-svn2338 and etch from 11/30 on the new stick. I don't know what filesystem is on the old stick.

Here is the output of mount and the contents of fstab after boot on the old USB:

# mount
rootfs on / type rootfs (rw)
/dev/root on / type ext2 (rw,errors=continue)
proc on /proc type proc (rw)
devpts on /dev/pts type devpts (rw,noexec,mode=620)
tmpfs on /var/tmp type tmpfs (rw,size=8192k)
usbfs on /proc/bus/usb type usbfs (rw,nodev,noexec)
/dev/mtdblock3 on /mnt/flash type jffs2 (rw)

# less /etc/fstab
proc            /proc         proc    defaults           0  0
devpts          /dev/pts      devpts  mode=620,noexec    0  0
tmpfs           /var/tmp      tmpfs   size=8M            0  0
usbfs           /proc/bus/usb usbfs   noexec,nodev       0  0
/dev/mtdblock3  /mnt/flash    jffs2   defaults           0  0

And the new USB. Enablign noatime makes sense to me, but it is different from the old USB. Otherwise it is only the "ro" that is different for root and the various other filesystems are a bit different.

# mount
rootfs on / type rootfs (rw)
/dev/root on / type ext2 (ro,noatime,errors=continue)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,noexec,mode=620)
usbfs on /proc/bus/usb type usbfs (rw,nodev,noexec)
/dev/mtdblock3 on /mnt/flash type jffs2 (rw)
tmpfs0 on /var/tmp type tmpfs (rw,size=32768k)
tmpfs1 on /tmp type tmpfs (rw,size=16384k)

# less /etc/fstab
proc            /proc         proc    defaults           0  0
sysfs           /sys          sysfs   defaults           0  0
devpts          /dev/pts      devpts  mode=620,noexec    0  0
usbfs           /proc/bus/usb usbfs   noexec,nodev       0  0
/dev/mtdblock3  /mnt/flash    jffs2   defaults           0  0

I have tried the following (while mounted ro) on the new USB drive and rebooted, but no luck.

tune2fs -i 0 /dev/sda1
tune2fs -c 0 /dev/sda1
tune2fs -e continue /dev/sda1

One thing to note is that the rootdelay=8 argument is not always respected. Sometimes it waits for a couple seconds (not 8) and others no time at all.

I strongly suspect something very simple with the kernel respecting something about the ext2 filesystem. For each USB stick I get warnings that the drive has not been checked no matter how many times I run e2fsck with combinations of -f and -p.

Tom


On 15 Jan 2010, at 08:08, Tom Downes wrote:

Thanks - I will try the environment variable changes less booting to USB by default until I actually see it work. I see that you changed the wiki.

I have successfully remounted it in the past - the problem is that a number of the init.d scripts, including if-up and ntpd fail due to not being able to write to disk. So it's not really a usable system until you go back and basically enter runlevel 5 manually. This is true when using the latest stock etch distribution with 0 modifications. I think the default behavior of USB booting ought to be re-examined in that context.

USB drives with write protect switches are reasonably common and could provide the same functionality.

Thanks to all the list for the help.

Tom

On Thu, Jan 14, 2010 at 9:28 PM, Jason Manley <[email protected] > wrote:
I think the key error is that you weren't escaping your new commands.

But I suggest you start from scratch. Erase any changes you may have made and return to defaults (this will restore your apparent missing 'partitions' variable, which automounts the onboard flash memory):

 * run clearenv

 * reset

 * setenv ethaddr=02:00:00:xx:xx:xx
(where xx:xx:xx is your board's serial number)

 * saveenv

 * reset
Now your board is back to the way it was when shipped from the factory.

To tell it to boot to usb by default...
 * setenv bootcmd run usbboot

To set the default kernel boot arguments (according to the wiki)...
* setenv bootargs console=ttyS0,115200 mtdparts=\$\{partitions\} rootdelay=8 root='/dev/sda1 rw'\; bootm 0xfc000000

 * saveenv

I think the problem might be that the command on the wiki doesn't escape the semi colons, dollar signs or curly-braces, so uboot interprets these as separate commands.


However, Marc at KAT suggests that you rather start with it mounted RO (the default) and then remount it after the kernel's started. He considers this a "safer" option.

To do this manually, once booted into linux, do

 * mount -o remount,rw /

Apparently you can make that change automatic on boot in fstab, though I haven't tried this myself.

Jason




On 15 Jan 2010, at 03:22, Mark Wagner wrote:

Hi Tom,

Have any of these permutations worked for you? I've gotten it to boot with the command I sent you earlier, but Jason also mentioned to me awhile ago that editing the fstab file would work too, but I haven't tried that yet.

Mark

On Thu, Jan 14, 2010 at 3:23 PM, Tom Downes <[email protected]> wrote:
Mark:

I think the problem might be more basic. I have not found clear instructions on the precise command that one is supposed to run to change the usbboot environment variable. It appears to be csh-like environment that one is greeted with when you break the automatic boot process.

I think the problem that I was having before was that when I ran:

setenv usbboot bootargs console=ttyS0,115200 mtdparts=${partitions} rootdelay=8 root=/dev/sda1 rw; bootm fc000000

it interpreted "bootm fc000000" as a 2nd command rather than part of the setenv. It also seems like there should be a second setenv after usbboot so that usbboot is not so much an environment variable itself as a shorthand for setting the bootargs environment variable to values appropriate for booting by USB.

So... I have tried a number of permutations of the below code, putting in single/double quotes all around (to manipulate whether the $ is interpreted literally or whether its value is taken in), including where you suggest and around ${partitions}. Putting single or double quotes around the whole thing allows the setenv commad to be interpreted as a single command rather than one setenv followed by a bootm.

Variation of what I have tried:

setenv usbboot 'setenv bootargs console=ttyS0,115200 mtdparts=$ {partitions} rootdelay=8 root=/dev/sda1 rw; bootm fc000000'

Sorry for being obtuse, but I'm not sure this booting environment is really csh/tcsh or just some extremely basic CLI.

Tom

On Thu, Jan 14, 2010 at 2:46 PM, Mark Wagner <[email protected] > wrote:
Hi Tom,

I needed to change root=/dev/sda1 rw to root='/dev/sda1 rw' (add qoutes) in the command below to get the usb filesystem mounted read/ write.

Mark



On Thu, Jan 14, 2010 at 2:39 PM, Tom Downes <[email protected]> wrote: Yes, it boots read-only even trying to set usbboot as below. Though, as I said, I cannot set mtdparts=${partitions}, I have to remove the dollar sign. If that is important then I'm not sure what to do because if I leave the dollar sign in it immediately boots and not to USB.


setenv usbboot bootargs console=ttyS0,115200 mtdparts=${partitions}
rootdelay=8 root=/dev/sda1 rw; bootm fc000000

I'll look into things more this afternoon.

Tom


On Tue, Jan 12, 2010 at 8:22 AM, Zhiwei Liu <[email protected]> wrote:

Tom,

Do you mean it still mounts the new filesystem read-only even if you
change the usbboot environment to "bootargs console=ttyS0,115200 mtdparts=${partitions}
rootdelay=8 root=/dev/sda1 rw; bootm fc000000"?

I wish I could play with the environment a little bit, but I made it to boot off the USB stick automatically. I can not interrupt the standard boot process at uboot. I'm still struggling to bring it back to the standard boot process, It seems like I have to reload the uboot to overwrite the 'bootargs' environment.

FYR, I also had some warnings when booting.
--------------------------------------------------
EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
VFS: Mounted root (ext2 filesystem).
Freeing unused kernel memory: 136k init
INIT: version 2.86 booting
warning: can't open /etc/mtab: No such file or directory
mount: wrong fs type, bad option, bad superblock on tmpfs,
    missing codepage or other error
    In some cases useful info is found in syslog - try
    dmesg | tail  or so
---------------------------------------------------
I don't know how to fix that.

Zhiwei




On Tue, Jan 5, 2010 at 5:18 PM, Tom Downes <[email protected]> wrote:
Zhiwei (and others):

We are having the same problem as you upon upgrading to the 20091006
kernel and the 20091130 etch file system on USB.  We have an older
filesystem (don't recall the date) on one USB stick and the new one on
another.  Both USB sticks are formatted ext2 and are the same
brand/model.

For some reason, when booting by "run usbboot" it will mount the old
filesystem read-write but the new filesystem read-only.  Doing a
remount fixes the problem, but of course the boot process has had a
number of failures along the way.

This is after changing the usbboot environment variable to what you
list, but when I try to do it with the dollar sign for partitions it
immediately runs.  So if I remove that, it will work.  Is that really
an environment variable?  In any case, it works for one system, but
not the other so I'm not sure it's the issue precisely.

setenv usbboot bootargs console=ttyS0,115200 mtdparts=${partitions}
rootdelay=8 root=/dev/sda1 rw; bootm fc000000
saveenv
run usbboot

(minus the dollar sign for mtdparts)

For both USB sticks it will complain about the file systems not having
been checked.  I have gone through and run "tune2fs -c 0 -i 0" on the
new stick and done a manual force check with "e2fsck -fp".  On the
ROACH and on a true desktop.  Yet it still gives the error.  My
impression is that sometimes the kernel will mount an ext2 fs
read-only if it doesn't think that it has been checked.  I would think
that this is the source of the problem were it not for the fact that
the same kernel mounts one disk read-write and the other read-only.

I usually get the date set correctly along the way and do soft reboots
so that the clock doesn't get too far off.  Otherwise I would be
concerned about automatic checks for a given number of days (despite
my use of tune2fs).

In both cases it also complains about the jffs2 filesystem not
mounting properly at the very end of boot.

I'm a bit baffled...

Tom














Reply via email to