mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 07/11] add a generic default environment
Date: Tue, 15 Jun 2010 11:13:03 +0200	[thread overview]
Message-ID: <20100615091303.GB17595@pengutronix.de> (raw)
In-Reply-To: <1276508921-3264-8-git-send-email-s.hauer@pengutronix.de>

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

> +
> +
> +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?

> +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@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

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2010-06-15  9:13 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-14  9:48 More patches Sascha Hauer
2010-06-14  9:48 ` [PATCH 01/11] pcm037: Add MMU support Sascha Hauer
2010-06-14  9:48 ` [PATCH 02/11] bootu: Allow passing in devices as parameter Sascha Hauer
2010-06-14  9:48 ` [PATCH 03/11] Allow to merge default environment from more than one directory Sascha Hauer
2010-06-14  9:48 ` [PATCH 04/11] include support for a simple pseudo number generator Sascha Hauer
2010-06-15  9:39   ` Peter Korsgaard
2010-06-15 11:54     ` Sascha Hauer
2010-06-17 13:17   ` Sascha Hauer
2010-06-17 13:26     ` Andy Pont
2010-06-17 14:14     ` Peter Korsgaard
2010-06-14  9:48 ` [PATCH 05/11] net: implement random_ether_addr Sascha Hauer
2010-06-14  9:48 ` [PATCH 06/11] net: use a random mac address if the current device does not have one Sascha Hauer
2010-06-14  9:48 ` [PATCH 07/11] add a generic default environment Sascha Hauer
2010-06-15  9:13   ` Uwe Kleine-König [this message]
2010-06-17 13:20   ` Sascha Hauer
2010-06-19 20:14     ` Uwe Kleine-König
2010-06-14  9:48 ` [PATCH 08/11] pcm038: use generic default env Sascha Hauer
2010-06-14  9:48 ` [PATCH 09/11] pcm043: " Sascha Hauer
2010-06-14  9:48 ` [PATCH 10/11] pcm037: " Sascha Hauer
2010-06-14  9:48 ` [PATCH 11/11] pca100: " Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100615091303.GB17595@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox