This information was buried in another thread where I tried to get my Cosmo to talk to my Nodemcu devices via serial, for that to happen I had to compile the 4.4 kernel released 24 Juli 2020.
@Varti suggested to extract the relevant kernel building information and place it in a separate post.
Here are the steps I took if anybody wants to compile the kernel used on the Cosmo to add support for devices or just good old tinkering.
Get hold of a debian machine, either Install debian in a virtual machine or use an existing installation.
Install some dependencies and create a folder cosmo to keep everything organized.
sudo apt install build-essential libncurses-dev bison flex libssl-dev libelf-dev bc git gcc-aarch64-linux-gnu
mkdir cosmo
cd cosmo
mkdir KERNEL_OUT
Go ahead and get the cosmo kernel used in the 24/07 build and cd into the directory:
git clone https://github.com/gemian/cosmo-linux-kernel-4.4.git
You should have this directory structure now if you started in your home directory :
~/cosmo/
|_ KERNEL_OUT/
|_ cosmo-linux-kernel-4.4/
Edit the Makefile
cd cosmo-linux-kernel-4.4/
nano Makefile
--> Find "KBUILD_CFLAGS" and change the line KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
to KBUILD_CFLAGS := -w -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
Import the latest kernel config, it's the one that is in the 24/07 build
make O=../KERNEL_OUT ARCH=arm64 k71v1_64_bsp_defconfig
Configure your kernel and save to the default .config location
make O=../KERNEL_OUT ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig
build it
make O=../KERNEL_OUT ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
Your module should be in ../KERNEL_OUT/drivers, just scp it over to your cosmo, depmod and modprobe it.
Enjoy