[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Booting the FreeBSD kernel as an zImage file needs a patch upgrade ?.



Hi Mario,

On 08/01/2024 14:20, Mario Marietto wrote:
I took for granted that "arm-none-eabi-objcopy" does not work. It says
command not found.

This is usually not installed by default. The triple (i.e. arm-none-eabi-) depending on with cross-toolchain you installed (there are various for Arm).

That said if you are on the Chromebook, the normal objdump may already be compatible (that's assuming your OS is 32-bit).

Anyway, as you are building using the option WITH_KERNEL_BIN=1, then you should not need the trick. If 'file' still doesn't show zImage, then it would indicate that the header is not at the correct place.

I had some spare time this evening and decided to give a try. I have downloaded the latest FreeBSD (I wasn't sure which with branch from Elliott tree you were using). Below the changes I made to FreeBSD:

diff --git a/sys/arm/arm/locore-v6.S b/sys/arm/arm/locore-v6.S
index 4e356d6b34e2..56a7cf476d5b 100644
--- a/sys/arm/arm/locore-v6.S
+++ b/sys/arm/arm/locore-v6.S
@@ -105,6 +105,17 @@
        .globl  btext
 btext:
 ASENTRY_NP(_start)
+    .rept 8
+    mov r0, r0
+    .endr
+
+    b start
+
+    .word 0x016f2818
+ .word 0 /* absolute load/run zImage address or 0 for PIC */
+    .word (_edata - btext)
+
+start:
        STOP_UNWINDING          /* Can't unwind into the bootloader! */

        /* Make sure interrupts are disabled. */
diff --git a/sys/arm/conf/GENERIC b/sys/arm/conf/GENERIC
index f8a39cb370d5..caaf29216d27 100644
--- a/sys/arm/conf/GENERIC
+++ b/sys/arm/conf/GENERIC
@@ -278,3 +278,4 @@ makeoptions MODULES_EXTRA+="dtb/zynq"
 # SOC-specific modules
 makeoptions    MODULES_EXTRA+="allwinner"
 makeoptions    MODULES_EXTRA+="imx"
+makeoptions WITH_KERNEL_BIN=1

The first hunk is my patch rebased as it didn't apply correctly. The second part is the hack to enable WITH_KERNEL_BIN=1.

I compiled on an M2 MacBook Pro (it should not matter though). With:

42sh> MAKEOBJDIRPREFIX=$HOME/works/oss/freebsd/build/ tools/build/make.py -j 8 TARGET=arm TARGET_ARCH=armv7 buildkernel

Then I checked the output:

42sh> file ../build/Users/jgrall/works/oss/freebsd/src/arm.armv7/sys/GENERIC/kernel.bin ../build/Users/jgrall/works/oss/freebsd/src/arm.armv7/sys/GENERIC/kernel.bin: Linux kernel ARM boot executable zImage (little-endian)

I didn't try to load the kernel, but at least file thinks that this a zImage. I expect that 'xl' will be able to load the binary.

Would you be able to give a try and report?

Cheers,

--
Julien Grall



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.