RaspberryPi4のカーネルビルドをメモします。
参考サイト:https://www.raspberrypi.org/documentation/linux/kernel/building.md
$ sudo apt install git bc bison flex libssl-dev make
$ git clone https://github.com/raspberrypi/tools ~/tools
$ mkdir RaspberryPi4
$ cd RaspberryPi4
$ git clone --depth=1 https://github.com/raspberrypi/linux
$ cd debian_linux
$ nano 1_mk_rpi4_defconfig.sh
-----
#!/bin/bash
export PATH=$PATH:~/RaspberryPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
#export PATH=$PATH:~/RaspberryPi/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin
export KERNEL=kernel7l
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2711_defconfig
-----
$ nano 2_mk_rpi4_J16.sh
-----
#!/bin/bash
export PATH=$PATH:~/RaspberryPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
#export PATH=$PATH:~/RaspberryPi/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin
export KERNEL=kernel7l
make -j16 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs
-----
$ nano 3_mk_rpi4_install_sda.sh
-----
#!/bin/bash
export PATH=$PATH:~/RaspberryPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
#export PATH=$PATH:~/RaspberryPi/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin
export KERNEL=kernel7l
sudo mount /dev/sda1 mnt/fat32
sudo mount /dev/sda2 mnt/ext4
sudo env PATH=$PATH make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=mnt/ext4 modules_install
sudo cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.img
sudo cp arch/arm/boot/zImage mnt/fat32/$KERNEL.img
sudo cp arch/arm/boot/dts/*.dtb mnt/fat32/
sudo cp arch/arm/boot/dts/overlays/*.dtb* mnt/fat32/overlays/
sudo cp arch/arm/boot/dts/overlays/README mnt/fat32/overlays/
sudo umount mnt/fat32
sudo umount mnt/ext4
-----
$ nano 4_mk_rpi4_clean.sh
-----
#!/bin/bash
export PATH=$PATH:~/RaspberryPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
#export PATH=$PATH:~/RaspberryPi/tools/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin
export KERNEL=kernel7l
make clean
-----
$ chmod +x *.sh