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



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.

 


Rackspace

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