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

Posted GarfieldLoveCoffe

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了树莓派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

#挂载镜像、更新

[email protected]:/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

[email protected]:/home/z/RaspberryPi# mount -o loop,offset=80740352 raspbx-04-04-2018.mod.img /mnt
[email protected]:/home/z/RaspberryPi# mount -o loop,offset=1048576,sizelimit=78643200 raspbx-04-04-2018.mod.img /mnt/boot

[email protected]:/home/z/RaspberryPi/linux# cp arch/arm64/boot/Image /mnt/boot/kernel8.img

[email protected]:/home/z/RaspberryPi/linux# cp arch/arm64/boot/dts/broadcom/bcm2710-rpi-3-b.dtb /mnt/boot/

[email protected]:/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


以上是关于树莓派3B交叉编译64位内核的主要内容,如果未能解决你的问题,请参考以下文章

树莓派内核开发准备(内核源码获取源码目录树)

树莓派3B安装DeBian 64位系统及其安装私有云网盘----可道云

树莓派 Ubuntu 64 位系统玩家体验版

树莓派部署Elasticsearch6集群

驱动代码编译和测试

驱动代码编译和测试