mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
Make aarch64 boot again and explain its limitations better.
Restore lkmc_min that was accidentaly removed. Explain how to remove modules that fail to build.
This commit is contained in:
33
README.adoc
33
README.adoc
@@ -101,6 +101,13 @@ Linux and QEMU rebuilds are so common that we have dedicated shortcut flags for
|
|||||||
./build -l -q
|
./build -l -q
|
||||||
....
|
....
|
||||||
|
|
||||||
|
Sometimes, if you change the version of the submodules a lot, builds fail. We should try to understand why and report bugs, but if you are lazy, first try something like:
|
||||||
|
|
||||||
|
....
|
||||||
|
rm -rf buildroot/output.x86_64~/build/host-qemu-custom
|
||||||
|
./build -q
|
||||||
|
....
|
||||||
|
|
||||||
==== Filesystem persistency
|
==== Filesystem persistency
|
||||||
|
|
||||||
The root filesystem is persistent across:
|
The root filesystem is persistent across:
|
||||||
@@ -838,16 +845,32 @@ TODOs:
|
|||||||
./build -a aarch64
|
./build -a aarch64
|
||||||
....
|
....
|
||||||
|
|
||||||
|
As usual, we use Buildroot's recommended QEMU setup QEMU `aarch64` setup:
|
||||||
|
|
||||||
|
* https://github.com/buildroot/buildroot/blob/2017.08/board/qemu/aarch64-virt/readme.txt
|
||||||
|
* https://github.com/buildroot/buildroot/blob/2017.08/configs/qemu_aarch64_virt_defconfig
|
||||||
|
|
||||||
|
This makes aarch64 a bit different from `arm`:
|
||||||
|
|
||||||
|
* uses `-M virt`. https://wiki.qemu.org/Documentation/Platforms/ARM explains:
|
||||||
|
+
|
||||||
|
____
|
||||||
|
Most of the machines QEMU supports have annoying limitations (small amount of RAM, no PCI or other hard disk, etc) which are there because that's what the real hardware is like. If you don't care about reproducing the idiosyncrasies of a particular bit of hardware, the best choice today is the "virt" machine.
|
||||||
|
____
|
||||||
|
+
|
||||||
|
`-M virt` has some limitations, e.g. I could not pass `-drive if=scsi` as for `arm`, and so <<Snapshot>> fails.
|
||||||
|
+
|
||||||
|
* uses initramfs. This glues the rootfs as an initrd directly to the kernel image, so the only argument that QEMU needs is the `-kernel`, and no disk! Pretty cool.
|
||||||
|
|
||||||
|
So, as long as you keep those points in mind, our `-a aarch64` offers an interesting different setup to play with.
|
||||||
|
|
||||||
TODOs:
|
TODOs:
|
||||||
|
|
||||||
* GDB gives a ton of messages:
|
* <<gdb>> appears to be stuck on an infinite loop:
|
||||||
+
|
+
|
||||||
....
|
....
|
||||||
no module object found for ''
|
no module object found for ''
|
||||||
....
|
....
|
||||||
+
|
|
||||||
when you connect. `Ctrl + C` then `c` works though.
|
|
||||||
* How to add devices to `-M virt` as we did for `-M versatilepb`
|
|
||||||
|
|
||||||
==== mips64
|
==== mips64
|
||||||
|
|
||||||
@@ -1850,7 +1873,7 @@ git push
|
|||||||
git remote add up git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
|
git remote add up git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
|
||||||
git fetch up
|
git fetch up
|
||||||
git rebase --onto "$next_mainline_revision" "$last_mainline_revision"
|
git rebase --onto "$next_mainline_revision" "$last_mainline_revision"
|
||||||
./build -t linux-reconfigure
|
./build -l
|
||||||
# Manually fix our kernel modules if necessary.
|
# Manually fix our kernel modules if necessary.
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ Only works for ARM.
|
|||||||
|
|
||||||
Uses:
|
Uses:
|
||||||
|
|
||||||
- hw/misc/lkmc_platform_device.c minimal device added in our QEMU fork
|
- hw/misc/lkmc_platform_device.c minimal device added in our QEMU fork to `-M versatilepb`
|
||||||
|
|
||||||
- the device tree entry we added to our Linux kernel fork:
|
- the device tree entry we added to our Linux kernel fork:
|
||||||
https://github.com/cirosantilli/linux/blob/361bb623671a52a36a077a6dd45843389a687a33/arch/arm/boot/dts/versatile-pb.dts#L42
|
https://github.com/cirosantilli/linux/blob/361bb623671a52a36a077a6dd45843389a687a33/arch/arm/boot/dts/versatile-pb.dts#L42
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
images_dir="$1"
|
images_dir="$1"
|
||||||
cd "$images_dir"
|
cd "$images_dir"
|
||||||
"${HOST_DIR}/bin/qemu-img" convert -f raw -O qcow2 rootfs.ext2 rootfs.ext2.qcow2
|
f=rootfs.ext2
|
||||||
|
if [ -f "$f" ]; then
|
||||||
|
"${HOST_DIR}/bin/qemu-img" convert -f raw -O qcow2 "$f" "${f}.qcow2"
|
||||||
|
fi
|
||||||
|
|||||||
2
run
2
run
@@ -63,6 +63,7 @@ case "$arch" in
|
|||||||
cmd="$qemu_common \
|
cmd="$qemu_common \
|
||||||
-M pc \
|
-M pc \
|
||||||
-append 'root=/dev/vda nopat $extra_append' \
|
-append 'root=/dev/vda nopat $extra_append' \
|
||||||
|
-device lkmc_pci_min \
|
||||||
-device edu \
|
-device edu \
|
||||||
-device virtio-net-pci,netdev=net0 \
|
-device virtio-net-pci,netdev=net0 \
|
||||||
-drive file=${images_dir}/rootfs.ext2.qcow2,if=virtio,format=qcow2 \
|
-drive file=${images_dir}/rootfs.ext2.qcow2,if=virtio,format=qcow2 \
|
||||||
@@ -94,7 +95,6 @@ $extra_flags \
|
|||||||
-append 'root=/dev/sda $extra_append' \
|
-append 'root=/dev/sda $extra_append' \
|
||||||
-cpu cortex-a57 \
|
-cpu cortex-a57 \
|
||||||
-device virtio-net-device,netdev=net0 \
|
-device virtio-net-device,netdev=net0 \
|
||||||
-drive file=${images_dir}/rootfs.cpio,if=scsi,format=raw \
|
|
||||||
-kernel ${images_dir}/Image \
|
-kernel ${images_dir}/Image \
|
||||||
-nographic \
|
-nographic \
|
||||||
-serial stdio \
|
-serial stdio \
|
||||||
|
|||||||
Reference in New Issue
Block a user