From 33ca2b29e241b67b737e22f1cd343ce78369677d Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Sat, 17 Feb 2018 10:06:00 +0000 Subject: [PATCH] Fix MIPS BR2_PACKAGE_LINUX_TOOLS_GPIO build Update mips for snapshot and initrd features. Document MIPS limitations. Improve description of test procedure --- CONTRIBUTING.adoc | 25 +++++++++++++++++++++---- README.adoc | 16 ++++++++++++++-- build | 5 +++++ replay.bin | Bin 32 -> 0 bytes run | 5 ++++- 5 files changed, 44 insertions(+), 7 deletions(-) delete mode 100644 replay.bin diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.adoc index d89ecba..6594c9e 100644 --- a/CONTRIBUTING.adoc +++ b/CONTRIBUTING.adoc @@ -1,8 +1,25 @@ = 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` diff --git a/README.adoc b/README.adoc index 2d415bb..50a3594 100644 --- a/README.adoc +++ b/README.adoc @@ -910,6 +910,16 @@ no module object found for '' ./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 +* <> does not work properly, does not find `start_kernel` + === init 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 is just like initrd, but you also glue the image directly to the kernel image itself. +initramfs is just like <>, 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. @@ -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. -To test it out, login into the VM, and run: +To test it out, login into the VM with and run: .... /count.sh @@ -1764,6 +1774,8 @@ cat f And the output is `0`. +Our setup does not allow for snapshotting while using <>. + == Failed action === Record and replay diff --git a/build b/build index 557ff49..26d0b36 100755 --- a/build +++ b/build @@ -88,6 +88,11 @@ fi if $x11; then cat ../buildroot_config_fragment_x11 >> "${outdir}/.config" 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 # 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 diff --git a/replay.bin b/replay.bin deleted file mode 100644 index 5530423bc46cc6075b8264903e778190705680f9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 32 ccmZR0puo-m1=2#Ig6ACNx%4@pj0qcL0Z3Q{mjD0& diff --git a/run b/run index 6e4437d..20425ac 100755 --- a/run +++ b/run @@ -116,12 +116,15 @@ $extra_flags \ " ;; 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 \ -M malta \ -append 'root=/dev/hda $extra_append' \ -cpu I6400 \ -device pcnet \ --drive file=${images_dir}/rootfs.ext2,format=raw \ -kernel ${images_dir}/vmlinux \ -nographic \ $extra_flags \