樹莓派3b+ 交叉編譯 及升級 kernel
安裝 gcc pkg 等工具
sudo apt-get install build-essential git
官方介紹
https://www.raspberrypi.org/documentation/linux/kernel/building.md
https://www.raspberrypi.org/documentation/linux/kernel/configuring.md
https://www.raspberrypi.org/documentation/linux/kernel/patching.md
配置環境變數 新增交叉工具鏈
git clone https://github.com/raspberrypi/tools.git
/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin
arm-linux-gnueabihf-gcc --version
下載核心原始碼
git clone --depth=1 --branch rpi-4.14.y https://github.com/raspberrypi/linux
cd linux
KERNEL=kernel7
#make bcm2709_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs -j4
如果在樹莓派上也可以編譯就是時間久
使用 新核心,在 ubuntu 插入SD 卡檢視 , 16G sandisk class 10
lsblk
sdb 8:16 1 14.9G 0 disk
├─sdb2 8:18 1 14.8G 0 part /media/dev/rootfs
└─sdb1 8:17 1 43.2M 0 part /media/dev/boot
cat /proc/mounts
/dev/sdb2 /media/dev/rootfs ext4 rw,
/dev/sdb1 /media/dev/boot vfat rw,
自動掛載好了
with sdb1 being the FAT (boot) partition, and sdb2 being the ext4 filesystem (root) partition.
先安裝模組
sudo make ARCH=arm CROSS_COMPILE=/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- INSTALL_MOD_PATH=/media/dev/rootfs modules_install
使用新核心替換原檔案
sudo cp /media/dev/boot/$KERNEL.img /media/dev/boot/$KERNEL-backup.img
sudo cp arch/arm/boot/zImage /media/dev/boot/$KERNEL.img
sudo cp arch/arm/boot/dts/*.dtb /media/dev/boot/
sudo cp arch/arm/boot/dts/overlays/*.dtb* /media/dev/boot/overlays/
sudo cp arch/arm/boot/dts/overlays/README /media/dev/boot/overlays/
插SD卡,上電,啟動正常