[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 ?.



I took for granted that "arm-none-eabi-objcopy" does not work. It says command not found.

On Mon, Jan 8, 2024 at 1:48 PM Mario Marietto <marietto2008@xxxxxxxxx> wrote:
Directly on the Chromebook :

root@devuan-bunsen:/mnt/zroot2/zroot2/OS/Chromebook/freebsd-xen/domU-freebsd/bootloaders# mv kernel.bin kernel.bin.old
 
root@devuan-bunsen:/mnt/zroot2/zroot2/OS/Chromebook/freebsd-xen/domU-freebsd/bootloaders# objcopy -O binary -S kernel kernel.bin

root@devuan-bunsen:/mnt/zroot2/zroot2/OS/Chromebook/freebsd-xen/domU-freebsd# ./start-freebsd

Parsing config from freebsd.cfg
xc: error: panic: xg_dom_core.c:689: xc_dom_find_loader: no loader found: Invalid kernel
libxl: error: libxl_dom.c:571:libxl__build_dom: xc_dom_parse_image failed
libxl: error: libxl_create.c:1640:domcreate_rebuild_done: Domain 4:cannot (re-)build domain: -3
libxl: error: libxl_domain.c:1183:libxl__destroy_domid: Domain 4:Non-existent domain
libxl: error: libxl_domain.c:1137:domain_destroy_callback: Domain 4:Unable to destroy guest
libxl: error: libxl_domain.c:1064:domain_destroy_cb: Domain 4:Destruction of domain failed
freebsd is an invalid domain identifier (rc=-6)

freebsd.cfg :

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' ]

On Mon, Jan 8, 2024 at 10:34 AM Stanislav Silnicki <stanislav.silnicki@xxxxxxxxxxx> wrote:
Hi!
I think its worth trying something like this: arm-none-eabi-objcopy -O binary -S kernel kernel.bin
objcopy expects your host (x86_amd64?) elf format....

Mario Marietto wrote:


If I have understood well,the message : file format not recognized is good because it is in elf format,right ? if it is,why it cant boot the rest of the system ?

Il lun 8 gen 2024, 01:58 Mario Marietto <marietto2008@xxxxxxxxx> ha scritto:
# objcopy -O binary -S kernel.bin kernels.bin
objcopy: file format not recognized

On Mon, Jan 8, 2024 at 1:56 AM Mario Marietto <marietto2008@xxxxxxxxx> wrote:
ok. So :

# objcopy -O binary -S kernel kernels
# file kernels
kernels: data

On Mon, Jan 8, 2024 at 1:37 AM Warner Losh <imp@xxxxxxxxxx> wrote:


On Sun, Jan 7, 2024 at 5:17 PM Mario Marietto <marietto2008@xxxxxxxxx> wrote:
---> objcopy -O binary -S <your-elf> <output-binary>

What's "my elf" ? What's the output binary ? I don't understand which values should be used there. I have only one file,kernel.bin,but two slots to fill.

I think he means the 'kernel' file.

was the 'kernel' file deleted if you only have kernel.bin? It isn't normally.

Warner
 
On Mon, Jan 8, 2024 at 1:00 AM Warner Losh <imp@xxxxxxxxxx> wrote:


On Sun, Jan 7, 2024 at 3:44 PM Julien Grall <julien@xxxxxxx> wrote:
Hi,

On 05/01/2024 21:20, Mario Marietto wrote:
> Sorry I forgot to change the name of the kernel :
>
> # cd /usr/freebsd-src/sys/arm/conf
> # cp GENERIC MYKERNEL
>
> # nano MYKERNEL
> makeoptions WITH_KERNEL_BIN=1
>
> # make KERNCONF=MYKERNEL TARGET=arm TARGET_ARCH=armv7 buildkernel
> # make KERNCONF=MYKERNEL TARGET=arm TARGET_ARCH=armv7 DESTDIR=/build-xen
> installkernel
>
> same error as before : *kldxref: /build-xen/boot/kernel/kernel: no ELF
> relocation table found.*

Are all the sections in ELF contiguous in memory? If so, you could try
to use manually objcopy. Something like:

objcopy -O binary -S <your-elf> <output-binary>

Then use 'file' to check if the format is recognized as zImage. If so,
you could use it in your xl configuration.

Note that this *might* be what KERNEL_BIN is doing underhood. But I
haven't checked not nor I am familiar with the area. I am only proposing
something that may get you unstuck for now. You can come back to fix the
problem afterwards.

# Generate the .bin (no elf headers) kernel as an extra build output.
# We must relink to generate the .bin kernel, because without headers the
# location of everything changes.  We also strip the ARM marker symbols.
${KERNEL_KO}.bin: ${SYSTEM_DEP} vers.o
        @echo "linking ${.TARGET}"
        @${SYSTEM_LD_BASECMD} \
            --defsym='text_start=kernbase' \
            -o ${.TARGET} ${SYSTEM_OBJS} vers.o
        ${SIZE} ${.TARGET}
        @${OBJCOPY} \
            --wildcard \
            --strip-symbol='$$[adt]*' \
            --output-target=binary \
            ${.TARGET}
        @chmod 755 ${.TARGET}

is what makes it...

Warner
 
Cheers,

--
Julien Grall


--
Mario.


--
Mario.


--
Mario.


--
Mario.


--
Mario.

 


Rackspace

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