Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Mar 2016 16:44:40 +0100
From:      sylvain@sylvaingarrigues.com
To:        freebsd-arm <freebsd-arm@freebsd.org>
Subject:   Booting kernel.bin directly on Raspberry Pi / external DTB support
Message-ID:  <83488D96-F585-4A89-B53A-8E2E60BA3BD3@sylvaingarrigues.com>

next in thread | raw e-mail | index | archive | help
Hello,

I have written a small (ugly) patch to be able to boot a kernel directly =
without the ubldr loader while still using an external DTB (Linux-style =
booting may pass the DTB location pointer in the r2 register).
The patch is here: https://reviews.freebsd.org/differential/diff/14577/ =
<https://reviews.freebsd.org/differential/diff/14577/>=20

I tested my patch successfully with the QEMU emulator with the -dtb =
option available in recent versions, using a VERSATILEPB kernel without =
FDT_STATIC.
# qemu-system-arm -M versatilepb -m 128M -kernel versatile.flash -cpu =
arm1176 -dtb versatilepb.dtb
FYI, once the kernel is built, here is the script to build the =
versatile.flash (adapted from gonzo, no longer need to clear the r0-r3 =
registers): https://reviews.freebsd.org/P92 =
<https://reviews.freebsd.org/P92>;

I also tested successfully my patch on my Raspberry Pi 2 using U-BOOT =
and the RPI2 kernel with my patch applied (and the LINUX_BOOT_ABI =
option):
u-boot> fatload mmc 0 0x200000 kernel.bin
u-boot> go 0x200000

That works.

So now I thought I could even bypass u-boot and launch kernel.bin =
directly from the Pi firmware=E2=80=A6 But it doesn=E2=80=99t work, I =
don=E2=80=99t understand why, and that is why I am writing here.
Here is the config.txt which I thought would work:

kernel=3Dkernel.bin (instead of u-boot.bin)
kernel_address=3D0x200000 (line added because a FreeBSD kernel needs to =
be loaded on a 1MB or 2MB boundary)
device_tree=3Drpi2.dtb
device_tree_address=3D0x100
disable_commandline_tags=3D1

What am I missing? Is it even possible to boot kernel.bin directly on =
the Pi (with my patch)? I found this static minimalist loader from =
Andrew here: =
https://github.com/freebsd/freebsd/commit/074d37d46c3f9b282cd2d849d997b1b3=
9acd710c =
<https://github.com/freebsd/freebsd/commit/074d37d46c3f9b282cd2d849d997b1b=
39acd710c> - does it mean such a loader is necessary before the kernel?

Thanks,
Sylvain

PS: I know the =C2=AB official and supported =C2=BB way of booting =
FreeBSD on the Pi is the u-boot + ubldr combination. I just would like =
to finish this experiment and understand why kernel.bin cannot be booted =
directly.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?83488D96-F585-4A89-B53A-8E2E60BA3BD3>