# Notes on how to natively compile (building on the TV box itself) a custom # kernel and install it with .deb files for amlogic based boxes # (this may work for other chips (rockchip, allwinner), but I only have # amlogic boxes to work with) # This is based on learning how a lot of this works by reading and understanding # the following thread: # https://forum.armbian.com/topic/9625-compiling-and-booting-mainline-linux-for-your-s9xxx-tv-box/ # get kernel source # example: git clone -b linux-5.4.y https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git # get and use an appropriate kernel config file # (I use the one from a currently working armbian build) # Sync git with kernel head if you want or need to get changes # since you cloned the kernel tree git pull # Apply neccesary patches # find the appropriate kernel patches from here: # https://github.com/150balbes/Build-Armbian # you will need two patches (at a minumum) from the above git repository: # (depending on what kernel version you will need different versions of # these patches, generally the 'dev' version will work with latest rc kernels # and 'current' patches will work with the latest LTS kernel. To see what # what kernel version a specific patch was intended to work against, look # in the corresponding config/sources/families/?????.conf file for the # kernel source version for the 'stable', 'current' and 'dev' builds) # - patch/kernel/?????/build-????.patch # - patch/kernel/?????/text-offset.patch # # Depending on your box and desires there are other patches you may or may not # need. I am focusing on building stock kernel without extra patches and that # works for my needs, but your needs may be different. # # build the kernel and make the .deb files # (I use -j4 as I have a 4 core arm cpu, you can adjust as appropriate) # (LOCALVERSION= removes an additional '+' in the name due to patches/changes) make LOCALVERSION= -j4 bindeb-pkg # You may need to remove the existing kernel package before installing the # new kernel package due to conflicts with the files you are trying to install # sudo apt remove linux-image-??? # By doing this you are breaking your system (by removing the current running # kernel) and if anything goes wrong you will not be able to reboot. # You have been warned. Don't test this on a system you can't afford to lose. # Install the custom built kernel sudo apt install /.../linux-image-???.deb # reboot and if you are lucky the system comes up running your custom kernel # If you are not lucky there are a thousand reasons why something may not # be working, you are on your own to figure it out sudo shutdown -r now