Build Kernel
Update time:2018-06-02 Views:11949
1 Before You Start
1.1 Initialize compiling environment
Ubuntu 14.04 packages install
$ sudo apt-get install git gnupg flex bison gperf build-essential \ zip tar curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \ libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \ libgl1-mesa-dev g++-multilib mingw32 cmake tofrodos \ python-markdown libxml2-utils xsltproc zlib1g-dev:i386 lzop $ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Install ARM cross compiling toolchain and related package to compile Linux kernel
$ sudo apt-get install gcc-arm-linux-gnueabihf \ gcc-aarch64-linux-gnu device-tree-compiler lzop libncurses5-dev \ libssl1.0.0 libssl-dev
1.2 Get the source code
git clone -b firefly https://github.com/FireflyTeam/kernel.git
2 Compile Kernel
Before compiling, execute the following command
export ARCH=arm64 export CROSS_COMPILE=aarch64-linux-gnu-
Compile firefly-rk3399
make firefly_linux_defconfig make rk3399-firefly-linux.img -j4
Compile aio-3399j
make rk3399-firefly-aio-linux.img -j4
After the compilation is complete , the kernel.img and resource.img should be generated in the kernel folder.
If you need to compile a xxx.dts in the arch/arm64/boot/dts/rockchip/ directory, then
make xxx.img -j4
3 Flash partition images
3.1 View parameter file
CMDLINE:console=ttyFIQ0 root=/dev/mmcblk1p6 rw rootwait \ mtdparts=rk29xxnand:0x00002000@0x00002000(uboot),0x00002000@0x00004000(trust),\ 0x00008000@0x00006000(resource),0x0000A000@0x0000E000(kernel),\ 0x00002000@0x00018000(backup),-@0x0001A000(boot)
be careful
root=/dev/mmcblk1p6 ---> rootfs partition If the size of the root file partition is abnormal, resize2fs /dev/mmcblk1p6 0x0000A000@0x0000E000(kernel) ---> kernel partition kernel ---> partition name 0x0000E000 ---> partition start address 0x0000A000 ---> partition size, generally do not need to pay attention
3.2 Linux upgrade_tool flash partition images( xx.img )
Note whether the corresponding name of the parameter partition corresponds to
sudo upgrade_tool di kernel kernel.img sudo upgrade_tool di boot rootfs.img ... kernel ---> on the parameter partition name kernel.img ---> Compiled production kernel.img partition image
3.3 Windows AndroidTool tool upgrade partition images
Note whether the starting address of the parameter partition corresponds to
3.4 Other partition images
Please reference Customize Firmware, unpack the official release firmware.
Modify Parameter File
The root file system can reside on different partitions in different storage devices (eMMC, TF card or USB disk, etc). It must be specified in the kernel's command line. There is a CMDLINE in the paramter file:
CMDLINE:console=ttyFIQ0 ... mtdparts=rk29xxnand:0x00002000@0x00002000(uboot),...,-@0x00394000(user)
Add one of below according to your need: (# and contents after are comments, no need to enter):
root=/dev/block/mtd/by-name/linuxroot # flash partition named "linuxroot" root=/dev/mmcblk0p1 # First partition of TF card root=/dev/sda1 # First partition of USB disk root=LABEL=linuxroot # Partition whose label is "linuxroot"
Flash to Device
Please reference Flash image, choose the newly created boot.img and modified parameter files, flash to "boot" and "parameter" partitions respectively. Then the kernel update is done.
If the root filesystem image is not flashed yet, you can download the prebuilt image, or customize your own one, and flash it to the partition specified in parameter file.