PINE64
How do I compile an arbitrary kernel for U-Boot? - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: ROCKPRO64 (https://forum.pine64.org/forumdisplay.php?fid=98)
+--- Forum: Linux on RockPro64 (https://forum.pine64.org/forumdisplay.php?fid=101)
+--- Thread: How do I compile an arbitrary kernel for U-Boot? (/showthread.php?tid=18279)



How do I compile an arbitrary kernel for U-Boot? - Valenoern - 05-29-2023

I have been trying to get a DVD drive to work with the RockPRO64, but for some reason the kernel is not properly operating the drive and the open/close button does not work.
I researched the problem, and it seems like this is a general problem with the Linux kernel or its modules on multiple architectures — some versions of the "linux" package in Manjaro/Arch properly provided CD drive support and some did not. So, now I simply have to compile kernels from source until I get the right one.  [2]

The only problem is, after a week or so of trying to compile kernels and comb through source code for rockpro U-Boot packages I still have no idea how to compile a kernel for U-Boot that actually boots. I have tried "mkimage" and putting a regular compiled kernel stripped of debug information into mkimage, but the kernel always fails to boot and restarts the CPU. I read and re-read the documentation for the U-Boot packages and saw that I'm apparently supposed to have a kernel tree with "make uImage" or "make pImage", but none of the kernel.org trees had this so I'm not sure where to get this source tree.  [1]
I am also confused where the blobless package "uboot-rockpro64-foss" finds the kernel if it does not install one to /boot, or in any case where my kernel is on disk after I boot into a Manjaro partition.

How do I compile a kernel from source into an "Image" file loaded by extlinux.conf?
Is that even the same kernel that loads when I boot my eMMC and run "uname -a" to describe the kernel? How do I compile and use a new one?


[1] edit 6/07: so, apparently new kernel trees have "make Image". I tried this with kernel version 6.4.0-rc4 and it did not boot past what seems to be the Secondary Program Loader (SPL).

[2] edit 6/17: well now I feel really stupid. The problem with the DVD drive was that I kept trying to plug it into a USB 2.0 port and it really needed a USB 3.0 port. I just never figured this out because I always had something else in the single one the ROCKPro has.
That said, it would still probably be helpful to people to know how to compile a kernel, so I will still test it if anybody figures out how. I have already been messing with creating distro images for a while now.


RE: How do I compile an arbitrary kernel for U-Boot? - CounterPillow - 06-12-2023

The default target built with the arm64 ARCH should give you a arch/arm64/boot/Image, that's the image that u-boot is capable of booting.


RE: How do I compile an arbitrary kernel for U-Boot? - Valenoern - 06-14-2023

(06-12-2023, 01:54 AM)CounterPillow Wrote: The default target built with the arm64 ARCH should give you a arch/arm64/boot/Image, that's the image that u-boot is capable of booting.

I took that file and copied it to a fresh SD card install, moving the existing "Image" to a new name. The "Image" there to begin with booted, the compiled "Image" did not boot and part way through booting the power light on the monitor shut off.

(This is the same 6.4 kernel from above)


RE: How do I compile an arbitrary kernel for U-Boot? - CounterPillow - 06-16-2023

You should use a USB-to-Serial adapter to debug this, making sure to disable any quiet or loglevel options in your kernel command line. A monitor is not a good way to get kernel messages.