[PATCH 07/11] add a generic default environment
Marc Kleine-Budde
mkl at pengutronix.de
Tue Jun 15 06:01:26 EDT 2010
Uwe Kleine-König wrote:
> Hello Sascha,
>
>> diff --git a/defaultenv/bin/boot b/defaultenv/bin/boot
>> new file mode 100644
>> index 0000000..8c300a3
>> --- /dev/null
>> +++ b/defaultenv/bin/boot
>> @@ -0,0 +1,110 @@
>> +#!/bin/sh
>> +
>> +. /env/config
>> +
>> +if [ x$1 = xnand ]; then
>> + rootfs_loc=nand
>> + kernel_loc=nand
>> +elif [ x$1 = xnor ]; then
>> + rootfs_loc=nor
>> + kernel_loc=nor
>> +elif [ x$1 = xnet ]; then
>> + rootfs_loc=net
>> + kernel_loc=net
>> +fi
> case "$1" in
> nand|nor|net)
> rootfs_loc=$1;
> kernel_loc=$1;
> ;;
> esac
AFAIK, the barebox shell doesn't support case.
>
>> +
>> +
>> +if [ x$ip = xdhcp ]; then
>> + bootargs="$bootargs ip=dhcp"
>> +elif [ x$ip = xnone ]; then
>> + bootargs="ip=none"
>> +else
>> + bootargs="$bootargs ip=$eth0.ipaddr::$eth0.gateway:$eth0.netmask:::"
>> +fi
>> +
>> +
>> +if [ $rootfs_loc = net ]; then
> "x$rootfs_loc" = "xnet"
>
>> + bootargs="$bootargs root=/dev/nfs nfsroot=$nfsroot,v3,tcp noinitrd"
>> +elif [ $rootfs_loc = initrd ]; then
>> + bootargs="$bootargs root=/dev/ram0 rdinit=/sbin/init"
> Wouldn't it be nice to load the initrd into /dev/ram0, too?
at least for ARM barebox only supports initrd compiled into the kernel,
thus there's no need to load the inird explicitly.
>
>> +else
>> + if [ x$rootfs_loc = xnand ]; then
>> + rootfs_mtdblock=$rootfs_mtdblock_nand
>> + else
>> + rootfs_mtdblock=$rootfs_mtdblock_nor
>> + fi
>> +
>> + if [ $rootfs_type = ubifs ]; then
>> + bootargs="$bootargs root=ubi0:root ubi.mtd=$rootfs_mtdblock"
>> + else
>> + bootargs="$bootargs root=/dev/mtdblock$rootfs_mtdblock"
>> + fi
>> +
>> + bootargs="$bootargs rootfstype=$rootfs_type noinitrd"
>> +fi
>> +
>> +if [ -n $nor_parts ]; then
>> + mtdparts="${mtdparts}physmap-flash.o:${nor_parts};"
>> +fi
>> +
>> +if [ -n $nand_parts ]; then
>> + mtdparts="${mtdparts}$nand_device:${nor_parts};"
>> +fi
>> +
>> +if [ -n $mtdparts ]; then
>> + bootargs="${bootargs} mtdparts=\"${mtdparts}\""
>> +fi
>> +
>> +if [ ! -e /dev/ram0.kernelraw ]; then
>> + # arm raw kernel images are usually located at sdram start + 0x8000
>> + addpart dev/ram0 8M at 0x8000(kernelraw)
>> +fi
>> +
>> +if [ ! -e /dev/ram0.kernel ]; then
>> + # Here we can safely put the kernel without risking of overwriting it
>> + # while extracting
>> + addpart dev/ram0 8M(kernel)
>> +fi
>> +
>> +if [ $kernel_loc = net ]; then
>> + if [ x$ip = xdhcp ]; then
>> + dhcp
>> + fi
>> + if [ $kernelimage_type = uimage ]; then
>> + netload="/dev/ram0.kernel"
>> + elif [ $kernelimage_type = zimage ]; then
>> + netload="/dev/ram0.kernel"
>> + elif [ $kernelimage_type = raw ]; then
>> + netload="/dev/ram0.kernelraw"
>> + elif [ $kernelimage_type = raw_lzo ]; then
>> + netload="/dev/ram0.kernel"
>> + else
>> + echo "error: missing kernel_image_type"
>> + exit 1
>> + fi
>> + tftp $kernelimage $netload || exit 1
>> + kdev="$netload"
>> +elif [ $kernel_loc = nor ]; then
>> + kdev="/dev/nor0.kernel"
>> +elif [ $kernel_loc = nand ]; then
>> + kdev="/dev/nand0.kernel.bb"
>> +else
>> + echo "error: missing kernel_loc"
>> + exit 1
>> +fi
>> +
>> +if [ $kernelimage_type = uimage ]; then
>> + bootm $kdev
>> +elif [ $kernelimage_type = zimage ]; then
>> + bootz $kdev
>> +elif [ $kernelimage_type = raw ]; then
>> + if [ $kernel_loc != net ]; then
>> + ec
> maybe better spell that out?
>
>> + cp $kdev /dev/ram0.kernelraw
>> + fi
>> + bootu /dev/ram0.kernelraw
>> +elif [ $kernelimage_type = raw_lzo ]; then
>> + unlzo $kdev /dev/ram0.kernelraw
>> + bootu /dev/ram0.kernelraw
>> +fi
>> +
> trailing new line
>
> Best regards
> Uwe
>
cheers, Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/barebox/attachments/20100615/b1897fbc/attachment.sig>
More information about the barebox
mailing list