cd linux git checkout -b v4.19 v4.19 export ARCH=arm64 export CROSS_COMPILE=aarch64-linux-gnu- make defconfig
比较重要的配置项有:
1 2 3 4 5
Kernel hacking ---> [*] Kernel debugging Compile-time checks and compiler options ---> [*] Compile the kernel with debug info [*] Provide GDB scripts for kernel debugging
一定要打开。 还有下面的选项会导致打断点失败,一定要关闭:
1 2
Processor type and features ----> [] Randomize the address of the kernel image (KASLR)
```bash sudo cp -a /usr/bin/qemu-aarch64-static linux-rootfs/usr/bin/qemu-aarch64-static
进入文件系统
1 2 3 4 5 6 7 8
wget https://raw.githubusercontent.com/ywhs/linux-software/master/ch-mount.sh chmod 777 ch-mount.sh # 执行脚本后,没有报错会进入文件系统,交叉编译时显示 I have no name ,这是因为还没有初始化。 ./ch-mount.sh -m linux-rootfs/
deb https://mirrors.ustc.edu.cn/debian/ buster main contrib non-free deb-src https://mirrors.ustc.edu.cn/debian/ buster main contrib non-free
deb https://mirrors.ustc.edu.cn/debian/ buster-updates main contrib non-free deb-src https://mirrors.ustc.edu.cn/debian/ buster-updates main contrib non-free
deb https://mirrors.ustc.edu.cn/debian/ buster-backports main contrib non-free deb-src https://mirrors.ustc.edu.cn/debian/ buster-backports main contrib non-free
deb https://mirrors.ustc.edu.cn/debian-security/ buster/updates main contrib non-free deb-src https://mirrors.ustc.edu.cn/debian-security/ buster/updates main contrib non-free EOF