1. 程式人生 > >燒錄樹莓派映象&更新自己編譯的核心

燒錄樹莓派映象&更新自己編譯的核心

Installing image

Download the image

$ sha256sum 2017-11-29-raspbian-stretch-lite.zip 
e942b70072f2e83c446b9de6f202eb8f9692c06e7d92c343361340cc016e0c9f  2017-11-29-raspbian-stretch-lite.zip

Writing an image to the SD card

$ unzip 2017-11-29-raspbian-stretch-lite.zip
Archive:  2017-11-29-raspbian-stretch
-lite.zip inflating: 2017-11-29-raspbian-stretch-lite.img
sudo umount /dev/sdX
sudo dd bs=4M if=2017-11-29-raspbian-stretch-lite.img of=/dev/sdX status=progress conv=fsync
sudo sync

Kernel building

Host:
ubuntu 14.04 (64 bit)
cpu cores: 4

Install toolchain

git clone https://github.com/raspberrypi/tools /home/tomato/Workspace/raspberrypi/src/tools
echo 'PATH=$PATH:/home/tomato/Workspace/raspberrypi/src/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin' >> ~/.bashrc source ~/.bashrc

Get sources

git clone https://github.com/raspberrypi/linux /home/tomato/Workspace/raspberrypi/src/linux
git checkout -b rpi-4.4.y origin/rpi-4.4.y

Build sources

cd linux
KERNEL=kernel7
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs -j 6

Install directly onto the SD card

mkdir mnt
mkdir mnt/fat32
mkdir mnt/ext4
sudo mount /dev/sdb1 mnt/fat32
sudo mount /dev/sdb2 mnt/ext4
sudo 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