One, install the cross-compilation environment
The cross-compilation environment is the same as that used by uboot.
Reference: arm-linux-gnueabihf cross-compilation tool chain installation
2. Download and compile linux source code
(The default is zero-4.10.y branch):
git clone https://github.com/Lichee-Pi/linux.git
或者`zero-4.13.y`对网卡的支持更好
git clone -b zero-4.13.y https://github.com/Lichee-Pi/linux.git
cd linux
make ARCH=arm licheepi_zero_defconfig
make ARCH=arm menuconfig #add bluethooth, etc.
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j16
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j16 INSTALL_MOD_PATH=out modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j16 INSTALL_MOD_PATH=out modules_install
Three, modify the top-level Makefile compilation
Makefile
Modify the default compiler on line 257 in the root directory of the kernel , and you can use it directly to make
compile:
# ARCH ?= $(SUBARCH)
# CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-gnueabihf-
Compile command:
make licheepi_zero_defconfig
make menuconfig #add bluethooth, etc.
make -j16
make -j16 INSTALL_MOD_PATH=out modules
make -j16 INSTALL_MOD_PATH=out modules_install
Compile LOG:
pjw@pjw-virtual-machine:~/Allwinner/V3S/linux$ make -j16 INSTALL_MOD_PATH=out modules
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CHK scripts/mod/devicetable-offsets.h
CHK include/generated/timeconst.h
CHK include/generated/bounds.h
CHK include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
Building modules, stage 2.
MODPOST 3 modules
pjw@pjw-virtual-machine:~/Allwinner/V3S/linux$ make -j16 INSTALL_MOD_PATH=out modules_install
INSTALL crypto/echainiv.ko
INSTALL drivers/staging/rtl8723bs/r8723bs.ko
INSTALL drivers/video/backlight/lcd.ko
DEPMOD 4.13.16-licheepi-zero+
pjw@pjw-virtual-machine:~/Allwinner/V3S/linux$
After compilation, zImage
in arch/arm/boot/
the driving module out/
at, sun8i-v3s-licheepi-zero-dock.dtb
in arch/arm/boot/dts/
the