May 2, 2021 Compiled on host board Pi4, running EasyOS Dunfell-series 2.6.1 64-bit. Synopsis -------- The script 'compile-rpi4.sh' will patch the kernel with 'aufs' and 'cap_sys_mount' patches, then compile it, then create: linux_headers-5.10.33+.pet linux_kernel-5.10.33+-rpi4.pet kernel_5.10.33+-p1_src.sfs and kernel_5.10.33+-p1_src.specs The two PET packages can be used by woofQ to build EasyOS for the Pi4. How to download kernel source ----------------------------- This has already been done. For the record: The 5.10.x kernel source for the raspberry pi was downloaded: git clone --depth=1 --branch rpi-5.10.y https://github.com/raspberrypi/linux Downloads as folder 'linux', I renamed it to 'linux-5.10' and ran: # dir2tgz linux-5.10 # sync # rm -rf linux-5.10 # gunzip linux-5.10.tar.gz # bzip2 linux-5.10.tar HOWEVER, this is actually "5.10.33+". The build script that I use, requires an actual 'linux-5.10.tar.bz2', and build-kernel/patches/patch-5.10.33+.bz2 would provide the .33 update. However, in this case, 'patch-5.10.33+.bz2' is empty, does nothing -- it is just there for the logical requirement of the 'compile-rpi4.sh' script. How to compile kernel --------------------- The host OS must be aarch64, preferably the same gcc version as the target system. Of course, with EasyOS, the 'devx' SFS must be loaded. With any other Linux, gcc must be installed. Create a folder somewhere in an ext4 partition on a hard drive or SSD. Barry used a USB3 500GB SSD. Expand the tarball: # tar -xf build-kernel.tar.gz # cd build-kernel # cp -f ../linux-5.10.tar.bz2 ./ Link /usr/src to the 'build-kernel' folder: # pwd # ln -snf /usr/src # cd /usr/src An important little detail: Unfortunately, the kernel compile somewhere has hardcoded 'awk' to be at /usr/bin. In EasyOS it is at /bin, so create a symlink: # ln -s /bin/awk /usr/bin/awk You are now ready to compile: # ./compile-rpi4.sh All of the above can be attempted on some other aarch64 host Linux OS, but do read through the 'compile-rpi4.sh' script to make sure that everything is OK for your host system. There are some scripts used, such as 'dir2tgz' and 'tgz2pet' that are only in Puppy Linux and derivatives. Performance note: Build takes a long time on an arm board. 'make' is run without "-j " and that would probably speed things up. Blog reference: https://bkhome.org/news/202101/compiling-on-arm-board-is-like-watching-grass-grow.html Regards, Barry Kauler May 2, 2021 bkhome.org/news