There is a simpler way to resolve the problem:

1) do not drop anything
2) check if cmdline has "/dev/hda", not just "/dev" and make modifications
(replace 'h' with 's' and add init script location) only if there is a
positive result.

-----Original Message-----
From: Rod Whitby [mailto:[email protected]] 
Sent: Wednesday, March 18, 2009 3:17 PM
To: [email protected]
Cc: OpenWrt Development List
Subject: Re: [OpenWrt-Devel] [PATCH] fix FSG-3 kernel commandline

Zintis wrote:
> FSG-3 receives kernel commandline from Redboot. Commandline contains
> information about HDD partition that contains root filesystem. It is in
> style kernel 2.4 (I guess because Freecom recovery ramdisk image is kernel
> 2.4).
> 
> This patch fixes it at boot time for kernel 2.6 and adds OpenWrt specific
> "init=/etc/preinit". Therefore there is no need to change Redboot
> configuration.

The trouble here is that if someone uses Apex (as I do on my fsg3), then
the OpenWrt kernel will override the settings that I give.  I don't
think this patch (which was wrapped BTW) can be applied to the default
OpenWrt fsg3 kernel for this reason.

> +                             /* Boot always from sda. */
> +                             char *pp = strstr(default_command_line,
> "root=/dev/");
> +                             if(pp) {
> +                                     *(pp+10) = 's';
> +                                     *(pp+14) = 0; /* drop
> "mem=...@0x00000000" */

Dropping everything after the root=/dev/sda1 (e.g. my rootfstype= and
rootdelay= for booting from an ext2 partition on an internal USB stick)
is particularly nasty ...

I would suggest looking at the arm-kernel-shim program, and seeing if
that can be used for a binary-image-specific shim on the kernel which is
only used when building a web-upgrade binary image.  Then the normal
kernel file would be unchanged for other usage with Apex or RedBoot
where someone has modified the fconfig.

-- Rod

_______________________________________________
openwrt-devel mailing list
[email protected]
http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to