This is a cache of https://discuss.96boards.org/t/installing-non-linux-os-on-dargonboard410c/6002. It is a snapshot of the page at 2024-11-04T09:29:05.167+0000.
Installing non linux os on dargonboard410c - DragonBoard410c - 96Boards Forum

Installing non linux os on dargonboard410c

Hi, I want to install non linux os on dragonboard.
I have an elf file of the kernel.
I gziped the elf file and used it as the kernel image in the mkbootimg command as instructed here

But I got:

[19960] [19960] booting linux @ 0x80008000, ramdisk @ 0x84000000 (4239482), tags/device tree @ 0x83e00000
[19970] [19970] undefined abort, halting
[19970] [19970] r0 0x00000000 r1 0x00000000 r2 0x83e00000 r3 0x644d5241
[19970] [19970] r4 0x8f68b834 r5 0x0040b07a r6 0x84000000 r7 0x8f68f2bc
[19970] [19970] r8 0x83e00000 r9 0x83e00000 r10 0x80008000 r11 0x80008000
[19970] [19970] r12 0x600001d3 usp 0x00000000 ulr 0x00000000 pc 0x80008000
[19970] [19970] spsr 0x800001d3

Hi, I specifically try to load the kvm image generated from the unikraft project:
https://wiki.xenproject.org/wiki/Category:Unikraft_Users

using the simple “hello world” repo http://xenbits.xen.org/git-http/unikraft/apps/helloworld.git

All the elf does is print some staff and halt.

I compile it with “staging” branch of unikraft and with the following as .config file:

https://github.com/kamomil/kamomil-helloworld/blob/master/config_kvm_arm64_cortex_a53.txt

the result is an elf file under the “build directory” which can be run with:

qemu-system-aarch64 -machine virt -m 256 -cpu cortex-a53 -nographic -serial mon:stdio -kernel build/helloworld_kvm-arm64

I that in the dragonboard 410 kernel source tree
(working/qualcomm/kernel.git - Qualcomm Landing Team kernel)

The kernel for mkboot command is generated with:

aarch64-linux-gnu-objcopy -O binary -R .note -R .note.gnu.build-id -R .comment -S vmlinux arch/arm64/boot/Image

So I did the same for the unikraft elf and set it as the --kernel parameter for the mkboot command.
Then I tried loading the boot.img with sudo fastboot boot boot.img. What happened is that the dragonboard rebooted to regular mode when received my image so loaded the linux image on the emmc.

The bootloader cannot load an ELF image, it loads a Linux kernel image.
To load your payload using Littlekernel you need to link it so that the
linked image starts with a Linux/arm64 kernel header (see
https://www.kernel.org/doc/Documentation/arm64/booting.txt ), convert
the ELF image to binary and then wrap that image using mkbootimg .

Details on how to provide a kernel header for non kernel code are shared
here:

Alternatively if you wish to load ELF images directly it might be
possible to modify u-boot to do this although, when I last looked
(mid-2017) I couldn’t find any elf64 support in u-boot so you might have
to add this first.

qemu-system-aarch64 -machine virt -m 256 -cpu cortex-a53 -nographic -serial mon:stdio -kernel build/helloworld_kvm-arm64

You haven’t said but presumably you have either rebuilt the image with some
DB410C drivers enabled or provided a suitable device tree so the
unikernel can adapter to the change of hardware. Without one of these things
a unikernel for kvm is very unlikely to run on a DB410C.

I that in the dragonboard 410 kernel source tree
(working/qualcomm/kernel.git - Qualcomm Landing Team kernel)

The kernel for mkboot command is generated with:

aarch64-linux-gnu-objcopy -O binary -R .note -R .note.gnu.build-id -R .comment -S vmlinux arch/arm64/boot/Image

So I did the same for the unikraft elf and set it as the --kernel parameter for the mkboot command.
Then I tried loading the boot.img with sudo fastboot boot boot.img. What happened is that the dragonboard rebooted to regular mode when received my image so loaded the linux image on the emmc.

As mentioned above, if the unikernel does not provide a suitable kernel header
for the loader to use then this is not sufficient.