From b3401b61ed052440860adad98eb8e0826cafe9d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Fri, 25 Sep 2020 02:00:01 +0000 Subject: [PATCH] organize sections a bit, gem5 link time more info --- README.adoc | 139 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 88 insertions(+), 51 deletions(-) diff --git a/README.adoc b/README.adoc index 555944f..d7b15f5 100644 --- a/README.adoc +++ b/README.adoc @@ -5638,8 +5638,20 @@ If you don't want to start the NFS server after the next boot automatically so s systemctl disable nfs-kernel-server .... +== Operating systems + +https://en.wikipedia.org/wiki/Operating_system + +* <> +* <> +* <> +* <> +* <> + == Linux kernel +https://en.wikipedia.org/wiki/Linux_kernel + === Linux kernel configuration ==== Modify kernel config @@ -9856,8 +9868,62 @@ See also: * https://stackoverflow.com/questions/5429137/how-to-print-register-values-in-gdb/31340294#31340294 * https://stackoverflow.com/questions/24169614/how-to-show-all-x86-control-registers-when-debugging-the-linux-kernel-in-gdb-thr/59311764#59311764 +== FreeBSD + +https://en.wikipedia.org/wiki/FreeBSD + +Prebuilt on Ubuntu 20.04 worked: https://stackoverflow.com/questions/49656395/how-to-boot-freebsd-image-under-qemu/64027161#64027161[] + +TODO minimal build + boot on QEMU example anywhere??? + +== RTOS + +https://en.wikipedia.org/wiki/Real-time_operating_system + +=== Zephyr + +https://en.wikipedia.org/wiki/Zephyr_(operating_system) + +Zephyr is an RTOS that has <> support. I think it works much like our <> which uses Newlib and generates individual ELF files that contain both our C program's code, and the Zephyr libraries. + +TODO get a hello world working, and then consider further integration in this repo, e.g. being able to run all C userland content on it. + +TODO: Cortex-A CPUs are not currently supported, there are some `qemu_cortex_m0` boards, but can't find a QEMU Cortex-A. There is an x86_64 qemu board, but we don't currently have an <>. For this reason, we won't touch this further for now. + +However, unlike Newlib, Zephyr must be setting up a simple pre-main runtime to be able to handle threads. + +Failed attempt: + +.... +# https://askubuntu.com/questions/952429/is-there-a-good-ppa-for-cmake-backports +wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add - +sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic-rc main' +sudo apt-get update +sudo apt-get install cmake +git clone https://github.com/zephyrproject-rtos/zephyr +pip3 install --user -U west packaging +cd zephyr +git checkout v1.14.1 +west init zephyrproject +west update +export ZEPHYR_TOOLCHAIN_VARIANT=xtools +export XTOOLS_TOOLCHAIN_PATH="$(pwd)/out/crosstool-ng/build/default/install/aarch64/bin/" +source zephyr-env.sh +west build -b qemu_aarch64 samples/hello_world +.... + +The build system of that project is a bit excessive / wonky. You need an edge CMake not present in Ubuntu 18.04, which I don't want to install right now, and it uses the weird custom `west` build tool frontend. + +=== ARM Mbed + +https://en.wikipedia.org/wiki/Mbed + +TODO minimal setup to run it on QEMU? Possible? + == Xen +https://en.wikipedia.org/wiki/Xen + TODO: get prototype working and then properly integrate: .... @@ -9913,6 +9979,14 @@ U-Boot is a popular bootloader. It can read disk filesystems, and Buildroot supports it, so we could in theory put it into memory, and let it find a kernel image from the root filesystem and boot that, but I didn't manage to get it working yet: https://stackoverflow.com/questions/58028789/how-to-boot-linux-aarch64-with-u-boot-with-buildroot-on-qemu +== Emulators + +https://en.wikipedia.org/wiki/Emulator + +* <> +* <> +* <> + == QEMU === Introduction to QEMU @@ -27189,15 +27263,26 @@ Some approximate reference values on <>: * `opt` ** unmodified: 10 seconds -** hack with `-fuse-ld=gold`: 6 seconds. Huge improvement! +** `LDFLAGS_EXTRA=-fuse-ld=gold`: 6 seconds. Huge improvement! Note that in general you have to do a full rebuild or else link may fail: https://sourceware.org/bugzilla/show_bug.cgi?id=23869 ++ +More info on gold: ++ +*** https://stackoverflow.com/questions/3476093/replacing-ld-with-gold-any-experience/53921263#53921263 +*** https://gem5-review.googlesource.com/c/public/gem5/+/14075 * `debug` -** unmodified: 14 seconds. Why two times slower than unmodified? -** hack with `-fuse-ld=gold`: `internal error in read_cie, at ../../gold/ehframe.cc:919` on Ubuntu 18.04 all GCC. TODO report. +** unmodified: 14 seconds. Why so much slower than unmodified? +** `-fuse-ld=gold`: `internal error in read_cie, at ../../gold/ehframe.cc:919` on Ubuntu 18.04 all GCC. https://sourceware.org/bugzilla/show_bug.cgi?id=23869 * `fast` ** `--force-lto`: 1 minute. Slower as expected, since more optimizations are done at link time. `--force-lto` is only used for `fast`, and it adds `-flto` to the build. +* `opt LDFLAGS_EXTRA=-s`: stripping the executable greatly reduces link time, but you get no symbols ramfs made no difference, the kernel must be caching files in memory very efficiently already. +In addition to the link time, scons startup time can also be considerable: + +* https://gem5.atlassian.net/browse/GEM5-256 +* https://gem5-review.googlesource.com/c/public/gem5/+/25385 + Tested at: d4b3e064adeeace3c3e7d106801f95c14637c12f + 1. === Benchmark machines @@ -27435,54 +27520,6 @@ gem5: ** https://stackoverflow.com/questions/47997565/gem5-system-requirements-for-decent-performance/48941793#48941793 ** https://github.com/gem5/gem5/issues/25 -== FreeBSD - -Prebuilt on Ubuntu 20.04 worked: https://stackoverflow.com/questions/49656395/how-to-boot-freebsd-image-under-qemu/64027161#64027161[] - -TODO minimal build + boot on QEMU example anywhere??? - -== RTOS - -=== Zephyr - -https://en.wikipedia.org/wiki/Zephyr_(operating_system) - -Zephyr is an RTOS that has <> support. I think it works much like our <> which uses Newlib and generates individual ELF files that contain both our C program's code, and the Zephyr libraries. - -TODO get a hello world working, and then consider further integration in this repo, e.g. being able to run all C userland content on it. - -TODO: Cortex-A CPUs are not currently supported, there are some `qemu_cortex_m0` boards, but can't find a QEMU Cortex-A. There is an x86_64 qemu board, but we don't currently have an <>. For this reason, we won't touch this further for now. - -However, unlike Newlib, Zephyr must be setting up a simple pre-main runtime to be able to handle threads. - -Failed attempt: - -.... -# https://askubuntu.com/questions/952429/is-there-a-good-ppa-for-cmake-backports -wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add - -sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic-rc main' -sudo apt-get update -sudo apt-get install cmake -git clone https://github.com/zephyrproject-rtos/zephyr -pip3 install --user -U west packaging -cd zephyr -git checkout v1.14.1 -west init zephyrproject -west update -export ZEPHYR_TOOLCHAIN_VARIANT=xtools -export XTOOLS_TOOLCHAIN_PATH="$(pwd)/out/crosstool-ng/build/default/install/aarch64/bin/" -source zephyr-env.sh -west build -b qemu_aarch64 samples/hello_world -.... - -The build system of that project is a bit excessive / wonky. You need an edge CMake not present in Ubuntu 18.04, which I don't want to install right now, and it uses the weird custom `west` build tool frontend. - -=== ARM Mbed - -https://en.wikipedia.org/wiki/Mbed - -TODO minimal setup to run it on QEMU? Possible? - == Compilers Argh, compilers are boring, let's learn a bit about them.