linux kernel study

Table of Contents

Next: , Up: (dir)   [Contents]

linux kernel study

This manual is for program, version version.


Next: , Previous: , Up: Top   [Contents]

1 kernel code download

https://www.kernel.org/

https://cdn.kernel.org/pub/linux/kernel/


Next: , Previous: , Up: Top   [Contents]

2 install qemu

install qemu => install from source code


Next: , Previous: , Up: Top   [Contents]

3 rootfs

download rootfs => rootfs.cpio

unpack kernel source code

cp rootfs.cpio to your kernel source code’s root directory


Next: , Previous: , Up: Top   [Contents]

4 install toolchain

sudo apt-get install g++-aarch64-linux-gnu


Next: , Previous: , Up: Top   [Contents]

5 build & run

change to your kernel’s root directory

add rootfs.cpio

add the line: CONFIG_INITRAMFS_SOURCE="/your/rootfs/absolute/path/rootfs.cpio"
to the file: arch/arm64/configs/defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- O=../out defconfig

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- O=../out -j4 Image

/to/your/path/qemu-2.10.0/bin/qemu-system-aarch64 -machine virt -cpu cortex-a57 -machine type=virt -nographic -smp 1 -m 2048 -kernel ../out/arch/arm64/boot/Image --append "console=ttyAMA0"

Next: , Previous: , Up: Top   [Contents]

6 access host directory

qemu-system-aarch64 -machine virt -cpu cortex-a57 -machine type=virt -nographic -smp 1 -m 2048 -kernel ../out/arch/arm64/boot/Image --append "console=ttyAMA0" -fsdev local,id=r,path=../,security_model=none -device virtio-9p-device,fsdev=r,mount_tag=r

mkdir /mnt
mount -t 9p -o trans=virtio r /mnt
cd /mnt

Previous: , Up: Top   [Contents]

7 resource

https://github.com/sys-build/resource_dev.git

patch -p1 < ... # text format patch

git apply -p1 < ... # patch with binary data