Bare-metal kernel not booting from LK


#1

Hi,

I started a bare metal kernel for DB410c (which doesn’t do much, apart from lighting a LED and hanging).
I would like to avoid having to use U-Boot and boot my kernel directly from LittleKernel (contrary to what is done here)
So far, everything works, except for the actual execution, and the LED lighting up (or console).

  • u-boot build boots fine (download via USB then boot),
  • when using the same (standalone) C code on u-boot, I can use LED or console (at a very early stage, just after the first console is setup), and I see the various outputs,
  • LK recognizes my own kernel just fine, loads it at the right address (given in the boot image’s header), and calls the hypervisor to make the 64-bit jump,
  • but then nothing happens, pointing that my code is not actually executing (I tried many different GPIO/console/etc combinations).

Here’s what I caught from the u-boot build process and LK source code :

  • initially the kernel is an ELF position-independent executable (because u-boot relocates itself during boot), otherwise just an ELF executable ;
  • it is then converted to a flat binary (via $(CROSS)objcopy), mapping all useful sections in the file ;
  • DTB is appended to it ;
  • then it’s packed into an image format (u-boot.img) with skales/mkbootimg utility (which at least adds the Android header information -magic number, kernel address and a couple others), which can be recognized by LK’s fastboot mode.
    I copied all these build steps, yet nothing happens in my code. Am I missing something?
    The first lines of the binary images (mine vs. u-boot) are the same, and the rest is very similar (viewed using flat binary disassembly).
    Is the hypervisor for some reason denying the 64-bit jump? Could (for example) an exception happen right after the boot starts and block the whole execution? (I have dummy code in vbar…)
    Is it enought to just make a valid Android boot image to be able to boot?

Thanks in advance for any advice/info !

Next thing I will try is using USB booting via u-boot (but until now I didn’t have the hardware) to check that my code is working right (based on link above).