Linux kernel compilation method

One, STM32MP157 development board

1. Kernel compilation

book@100ask:~/100ask_stm32mp157_pro-sdk$ cd Linux-5.4
book@100ask:~/100ask_stm32mp157_pro-sdk/Linux-5.4$ make 100ask_stm32mp157_pro_defconfig
book@100ask:~/100ask_stm32mp157_pro-sdk/Linux-5.4$ make uImage LOADADDR=0xC2000040 -j4
book@100ask:~/100ask_stm32mp157_pro-sdk/Linux-5.4$ make dtbs
book@100ask:~/100ask_stm32mp157_pro-sdk/Linux-5.4$ cp arch/arm/boot/uImage ~/nfs_rootfs
book@100ask:~/100ask_stm32mp157_pro-sdk/Linux-5.4$ cp arch/arm/boot/dts/100ask-stm32m1p157c-pro.dtb ~/nfs_rootfs

2. Module compilation

After entering the kernel source directory, you can compile the kernel module:

book@100ask:~$ cd 100ask_stm32mp157_pro-sdk/Linux-5.4
book@100ask:~/100ask_stm32mp157_pro-sdk/Linux-5.4$ make modules -j4
book@100ask:~/100ask_stm32mp157_pro-sdk/Linux-5.4$ sudo make INSTALL_MOD_PATH=/home/book/nfs_rootfs modules_install

The last command is to install the module to the /home/book/nfs_rootfs directory for backup, and you will get the
/home/book/nfs_rootfs/lib/modules directory.

Two, IMX6ULL

1. Kernel compilation

book@100ask:~/100ask_imx6ull-sdk$ cd Linux-4.9.88
book@100ask:~/100ask_imx6ull-sdk/Linux-4.9.88$ make mrproper
book@100ask:~/100ask_imx6ull-sdk/Linux-4.9.88$ make 100ask_imx6ull_defconfig
book@100ask:~/100ask_imx6ull-sdk/Linux-4.9.88$ make zImage -j4
book@100ask:~/100ask_imx6ull-sdk/Linux-4.9.88$ make dtbs
book@100ask:~/100ask_imx6ull-sdk/Linux-4.9.88$ cp arch/arm/boot/zImage ~/nfs_rootfs
book@100ask:~/100ask_imx6ull-sdk/Linux-4.9.88$ cp arch/arm/boot/dts/100ask_imx6ull-14x14.dtb ~/nfs_rootfs

Insert picture description here
Insert picture description here

2. Module compilation

book@book-virtual-machine:~$ cd ~/100ask_imx6ull-sdk/Linux-4.9.88/
book@100ask:~/100ask_imx6ull-sdk/Linux-4.9.88$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules
book@100ask:~/100ask_imx6ull-sdk/Linux-4.9.88$ sudo make ARCH=arm INSTALL_MOD_PATH=/home/book/nfs_rootfs modules_install

The last command is to install the module to the /home/book/nfs_rootfs directory for backup, and you will get the
/home/book/nfs_rootfs/lib/modules directory.

Three, IMX6ULL mini d nand

1. Kernel compilation

The kernel compilation process is as follows (you need to configure some environment variables such as the tool chain before compiling the kernel):

book@100ask:~/100ask_myir_mini_imx6ull-sdk$ cd Linux-4.9.88
book@100ask:~/100ask_myir_mini_imx6ull-sdk/Linux-4.9.88$ make mrproper
book@100ask:~/100ask_myir_mini_imx6ull-sdk/Linux-4.9.88$ make 100ask_myir_imx6ull_mini_defconfig
book@100ask:~/100ask_myir_mini_imx6ull-sdk/Linux-4.9.88$ make zImage -jN //N 表示根据 CPU 个数,来加速编译系统
book@100ask:~/100ask_myir_mini_imx6ull-sdk/Linux-4.9.88 $ make dtbs
book@100ask:~/100ask_myir_mini_imx6ull-sdk/Linux-4.9.88 $ cp arch/arm/boot/zImage ~/nfs_rootfs
book@100ask:~/100ask_myir_mini_imx6ull-sdk/Linux-4.9.88$ cp arch/arm/boot/dts/100ask_myir_imx6ull_mini.dtb ~/nfs_rootfs

After successful compilation, you can get these files: kernel file arch/arm/boot/zImage, device tree file
arch/arm/boot/100ask_myir_imx6ull_mini.dtb.
Copy these two files to the /home/book/nfs_rootfs directory for backup.

2. Module compilation

After entering the kernel source directory, you can compile the kernel module:

book@book-virtual-machine:~$ cd  ~/100ask_myir_mini_imx6ull-sdk/Linux-4.9.88
book@100ask:~/100ask_myir_mini_imx6ull-sdk/Linux-4.9.88$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules
book@100ask:~/100ask_imx6ull-sdk/Linux-4.9.88$ sudo make ARCH=arm INSTALL_MOD_PATH=/home/book/nfs_rootfs modules_install

Please refer to the screenshot of the full-featured version of IMX6ULL above for the compilation process. The last command is to install the module in the /home/book/nfs_rootfs
directory for backup, and you will get the /home/book/nfs_rootfs/lib/modules directory.

Guess you like

Origin blog.csdn.net/qq_18077275/article/details/108871422