jetcom / xinu-arm

Xinu arm port, for Raspberry Pi
Other
28 stars 32 forks source link

Pi hw2 uboot #8

Closed zachberger closed 11 years ago

zachberger commented 11 years ago

Through some experimentation I was able to get Xinu to boot on the Raspberry Pi, with no changes to Xinu at all.

I initially started with the uBoot binary you referenced from FreeBSD, however I had no luck. I complied and got working the RPi U-boot found here: https://github.com/gonzoua/u-boot-pi

To do this I add three files to the existing boot FS:

u-boot.bin - This is the U-boot binary compiled from sources above boot.scr - This is a compiled U-Boot script. To compile this you use the U-Boot utility mkimage: mkimage -A arm -O linux -T script -C none -d boot-tftp.cmd boot.scr

uEnv.txt - this sets the environment variables for U-Boot, for tftp only two variables are needed serverip (the tftp server) and ipaddr (the RPi's address)

You can change what image the GPU loads in config.txt by adding a property 'kernel'. This allows easy switching between running U-Boot (u-boot.bin) and running Xinu (kernel.img).

Once these files are in place U-Boot will launch. By default it gives you 3s to press any-key to override the boot.scr, in-case you want to change the boot commands, otherwise it will tftp the kernel and execute it.

This is all documented in README.uboot

tebrown commented 11 years ago

I am going to open this one up to the committee as to whether they would prefer to check in binaries of u-boot, or take a snapshot of the u-boot source we are building and include that in the tree (and have it build as part of the xinu build for the Pi).

jsb2092 commented 11 years ago

I think that would be best

zachberger commented 11 years ago

I removed the U-boot binaries, and included the source of uboot in /boot/raspberry-pi/u-boot/

The build of u-boot is not yet integrated into the Xinu build process but

U-boot can be built by:

cd boot/raspberry-pi/u-boot/
CROSS_COMPILE=arm-none-eabi-
export CROSS_COMPILE
make rpi_b

The output file of interest is u-boot.bin

The u-boot script can then be built using mkimage which was also compiled in the previous step.

./tools/mkimage -A arm -O linux -T script -C none -d ../tftp-boot.cmd ../boot.scr
tebrown commented 11 years ago

Merging this request. Please add this to the build though as it is required to boot the pi

caltry commented 11 years ago

@zachberger Instead of importing the u-boot source directly into the Xinu repo, I'd consister including it via a git submodule. That should make it easier to keep track of what revision of u-boot we're on, while keeping the code for Xinu and u-boot distinct.

While the pull-request has already been merged, I think it's worth looking into before merging pi-hw2 into master.

zachberger commented 11 years ago

Good idea. I've never used submodules but this is the perfect use case. I've added a pull request with this change.