So these are the steps I followed to get it to compile on the cosmo it self, no modifications to the config by using the current kernel config on the device:
sudo apt-get install build-essential libncurses-dev bison flex libssl-dev libelf-dev git bc
mkdir cosmo
cd cosmo/
git clone https://github.com/gemian/cosmo-linux-kernel-4.4.git
mkdir KERNEL_OUT
cat /proc/config.gz | gunzip > KERNEL_OUT/.config
make O=../KERNEL_OUT -C cosmo-linux-kernel-4.4 menuconfig -j8
make O=../KERNEL_OUT -C cosmo-linux-kernel-4.4 -j8
That starts to compile the kernel but I run into issues :
CC arch/arm64/kvm/guest.o
/home/drbytes/cosmo/cosmo-linux-kernel-4.4/fs/exec.c: In function 'get_task_comm':
/home/drbytes/cosmo/cosmo-linux-kernel-4.4/fs/exec.c:1086:32: error: argument to 'sizeof' in 'strncpy' call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess]
strncpy(buf, tsk->comm, sizeof(tsk->comm));
and further down :
In file included from /home/drbytes/cosmo/cosmo-linux-kernel-4.4/include/linux/sctp.h:57,
from /home/drbytes/cosmo/cosmo-linux-kernel-4.4/security/lsm_audit.c:31:
/home/drbytes/cosmo/cosmo-linux-kernel-4.4/include/uapi/linux/sctp.h:306:1: error: alignment 4 of 'struct sctp_paddr_change' is less than 8 [-Werror=packed-not-aligned]
} __attribute__((packed, aligned(4)));
^
/home/drbytes/cosmo/cosmo-linux-kernel-4.4/include/uapi/linux/sctp.h:580:1: error: alignment 4 of 'struct sctp_setpeerprim' is less than 8 [-Werror=packed-not-aligned]
} __attribute__((packed, aligned(4)));
^
/home/drbytes/cosmo/cosmo-linux-kernel-4.4/include/uapi/linux/sctp.h:579:26: error: 'sspp_addr' offset 4 in 'struct sctp_setpeerprim' isn't aligned to 8 [-Werror=packed-not-aligned]
struct sockaddr_storage sspp_addr;
^~~~~~~~~
/home/drbytes/cosmo/cosmo-linux-kernel-4.4/include/uapi/linux/sctp.h:593:1: error: alignment 4 of 'struct sctp_prim' is less than 8 [-Werror=packed-not-aligned]
} __attribute__((packed, aligned(4)));
^
/home/drbytes/cosmo/cosmo-linux-kernel-4.4/include/uapi/linux/sctp.h:592:26: error: 'ssp_addr' offset 4 in 'struct sctp_prim' isn't aligned to 8 [-Werror=packed-not-aligned]
struct sockaddr_storage ssp_addr;
^~~~~~~~
/home/drbytes/cosmo/cosmo-linux-kernel-4.4/include/uapi/linux/sctp.h:640:1: error: alignment 4 of 'struct sctp_paddrparams' is less than 8 [-Werror=packed-not-aligned]
} __attribute__((packed, aligned(4)));
^
/home/drbytes/cosmo/cosmo-linux-kernel-4.4/include/uapi/linux/sctp.h:634:26: error: 'spp_address' offset 4 in 'struct sctp_paddrparams' isn't aligned to 8 [-Werror=packed-not-aligned]
struct sockaddr_storage spp_address;
^~~~~~~~~~~
/home/drbytes/cosmo/cosmo-linux-kernel-4.4/include/uapi/linux/sctp.h:747:1: error: alignment 4 of 'struct sctp_paddrinfo' is less than 8 [-Werror=packed-not-aligned]
} __attribute__((packed, aligned(4)));
^
/home/drbytes/cosmo/cosmo-linux-kernel-4.4/include/uapi/linux/sctp.h:741:26: error: 'spinfo_address' offset 4 in 'struct sctp_paddrinfo' isn't aligned to 8 [-Werror=packed-not-aligned]
struct sockaddr_storage spinfo_address;
^~~~~~~~~~~~~~
CC security/selinux/nlmsgtab.o
CC security/selinux/netif.o
cc1: all warnings being treated as errors
Too bad that a fresh git can't get off the ground.