Building Linux API Headers

  1. Install Ubuntu 16.04 LTS for amd64 into separate virtual machine.
  2. Download linux-3.16.tar.gz to your home directory.
  3. Open the terminal, and run following commands:
    $ cd ~
    $ make build-linux
    $ cd build-linux
    $ mkdir gcc-4.9.2-glibc-2.19
    $ mkdir gcc-4.9.2-glibc-2.19/i586-linux-gnu
    $ mkdir gcc-4.9.2-glibc-2.19/x86_64-linux-gnu
    $ tar zxf ../linux-3.16.tar.gz
    $ cd linux-3.16
    $ make ARCH=x86 \
        INSTALL_HDR_PATH=~/build-linux/gcc-4.9.2-glibc-2.19/i586-linux-gnu headers_install
    $ cd ..
    $ rm -rf linux-3.16
    $ tar zxf ../linux-3.16.tar.gz
    $ cd linux-3.16
    $ make ARCH=x86_64 \
        INSTALL_HDR_PATH=~/build-linux/gcc-4.9.2-glibc-2.19/x86_64-linux-gnu headers_install
    $ cd ..
    $ rm -rf linux-3.16
    $ find . -name '..install.cmd' -delete
    $ find . -name '.install.cmd' -delete
    $ tar zcf ~/linux-api-headers-3.16.tar.gz \
        gcc-4.9.2-glibc-2.19
    $ cd ~
    $ rm -rf build-linux
    Then copy linux-api-headers-3.16.tar.gz from your virtual machine to the host. You can use small USB thumbdrive with FAT filesystem for that purpose. Use df command in Linux to see where it was mounted, and cp command to copy files.


>> Read next section or buy already prepared cross-compiler (€10) to save your time.