The zipped kernel linux-sunxi-sunxi-3.4.61.tar.gz can be found on linux-sunxi-sunxi-3.4.61.tar.gz, the kernel config file can be found on cubieboard2_defconfig Or can be obtained from the internet: https://github.com/linux-sunxi/linux-sunxi/releases , To avoid unexpected error while porting, please download the 3.4.61 version kernel.
Assume that the source code was placed under /home/waveshare/cubieboard2/kernel directory, use the following command to extract it:
#cd /home/waveshare/cubieboard2/kernel #tar -xzvf linux-sunxi-sunxi-3.4.61.tar.gz
Now we get the original linux-sunxi-sunxi-3.4.61 source code, rename it as linux-sunxi-sunxi-3.4.61_A20, as shown in the picture below:
Modify the Makefile under root directory:
#cd linux-sunxi-sunxi-3.4.61_A20 #vi Makefile
Edit the following lines:
export KBUILD_BUILDHOST := $(SUBARCH) ARCH ?= $(SUBARCH) CROSS_COMPILE ?=
As:
export KBUILD_BUILDHOST := $(SUBARCH) ARCH ?= arm CROSS_COMPILE ?= arm-linux-gnueabihf-
ARCH specifies the target platform as arm, CROSS_COMPILE assigns the cross compile tool chain. As shown in the picture below:
Note: the vim editor is recommended.
Under the root directory, enter:
#make clean
Under the root directory, enter:
# cp ../cubieboard2_defconfig .config
A hidden .config file will be generated under the root directory.
Under the root directory, enter:
#make menuconfig
Config the kernel on the popup window, as shown in the picture below:
Under the root directory, enter:
#make uImage
It will take much time to complete the compiling. When completed, the compressed kernel image will be generated under linux-sunxi-sunxi-3.4.61_A20/arch/arm/boot directory.