树莓派3B交叉编译64位内核

摘录自:https://kasiviswanathanblog.wordpress.com/2017/04/09/raspberry-pi-3-compile-your-own-64-bit-linux-kernel/

 
apt-get update

apt-get install git bc
git clone --depth=1 git://github.com/raspberrypi/tools.git
git clone --depth=1 https://github.com/raspberrypi/linux.git
cd linux
git branch
git checkout rpi-4.14.y
export PATH=/opt/aarch64/bin/:$PATH
export CROSS_COMPILE=aarch64-linux-gnu-
export ARCH=arm64
ls -l arcn/arm64/configs/
make bcmrpi3_defconfig
make -j 12

#挂载镜像、更新

root@debian:/home/z/RaspberryPi# fdisk -l raspbx-04-04-2018.mod.img
Disk raspbx-04-04-2018.mod.img: 3.7 GiB, 3904897024 bytes, 7626752 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000ee283

Device Boot Start End Sectors Size Id Type
raspbx-04-04-2018.mod.img1 2048 155647 153600 75M c W95 FAT32 (LBA)
raspbx-04-04-2018.mod.img2 157696 7626751 7469056 3.6G 83 Linux

#image root partition offset:157696*512=80740352
#image boot partition offset:2048*512=1048576
#image boot partition sizelimit:153600*512=78643200

root@debian:/home/z/RaspberryPi# mount -o loop,offset=80740352 raspbx-04-04-2018.mod.img /mnt
root@debian:/home/z/RaspberryPi# mount -o loop,offset=1048576,sizelimit=78643200 raspbx-04-04-2018.mod.img /mnt/boot

root@debian:/home/z/RaspberryPi/linux# cp arch/arm64/boot/Image /mnt/boot/kernel8.img

root@debian:/home/z/RaspberryPi/linux# cp arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dtb /mnt/boot/

root@debian:/home/zhenhai/RaspberryPi/linux# echo "kernel=kernel8.img">>/mnt/boot/config.txt 

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=/mnt modules_install

 

猜你喜欢

转载自www.cnblogs.com/tiger9637/p/9087794.html