mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-27 20:14:27 +01:00
Fix MIPS BR2_PACKAGE_LINUX_TOOLS_GPIO build
Update mips for snapshot and initrd features. Document MIPS limitations. Improve description of test procedure
This commit is contained in:
@@ -1,8 +1,25 @@
|
|||||||
= CONTRIBUTING
|
= CONTRIBUTING
|
||||||
|
|
||||||
Testing that should be done for every functional patch:
|
== Testing
|
||||||
|
|
||||||
|
Testing that should be done for every functional patch.
|
||||||
|
|
||||||
|
=== Guest testing
|
||||||
|
|
||||||
|
....
|
||||||
|
./build
|
||||||
|
./run -e '- lkmc_eval="/insrm.sh hello 5;wget -S google.com;poweroff;"' -n
|
||||||
|
....
|
||||||
|
|
||||||
|
Should:
|
||||||
|
|
||||||
|
* boot
|
||||||
|
* show `hello.ko` `init` and `exit` messages
|
||||||
|
* make a network request
|
||||||
|
* shutdown gracefully
|
||||||
|
|
||||||
|
TODO automate all of this with a `/test-all.sh` script in guest which outputs to stdout `LKMC_TEST_PASS` or `LKMC_TEST_FAIL` and grep that from host.
|
||||||
|
|
||||||
|
=== Host testing
|
||||||
|
|
||||||
* `./build && ./run` boots
|
|
||||||
* `/insrm.sh hello 5`. If a new module was added, use this for that module. Helps catch simple insert remove problems.
|
|
||||||
* `wget -O- google.com` for Internet
|
|
||||||
* `./run -d` and on another shell `./rungdb start_kernel` should break GDB at `start_kernel`
|
* `./run -d` and on another shell `./rungdb start_kernel` should break GDB at `start_kernel`
|
||||||
|
|||||||
16
README.adoc
16
README.adoc
@@ -910,6 +910,16 @@ no module object found for ''
|
|||||||
./build -a mips64
|
./build -a mips64
|
||||||
....
|
....
|
||||||
|
|
||||||
|
Keep in mind that MIPS has the worst support our architectures due to the smaller community. Patches welcome as usual.
|
||||||
|
|
||||||
|
TODOs:
|
||||||
|
|
||||||
|
* networking is not working. See also:
|
||||||
|
** https://stackoverflow.com/questions/21496449/networking-is-not-working-on-qemu-guest-malta-mips
|
||||||
|
** https://unix.stackexchange.com/questions/208266/setting-up-qemu-and-mipsel-networking-trouble
|
||||||
|
** https://unix.stackexchange.com/questions/354127/qemu-mips-and-debian
|
||||||
|
* <<gdb>> does not work properly, does not find `start_kernel`
|
||||||
|
|
||||||
=== init
|
=== init
|
||||||
|
|
||||||
When the Linux kernel finishes booting, it runs an executable as the first and only userland process.
|
When the Linux kernel finishes booting, it runs an executable as the first and only userland process.
|
||||||
@@ -1548,7 +1558,7 @@ Related: https://stackoverflow.com/questions/6405083/initrd-and-booting-the-linu
|
|||||||
|
|
||||||
==== initramfs
|
==== initramfs
|
||||||
|
|
||||||
initramfs is just like initrd, but you also glue the image directly to the kernel image itself.
|
initramfs is just like <<initrd>>, but you also glue the image directly to the kernel image itself.
|
||||||
|
|
||||||
So the only argument that QEMU needs is the `-kernel`, no `-drive` not even `-initrd`! Pretty cool.
|
So the only argument that QEMU needs is the `-kernel`, no `-drive` not even `-initrd`! Pretty cool.
|
||||||
|
|
||||||
@@ -1710,7 +1720,7 @@ You can then restore CPU, memory and disk state back at any time.
|
|||||||
|
|
||||||
qcow2 filesystems must be used for that to work.
|
qcow2 filesystems must be used for that to work.
|
||||||
|
|
||||||
To test it out, login into the VM, and run:
|
To test it out, login into the VM with and run:
|
||||||
|
|
||||||
....
|
....
|
||||||
/count.sh
|
/count.sh
|
||||||
@@ -1764,6 +1774,8 @@ cat f
|
|||||||
|
|
||||||
And the output is `0`.
|
And the output is `0`.
|
||||||
|
|
||||||
|
Our setup does not allow for snapshotting while using <<initrd>>.
|
||||||
|
|
||||||
== Failed action
|
== Failed action
|
||||||
|
|
||||||
=== Record and replay
|
=== Record and replay
|
||||||
|
|||||||
5
build
5
build
@@ -88,6 +88,11 @@ fi
|
|||||||
if $x11; then
|
if $x11; then
|
||||||
cat ../buildroot_config_fragment_x11 >> "${outdir}/.config"
|
cat ../buildroot_config_fragment_x11 >> "${outdir}/.config"
|
||||||
fi
|
fi
|
||||||
|
if [ "$arch" = 'mips64' ]; then
|
||||||
|
# Workaround for:
|
||||||
|
# http://lists.busybox.net/pipermail/buildroot/2017-August/201053.html
|
||||||
|
sed -Ei 's/^BR2_PACKAGE_LINUX_TOOLS_GPIO/BR2_PACKAGE_LINUX_TOOLS_GPIO=n/' "${outdir}/.config"
|
||||||
|
fi
|
||||||
make O="$outdir" olddefconfig
|
make O="$outdir" olddefconfig
|
||||||
# HOST_QEMU_OPTS is a hack that happens to work because the QEMU package luckly uses += at all times.
|
# HOST_QEMU_OPTS is a hack that happens to work because the QEMU package luckly uses += at all times.
|
||||||
# It shouldn't be necessary in the first place: https://bugs.busybox.net/show_bug.cgi?id=9936
|
# It shouldn't be necessary in the first place: https://bugs.busybox.net/show_bug.cgi?id=9936
|
||||||
|
|||||||
BIN
replay.bin
BIN
replay.bin
Binary file not shown.
5
run
5
run
@@ -116,12 +116,15 @@ $extra_flags \
|
|||||||
"
|
"
|
||||||
;;
|
;;
|
||||||
mips64)
|
mips64)
|
||||||
|
if ! $initrd; then
|
||||||
|
root='root=/dev/hda'
|
||||||
|
extra_flags="$extra_flags -drive file='${images_dir}/rootfs.ext2.qcow2,format=qcow2'"
|
||||||
|
fi
|
||||||
cmd="$qemu_common \
|
cmd="$qemu_common \
|
||||||
-M malta \
|
-M malta \
|
||||||
-append 'root=/dev/hda $extra_append' \
|
-append 'root=/dev/hda $extra_append' \
|
||||||
-cpu I6400 \
|
-cpu I6400 \
|
||||||
-device pcnet \
|
-device pcnet \
|
||||||
-drive file=${images_dir}/rootfs.ext2,format=raw \
|
|
||||||
-kernel ${images_dir}/vmlinux \
|
-kernel ${images_dir}/vmlinux \
|
||||||
-nographic \
|
-nographic \
|
||||||
$extra_flags \
|
$extra_flags \
|
||||||
|
|||||||
Reference in New Issue
Block a user