HOWTO: Linux Kernel customisation/build from source
Slackware - ARMThis forum is for the discussion of Slackware ARM.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
HOWTO: Linux Kernel customisation/build from source
Hello
I've written a HOWTO guide to enable you to customize the Kernel for your system by building it from source using the Slackware ARM build system and the Slackware 'kernel-source' package.
You can also build from an alternate Kernel source such as the Raspberry Pi's, enabling you to use the RPi Kernel fork if you want to give that a go. See the caveats for that though!
no my Pi4 is usable to watch media, so i'm closing my thread about the freezing Pi4, cause it is clearly a upstream problem. No we have a nice workaround with your excellent HOWTO.
thanks again,
sunzu
Hi drmozes:
Is there a guide for build a custom Slackware Arm image for any other arm board?
I am serarching the documents for building the slackarm image for my rockpi4b+ board...
Thnaks.
Hi drmozes:
Is there a guide for build a custom Slackware Arm image for any other arm board?
I am serarching the documents for building the slackarm image for my rockpi4b+ board...
Thnaks.
First you'd need to add support for that Hardware Model into the OS; making a disc image of it would be the final step.
The documentation to add support is here. It's currently incomplete but covers most of the areas you'd need to check and touch.
Since the RockPi4 is the RK3399 chip, it's probably one of the easier ones to support directly in the OS because you can see how the RockPro64 and Pinebook Pro are integrated. In most cases it's going to be a case of adding a match condition on the RockPi hardware model name in the Kernel module loader scripts and the a/sysvinit-scripts package.
You'd also need to build U-Boot for the RockPi as well. The integration doc says this isn't complete but it is and you can find the build scripts here.
If you can get a U-Boot built for it and flashed into the SPI flash (assuming the RockPi has SPI flash and can boot from it),you could then try booting the rk3399 generic Installer SD card image.
It may boot successfully but won't configure the OS properly because it doesn't know about the RockPi yet.
Brent's working on the HoneyCombe support at the moment and I'll update the documentation as we go along.
There's a reasonable amount of work to support another Hardware Model but the Slackware OS is set up to integrate it relatively easily.
First you'd need to add support for that Hardware Model into the OS; making a disc image of it would be the final step.
Just thinking this through: it might be far less work to support the RockPi4 than I thought, since it's an rk3399 SoC.
I can start by simply adding the RockPi Hardware Model identification into the rk3399 loader scripts and so on. Building U-boot for it should be easy enough too.
I won't be able to test any of it since I don't have a RockPi but I can merge it in. Since it's not already support, it won't break anything.
If you happen to have Linux on the RockPi already, can you do do this please?
Code:
[mozes@bourbon ~] $ strings /proc/device-tree/model
Xunlong Orange Pi Plus 2E
We're not doing any Kernel-related upgrades in -current until Linux 6.1 lands (maybe a few weeks from now?) but I can prepare it. I suspect that the existing set of modules configured for the rk3399 will light up the RockPi pretty well and you might get quite far.
This could be a neat project for you if you've got the time.
Just thinking this through: it might be far less work to support the RockPi4 than I thought, since it's an rk3399 SoC.
I can start by simply adding the RockPi Hardware Model identification into the rk3399 loader scripts and so on. Building U-boot for it should be easy enough too.
I won't be able to test any of it since I don't have a RockPi but I can merge it in. Since it's not already support, it won't break anything.
If you happen to have Linux on the RockPi already, can you do do this please?
Code:
[mozes@bourbon ~] $ strings /proc/device-tree/model
Xunlong Orange Pi Plus 2E
We're not doing any Kernel-related upgrades in -current until Linux 6.1 lands (maybe a few weeks from now?) but I can prepare it. I suspect that the existing set of modules configured for the rk3399 will light up the RockPi pretty well and you might get quite far.
This could be a neat project for you if you've got the time.
Thank you for detail reply!
Kernel 6.1 is fine.
And the uboot could be built from here https://github.com/radxa/rockchip-bsp.git.
I dont know where is the slackarm package repo or image repo that i could build the image to flash the board, also the documents for image building steps.
The hardware model in dtb is "rk3333-rock-pi-4b" and dts is here: https://github.com/radxa/u-boot/blob...rock-pi-4b.dts
Thank you for detail reply!
Kernel 6.1 is fine.
And the uboot could be built from here https://github.com/radxa/rockchip-bsp.git.
I dont know where is the slackarm package repo or image repo that i could build the image to flash the board, also the documents for image building steps.
The hardware model in dtb is "rk3333-rock-pi-4b" and dts is here: https://github.com/radxa/u-boot/blob...rock-pi-4b.dts
Thank you for detail reply!
Kernel 6.1 is fine.
And the uboot could be built from here https://github.com/radxa/rockchip-bsp.git.
I dont know where is the slackarm package repo or image repo that i could build the image to flash the board, also the documents for image building steps.
The hardware model in dtb is "rk3333-rock-pi-4b" and dts is here: https://github.com/radxa/u-boot/blob...rock-pi-4b.dts
The 'recovery' (or 'Initial boot loader flashing image' as it could also be called) image is a small SD card image that runs a U-boot script to erase then flash the SPI version of U-Boot to the SPI flash.
sdcards.build builds the Slackware Installer *and* the recovery images depending on the configuration.
but you need an existing Slackware AArch64 installation to use this stuff.
There's quite a lot in there to digest but it's comprehensively documented, and you can change U-boot version based on a Hardware Model - so you can use the vendor U-boot source repo if need be.
I've added the RockPi 4 Hardware Model to the Kernel module loader scripts as a first start.
Note that Slackware doesn't supply disc images - the proper Installer is used. You can modify the miniroot to build a bootable OS for the device though but there's no tools available to build images like the Slackware Installer that you can 'dd' to storage and boot.
Yes, it is a nice choice and i will look at it ~~. But i still want to go through the staff. I could submit something to official branch (maintained by drmozes) if possible and this may make my board supported by slackarm officially possible.
The 'recovery' (or 'Initial boot loader flashing image' as it could also be called) image is a small SD card image that runs a U-boot script to erase then flash the SPI version of U-Boot to the SPI flash.
sdcards.build builds the Slackware Installer *and* the recovery images depending on the configuration.
but you need an existing Slackware AArch64 installation to use this stuff.
There's quite a lot in there to digest but it's comprehensively documented, and you can change U-boot version based on a Hardware Model - so you can use the vendor U-boot source repo if need be.
I've added the RockPi 4 Hardware Model to the Kernel module loader scripts as a first start.
Note that Slackware doesn't supply disc images - the proper Installer is used. You can modify the miniroot to build a bootable OS for the device though but there's no tools available to build images like the Slackware Installer that you can 'dd' to storage and boot.
Thank you for reply. For rockchip, the uboot misc things(idbloader.img, u-boot.dtb, trust image, https://opensource.rock-chips.com/wiki_Boot_option)) that i have built succeessfully, and the next step is building the boot image(extlinux.conf,vmlinuz.img,initram...etc.) with slackarm kernel and the rootfs image from slackarm packages.
I think i also need build a cross compiler chain which is compatiable with slackarm-current in my host pc(slackware 14.2), becasuse i dont have another existing slackware aarch64 installation...
Thank you for reply. For rockchip, the uboot misc things(idbloader.img, u-boot.dtb, trust image, https://opensource.rock-chips.com/wiki_Boot_option)) that i have built succeessfully, and the next step is building the boot image(extlinux.conf,vmlinuz.img,initram...etc.) with slackarm kernel and the rootfs image from slackarm packages.
I think i also need build a cross compiler chain which is compatiable with slackarm-current in my host pc(slackware 14.2), becasuse i dont have another existing slackware aarch64 installation...
Since the RockPi4 has an SPI flash you can probably use and update the existing RK3399 stuff.
U-Boot
Script:
'uboot.build-functions'
This is called from 'uboot.build' (a couple of dirs up in the tree from the rk3399 dir):
The two functions you want are:
hwm_build_spi
hwm_build_sdrecovery
The difference between them is that U-Boot binary and the one created by 'hwm_build_spi' function above is that the one above creates a U-Boot capable of BOOTING from the SPI flash. The second function below creates ont that's capable of BOOTING from the SD card.
I don't know whether you'll be able to use this code directly but it's worth looking at.
SPI flashing
The RK3399 SoC SPI flashing ('recovery') images are created from the script 'sdcards.build-functions' within that 'rk3399' dir at the URL above.
The function responsible is: hwm_sdimage_recovery_build()
This takes both of the U-Boot binaries (boot from SPI capable and boot from SD card capable) and creates the recovery images found here:
Given that the Kernel already supports the RockPi4 and I've added the support to the Kernel module loader, the boot loader might be the the majority of what needs to be done.
There does not seem to be a default config for the RockPi4 in the U-Boot that we have - for example, the RockPro64 has 'configs/rockpro64-rk3399_defconfig' so you probably will need to use the vendor's U-Boot.
Have a look at this stuff and see if you can get the two U-Boot bianries built from the vendor's U-Boot fork. You should be able to use a cross compiler for U-Boot easily - there are a few binary versions available for x86. You *may* be able to use the ARM x-toolchain that I use with distccd on the x86_64 build cluster, but it's not a full toolchain so it may not work (although it does built the ARM Trusted Firmware stuff entirely on x86_64).
Also look at the the ATF build script in case this is required for the RockPi4 (I think it is from what I looked at last week).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.