This tutorial discusses how to cross build linux kernel for pcDuino on a X86-64 machine. For information on how to set up a X86-PC machine development environment, please refer to How to setup a X86-64 Virtual Box Cross Compilation Build Enviroment for pcDuino.
Across our learn center, we will use ‘#’ to indicate that this command is running on a X86-PC, and ‘$’ to indicate that this command is running on pcDuino.
1. Download kernel source files from Github.
# git clone https://github.com/pcduino/kernel.git
This step only downloads the build environment.
There are some submodules from https://github.com/linux-sunxi/.
Source files of submodules will be downloaded when running “make” under kernel/ directory for the first time
(or if the submodules have not been downloaded before when running “make”)
2. Install required software and toolchain on PC for cross-compilation
# sudo apt-get install build-essential git u-boot-tools texinfo texlive ccache zlib1g-dev gawk # sudo apt-get install bison flex gettext uuid-dev ia32-libs # sudo apt-get install libusb-1.0-0-dev # sudo apt-get install g++-arm-linux-gnueabihf
3. Build Kernel Image
Run “make” under kernel/ directory ( Do not compile the source file under kernel/linux-sunxi directory ).
# cd kernel/ # make
If no error occurs, a livesuitable image and a HW_pack will be in the output folder:
- pcduino_a10_hwpack_YYYYMMDD.tar.xz ( includes uboot for mmc-boot, kernel, and driver modules ).
- pcduino_a10_kernel_livesuit_YYYYMMDD.img ( kernel image update by livesuit )
- For the first time, it will download the required source code from https://github.com/linux-sunxi/.
- For each time run “make”, it will apply the patch for pcduino.
- The patch for pcduino is located at kernel/patch/ directory.
- All the object files generated by compile tools saved in kernel/build directory.
- Compile kernel under kernel/linux-sunxi directory will make the build environment “dirty”.
- If your have done it before. clean up by running “make mrproper” under kernel/linux-sunxi.
For information on how to replace kernel with the newly generated kernel, please refer to: How to Replace Kernel of pcDuino?