PBP - Build Mainline Kernel

Hi, I wonder if someone can help me giving me some directions on how to build the mainline linux kernel from source and most of all how to “install” it.
I have i PinebookPro. What i know/can do is to git-clone the kernel source, modify a .dts to change the cpu clocks, move in the main folder the .config, run make menuconfig and save. If i run “make” i successfully compile it and get a vmlinux file in the main folder, but than what? I don’t have a lot of experiences with these ARM device, so i’m not sure on how to correctly install and run all the freshly compiled kernel + .dtb. Any help? I can’t find anything usefull online

The PKGBUILD is basically a shell script, so you can see the commands it runs:

If you already have your modified source and your config it should be something like:

make prepare
unset LDFLAGS
make ${MAKEFLAGS} Image modules
# Generate device tree blobs with symbols to support applying device tree overlays in U-Boot
make ${MAKEFLAGS} DTC_FLAGS="-@" dtbs

This builds it.
It’s installed with:
make INSTALL_MOD_PATH=/usr" modules_install
make INSTALL_DTBS_PATH="/boot/dtbs" dtbs_install
cp arch/$KARCH/boot/Image "/boot"

But it’s all mentioned in the PKGBUILD I linked.

This was really helpful, i’m gonna test and report back

small update:
the make ${MAKEFLAGS} Image modules went fine with no errors.

but i get a weird error when i try to build the dtbs, it seems like some files are missing, but i can confirm that the files are present in “/linux-master/include/dt-bindings/gpio/” (linux-master is the main build/root folder in this case). gpio.h is there as expected

make ${MAKEFLAGS} DTC_FLAGS="-@" dtbs
      DTC     arch/arm64/boot/dts/rockchip/px30-evb.dtb
    arch/arm64/boot/dts/rockchip/px30-evb.dts:7:10: fatal error: dt-bindings/gpio/gpio.h: No such file or directory
        7 | #include <dt-bindings/gpio/gpio.h>
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    make[2]: *** [scripts/Makefile.lib:328: arch/arm64/boot/dts/rockchip/px30-evb.dtb] Error 1
    make[1]: *** [scripts/Makefile.build:496: arch/arm64/boot/dts/rockchip] Error 2
    make: *** [Makefile:1343: dtbs] Error 2

EDIT: i found the problem.

probably a noob level problem but…the #include inside the files are pointing to a dt-bindings that does not exist or can’t be found, adding the exact location of the dt-bindings folder in the dtbs (#include </run/media/xxxxxxx/xxxxxx/src/linux-master/include/dt-bindings/gpio/gpio.h>) fix the problem… all files have the same issue, is there an easy way to let the compiler know where to look for these folders?

EDIT2:
Re-done the entire procedure as root and not using sudo, compile went ok i think, installed it, but i get a black screen at boot and it just hang there… The PBP is supportee by the mainline kernel right? I guess i’m missing something. Can be the initramfs be related to this? If i run “mkinitcpio -P” i see that it generate something related to the 5.10 kernel that was installed, and not the 5.11 that i just installed

EDIT3:
i managed to build a working kernel using a slightly modified version of the PKGBUILD file you provided. I hope i can continue to build on top of it and adapt it to my needs. It took a while but thanks! it’s all about learning

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.