Am 10.09.2013 15:58, schrieb Guillaume Gardet:
> Hi,
> 
> 
> Le 10/09/2013 15:43, Stefan Seyfried a écrit :
>> Hi all,
>> 
>> I'm trying to get RasPi to boot with U-Boot, streamlined with the
>> other ARM platforms (I guess).
> 
> Raspberry Pi is a bit special. ;)

I know :-)

> boot.scr is a compiled version of boot.script. So it depends what you
> put in boot.script. We should use zImage from /boot in rootfs if
> possible.

I managed to do that.

Steps to achieve this:

1) I patched U-Boot to preserve the command line that the bootcode.bin
passed to it (the bootcode.bin is loading the u-boot as a kernel, so it
passes the commandline) and expose it as $bootargs_orig. Additionally I
enabled ext2/ext4 Filesytems. Result is in home:seife:ARM/u-boot-rpib

2) installed my u-boot-rpib.rpm, copied /boot/u-boot.bin onto the
FAT-partition (not renamed).

3) edit config.txt on the FAT partition, add the line

        kernel=u-boot.bin

4) create a script, e.g. /tmp/boot.scr:

# u-boot script to boot from second partition, can be / or /boot
prefixes="/boot/ /"
kernel="zImage"
dev=mmc
part=0:2  # second partition
# the boot args we got from the firmware loader
setenv bootargs \"$bootargs_orig\"
echo
echo "searching for kernel in..."
for prefix in $prefixes; do
  echo "\\c    $prefix "
  # hush has no "break" command, so we must put this inside the loop...
  if load $dev $part $kernel_addr_r ${prefix}zImage; then
    echo
    echo "booting the kernel... good luck :-)"
    echo
    bootz $kernel_addr_r
  fi
done

5) create a u-boot image from the script:

  mkimage -A arm -T script -C none -n "RaspberryPi boot helper" \
     -d /tmp/boot.scr /tmp/boot.scr.uimg

6) copy /boot.scr.uimg onto the FAT partition.

7) reboot, enjoy! :-)

The script searches zImage in the second partition, which should be ext2
or ext4. It searches first in /boot, if this fails it tries /, so that a
setup with 3 partitions, first FAT, second ext2 /boot, third for rootfs
will also work.

>> * who creates boot.scr.img?
> 
> It is you in the u-boot rpm build.

Well, I did not find anything in the u-boot build / spec file that would
do this. I notice that other architectures also use a boot.scr, wo I was
wondering which part of the build process actually creates this script /
image file.

>> Actually I am trying to do the following for the RPI:
>> 
>> * u-boot on SDCard FAT partition
>> * boot.script on SDCard FAT partition, intelligent enough to

This works

>> fetch some sort of config from
>> /boot on ext4 rootfs (for kernel command line options)

I did not get this to work (without compiling the config into a uimage
file, which would not be "easy" to edit), so I guess we have to live
with cmdline.txt in the FAT partition for now (this gets read by the
bootcode.bin loader) which is not the worst we could have :-)

Have fun and good luck :-)

        Stefan
-- 
Stefan Seyfried
"If your lighter runs out of fluid or flint and stops making
 fire, and you can't be bothered to figure out about lighter
 fluid or flint, that is not Zippo's fault." -- bkw
-- 
To unsubscribe, e-mail: [email protected]
To contact the owner, e-mail: [email protected]

Reply via email to