Build Kernel Headers on Ubuntu - SundanceMultiprocessorTechnology/VCS-1 GitHub Wiki

Compress Kernel Headers

Make sure this is done Directly after petalinux-build

$ tar -czvf linux-xlnx.tar.gz $PETALINUX_PROJECT/components/plnx_workspace/sources/linux-xlnx

Copy to Rootfs

If this is a new OS then please follow Sections 1 and 2 on:

https://github.com/SundanceMultiprocessorTechnology/VCS-1/wiki/Install-Ubuntu-minimal-on-the-VCS-1

$ sudo cp components/plnx_workspace/sources/linux-xlnx.tar.gz /media/$USER/rootfs/home/ubuntu/

Making sure that the whole file is transfered with sync

Compile the Kernel Source

Follow sections 2 to 9 to mount the ubuntu image on your machine:

https://github.com/SundanceMultiprocessorTechnology/VCS-1/wiki/Install-Ubuntu-minimal-on-the-VCS-1

Unzip and navigate to linux-xlnx:

$ tar -zxvf linux-xlnx.tar.gz

$ cd linux-xlnx

Install Compilation tools

$ sudo apt-get update

$ sudo apt-get -y install kernel-package fakeroot wget bzip2

$ sudo apt-get -y install bison flex bc device-tree-compiler libssl-dev

copy the kernel config file:

$ zcat /proc/config.gz > .config

Compile the kernel. Note that it will take some time.

$ sudo apt-get install kernel-package

$ make-kpkg clean

$ fakeroot make-kpkg -j4 –initrd kernel_headers

If you have more cpu cores please change -j4 accordingly

Install kernel modules

$ sudo make modules_install

install the Linux kernel header

$ sudo dpkg -i linux-headers-4.19.0-xilinx-v2019.2_4.19.0-xilinx-v2019.2-10.00.Custom_arm64.deb