[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 ?.
A great progress,I think :
name="freebsd"
kernel="/mnt/zroot2/zroot2/OS/Chromebook/freebsd-xen/domU-freebsd/bootloaders/kernel.bin"
extra = "console=hvc0"
memory=512
vcpus=1
disk = [ 'FreeBSD-13.2-RELEASE-armv7.img,raw,xvda' ]
root@devuan-bunsen:/mnt/zroot2/zroot2/OS/Chromebook/freebsd-xen/domU-freebsd# ./start-freebsd
Parsing config from freebsd.cfg
libxl: error: libxl_device.c:1163:device_backend_callback: Domain 1:unable to add device with path / local/domain/0/backend/vbd/1/51712
libxl: error: libxl_create.c:1672:domcreate_launch_dm: Domain 1:unable to add disk devices
libxl: error: libxl_device.c:1163:device_backend_callback: Domain 1:unable to remove device with pat h /local/domain/0/backend/vbd/1/51712
libxl: error: libxl_domain.c:1530:devices_destroy_cb: Domain 1:libxl__devices_destroy failed
libxl: error: libxl_domain.c:1183:libxl__destroy_domid: Domain 1:Non-existent domain
libxl: error: libxl_domain.c:1137:domain_destroy_callback: Domain 1:Unable to destroy guest
libxl: error: libxl_domain.c:1064:domain_destroy_cb: Domain 1:Destruction of domain failed
freebsd is an invalid domain identifier (rc=-6)
Excuse Me for my ignorance,but from the patch I'm not able to understand if I should remove or keep this part as is :
cpsid ifa
mov r9, r0
mov r8, r1
mov ip, r2
thanks.
Very thanks for the new patch. I'm working on that....
With this patch, I get the following results (I don't have Xen so I can't try it from there):
% make buildkernel TARGET_ARCH=armv7 -DWITH_KERNEL_BIN .... --- kernel.bin --- linking kernel.bin --- kernel.full --- linking kernel.full --- kernel.bin --- text data bss dec hex filename 9111273 740924 2441216 12293413 0xbb9525 kernel.bin --- kernel.full --- ctfmerge -L VERSION -g -o kernel.full ... text data bss dec hex filename 9111273 740924 2441216 12293413 0xbb9525 kernel.full Building /usr/home/imp/obj/usr/home/imp/git/head/arm.armv7/sys/GENERIC/kernel.debug Building /usr/home/imp/obj/usr/home/imp/git/head/arm.armv7/sys/GENERIC/kernel 7.08 real 34.55 user 41.50 sys -------------------------------------------------------------- >>> Kernel build for GENERIC completed on Mon Jan 8 14:25:58 MST 2024 -------------------------------------------------------------- >>> Kernel(s) GENERIC built in 7 seconds, ncpu: 64, make -j100 --------------------------------------------------------------
% file /usr/home/imp/obj/usr/home/imp/git/head/arm.armv7/sys/GENERIC/kernel.bin /usr/home/imp/obj/usr/home/imp/git/head/arm.armv7/sys/GENERIC/kernel.bin: Linux kernel ARM boot executable zImage (little-endian)
And that w/o installing a different tool chain.
So natively or in a linux/macos world the same results...
Warner
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
--
Mario.
--
Mario.
--
Mario.
|