From 14f201f26d2ab648c8af80041ff6189829e29368 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: Sun, 28 Oct 2018 00:00:07 +0000 Subject: [PATCH] build-buildroot: remove --buildroot- prefix after build-linux split build-linux: don't automtaically add CONFIG_, e.g. disable is done with comment. --- README.adoc | 90 ++++++++++++++++++++++++++--------------------------- build-linux | 7 ++--- 2 files changed, 48 insertions(+), 49 deletions(-) diff --git a/README.adoc b/README.adoc index a3f80d1..4cae5b8 100644 --- a/README.adoc +++ b/README.adoc @@ -1653,8 +1653,8 @@ The number of cores is modified as explained at: <> .... ./build-buildroot \ - --buildroot-config 'BR2_PACKAGE_UTIL_LINUX=y' \ - --buildroot-config 'BR2_PACKAGE_UTIL_LINUX_SCHEDUTILS=y' \ + --config 'BR2_PACKAGE_UTIL_LINUX=y' \ + --config 'BR2_PACKAGE_UTIL_LINUX_SCHEDUTILS=y' \ ; ./run --eval-busybox 'taskset -c 1,1 /sched_getaffinity.out' .... @@ -1964,7 +1964,7 @@ Step debug userland processes to understand how they are talking to the kernel. First build `gdbserver` into the root filesystem: .... -./build-buildroot --buildroot-config 'BR2_PACKAGE_GDB=y' +./build-buildroot --config 'BR2_PACKAGE_GDB=y' .... Then on guest: @@ -2702,8 +2702,8 @@ Compile the `dtc` tool into the root filesystem: .... ./build-buildroot \ --arch aarch64 \ - --buildroot-config 'BR2_PACKAGE_DTC=y' \ - --buildroot-config 'BR2_PACKAGE_DTC_PROGRAMS=y' \ + --config 'BR2_PACKAGE_DTC=y' \ + --config 'BR2_PACKAGE_DTC_PROGRAMS=y' \ ; .... @@ -3313,7 +3313,7 @@ Once you've seen the `CONFIG_LOGO` penguin as a sanity check, you can try to go Build and run: .... -./build-buildroot --buildroot-config-fragment br2/x11 +./build-buildroot --config-fragment br2/x11 ./run --graphic .... @@ -3343,7 +3343,7 @@ Not sure how well that graphics stack represents real systems, but if it does it To x11 packages have an `xserver` prefix as in: .... -./build-buildroot --buildroot-config-fragment br2/x11 -- xserver_xorg-server-reconfigure +./build-buildroot --config-fragment br2/x11 -- xserver_xorg-server-reconfigure .... the easiest way to find them out is to just list `"$(./getvar build_dir)/x*`. @@ -3506,7 +3506,7 @@ We us this exact procedure to connect to <>. Not enabled by default due to the build / runtime overhead. To enable, build with: .... -./build-buildroot --buildroot-config 'BR2_PACKAGE_OPENSSH=y' +./build-buildroot --config 'BR2_PACKAGE_OPENSSH=y' .... Then inside the guest turn on sshd: @@ -3644,7 +3644,7 @@ By default, we use a `.config` that is a mixture of: To modify a single option on top of our defaults, do: .... -./build-linux --kernel-config 'CONFIG_FORTIFY_SOURCE=y' +./build-linux --config 'CONFIG_FORTIFY_SOURCE=y' .... Kernel modules depend on certain kernel configs, and therefore in general you might have to clean and rebuild the kernel modules after changing the kernel config: @@ -3665,7 +3665,7 @@ printf ' CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y ' > data/myconfig -./build-buildroot --kernel-config-fragment 'data/myconfig' +./build-buildroot --config-fragment 'data/myconfig' .... To use just your own exact `.config` instead of our defaults ones, use: @@ -3676,8 +3676,8 @@ To use just your own exact `.config` instead of our defaults ones, use: The following options can all be used together, sorted by decreasing config setting power precedence: -* `--kernel-config` -* `--kernel-config-fragment` +* `--config` +* `--config-fragment` * `--kernel-custom-config-file` ==== Find the kernel config @@ -6142,7 +6142,7 @@ https://stackoverflow.com/questions/29840213/how-do-i-trace-a-system-call-in-lin TODO example: .... -./build-buildroot --buildroot-config 'BR2_PACKAGE_TRACE_CMD=y' +./build-buildroot --config 'BR2_PACKAGE_TRACE_CMD=y' .... ==== Kprobes @@ -6819,7 +6819,7 @@ Looks like a recompile is needed to modify the image... DRM / DRI is the new interface that supersedes `fbdev`: .... -./build-buildroot --buildroot-config 'BR2_PACKAGE_LIBDRM=y' +./build-buildroot --config 'BR2_PACKAGE_LIBDRM=y' ./build-userland --has-package libdrm -- libdrm_modeset ./run --eval-busybox '/libdrm_modeset.out' --graphic .... @@ -6831,7 +6831,7 @@ Outcome: for a few seconds, the screen that contains the terminal gets taken ove TODO not working for `aarch64`, it takes over the screen for a few seconds and the kernel messages disappear, but the screen stays black all the time. .... -./build-buildroot --buildroot-config 'BR2_PACKAGE_LIBDRM=y' --kernel-modules +./build-buildroot --config 'BR2_PACKAGE_LIBDRM=y' --kernel-modules ./run --eval-busybox '/libdrm_modeset.out' --graphic .... @@ -6872,7 +6872,7 @@ Tested on: link:http://github.com/cirosantilli/linux-kernel-module-cheat/commit/ ==== kmscube .... -./build-buildroot --buildroot-config-fragment br2/kmscube +./build-buildroot --config-fragment br2/kmscube .... Outcome: a colored spinning cube coded in OpenGL + EGL takes over your display and spins forever: https://www.youtube.com/watch?v=CqgJMgfxjsk @@ -6939,7 +6939,7 @@ TODO get working. Looks like a more raw alternative to libdrm: .... -./build-buildroot --buildroot-config 'BR2_PACKABE_LIBDRI2=y' +./build-buildroot --config 'BR2_PACKABE_LIBDRI2=y' wget \ -O "$(./getvar kernel_modules_src_dir)/user/dri2test.c" \ https://raw.githubusercontent.com/robclark/libdri2/master/test/dri2test.c \ @@ -6966,7 +6966,7 @@ C userland test suite. Buildroot already has a package, so it is trivial to build it: .... -./build-buildroot --buildroot-config 'BR2_PACKAGE_LTP_TESTSUITE=y' +./build-buildroot --config 'BR2_PACKAGE_LTP_TESTSUITE=y' .... Then try it out with: @@ -6985,8 +6985,8 @@ TODO a large chunk of tests, the Open POSIX test suite, is disabled with a comme POSIX userland stress. Two versions: .... -./build-buildroot --buildroot-config 'BR2_PACKAGE_STRESS=y' -./build-buildroot --buildroot-config 'BR2_PACKAGE_STRESS_NG=y' +./build-buildroot --config 'BR2_PACKAGE_STRESS=y' +./build-buildroot --config 'BR2_PACKAGE_STRESS_NG=y' .... Websites: @@ -7511,7 +7511,7 @@ where link:http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0190b/ Then compile with: .... -./build-buildroot --arch arm --buildroot-config-fragment br2/gpio -c kernel_config_fragment/gpio -l +./build-buildroot --arch arm --config-fragment br2/gpio -c kernel_config_fragment/gpio -l .... then test it out with: @@ -7848,7 +7848,7 @@ Peter Maydell said potentially not possible nicely as of August 2018: https://st It is also worth looking into the QEMU Guest Agent tool `qemu-gq` that can be enabled with: .... -./build-buildroot --buildroot-config 'BR2_PACKAGE_QEMU=y' +./build-buildroot --config 'BR2_PACKAGE_QEMU=y' .... See also: https://superuser.com/questions/930588/how-to-pass-commands-noninteractively-to-running-qemu-from-the-guest-qmp-via-te @@ -8307,7 +8307,7 @@ Let's see how many cycles https://en.wikipedia.org/wiki/Dhrystone[Dhrystone], wh First build Dhrystone into the root filesystem: .... -./build-buildroot --buildroot-config 'BR2_PACKAGE_DHRYSTONE=y' +./build-buildroot --config 'BR2_PACKAGE_DHRYSTONE=y' .... Then, a flexible setup is demonstrated at: @@ -8620,7 +8620,7 @@ Source: link:userland/openmp.c[] Buildroot supports it, which makes everything just trivial: .... -./build-buildroot --buildroot-config 'BR2_PACKAGE_OPENBLAS=y' +./build-buildroot --config 'BR2_PACKAGE_OPENBLAS=y' ./build-userland --has-package openblas -- openblas_hello ./run --eval-busybox '/openblas_hello.out; echo $?' .... @@ -8660,7 +8660,7 @@ cblas_dgemm( CblasColMajor, CblasNoTrans, CblasTrans,3,3,2 ,1, A,3, B, Header only linear algebra library with a mainline Buildroot package: .... -./build-buildroot --buildroot-config 'BR2_PACKAGE_EIGEN=y' +./build-buildroot --config 'BR2_PACKAGE_EIGEN=y' ./build-userland --has-package eigen -- eigen_hello .... @@ -8696,7 +8696,7 @@ There are two ways to run PARSEC with this repo: .... ./download-dependencies --gem5 --parsec-benchmark -./build-buildroot --arch arm --buildroot-config 'BR2_PACKAGE_PARSEC_BENCHMARK=y' --gem5 +./build-buildroot --arch arm --config 'BR2_PACKAGE_PARSEC_BENCHMARK=y' --gem5 ./run --arch arm --gem5 .... @@ -8725,8 +8725,8 @@ Running a benchmark of a size different than `test`, e.g. `simsmall`, requires a .... ./build-buildroot \ --arch arm \ - --buildroot-config 'BR2_PACKAGE_PARSEC_BENCHMARK=y' \ - --buildroot-config 'BR2_PACKAGE_PARSEC_BENCHMARK_INPUT_SIZE="simsmall"' \ + --config 'BR2_PACKAGE_PARSEC_BENCHMARK=y' \ + --config 'BR2_PACKAGE_PARSEC_BENCHMARK_INPUT_SIZE="simsmall"' \ --gem5 \ -- parsec-benchmark-reconfigure \ ; @@ -8783,9 +8783,9 @@ If you still want to run this, try it out with: .... ./build-buildroot \ --arch aarch64 \ - --buildroot-config 'BR2_PACKAGE_PARSEC_BENCHMARK=y' \ - --buildroot-config 'BR2_PACKAGE_PARSEC_BENCHMARK_PARSECMGMT=y' \ - --buildroot-config 'BR2_TARGET_ROOTFS_EXT2_SIZE="3G"' \ + --config 'BR2_PACKAGE_PARSEC_BENCHMARK=y' \ + --config 'BR2_PACKAGE_PARSEC_BENCHMARK_PARSECMGMT=y' \ + --config 'BR2_TARGET_ROOTFS_EXT2_SIZE="3G"' \ --gem5 \ -- parsec-benchmark-reconfigure \ ; @@ -8840,7 +8840,7 @@ Don't forget to explicitly rebuild PARSEC with: .... ./build-buildroot \ --arch arm \ - --buildroot-config 'BR2_PACKAGE_PARSEC_BENCHMARK=y' \ + --config 'BR2_PACKAGE_PARSEC_BENCHMARK=y' \ --gem5 \ -- parsec-benchmark-reconfigure \ ; @@ -9655,13 +9655,13 @@ So you must tell Buildroot yourself about the rebuild. We provide the following mechanisms: -* `./build-buildroot --buildroot-config-fragment data/br2`: append the Buildroot configuration file `data/br2` to a single build. Must be passed every time you run `./build`. The format is the same as link:br2/default[]. -* `./build-buildroot --buildroot-config 'BR2_SOME_OPTION="myval"'`: append a single option to a single build. +* `./build-buildroot --config-fragment data/br2`: append the Buildroot configuration file `data/br2` to a single build. Must be passed every time you run `./build`. The format is the same as link:br2/default[]. +* `./build-buildroot --config 'BR2_SOME_OPTION="myval"'`: append a single option to a single build. For example, if you decide to <> after an initial build is finished, you must <> and rebuild: .... -./build-buildroot --buildroot-config 'BR2_OPTIMIZE_3=y' kernel_modules-dirclean kernel_modules-reconfigure +./build-buildroot --config 'BR2_OPTIMIZE_3=y' kernel_modules-dirclean kernel_modules-reconfigure .... as explained at: https://buildroot.org/downloads/manual/manual.html#rebuild-pkg @@ -9696,7 +9696,7 @@ Then, you have two choices: + .... ./build-buildroot \ - --buildroot-config 'BR2_OPTIMIZE_3=y' \ + --config 'BR2_OPTIMIZE_3=y' \ -- \ kernel_modules-dirclean \ kernel_modules-reconfigure \ @@ -9712,7 +9712,7 @@ Kernel-wise it should be fine though due to: <> + .... mv out out~ -./build-buildroot --buildroot-config 'BR2_OPTIMIZE_3=y' +./build-buildroot --config 'BR2_OPTIMIZE_3=y' .... === Find Buildroot options with make menuconfig @@ -9810,7 +9810,7 @@ Maybe you need to increase the filesystem size (BR2_TARGET_ROOTFS_EXT2_SIZE) The solution is to simply add: .... -./build-buildroot --buildroot-config 'BR2_TARGET_ROOTFS_EXT2_SIZE="512M"' +./build-buildroot --config 'BR2_TARGET_ROOTFS_EXT2_SIZE="512M"' .... where 512Mb is "large enough". @@ -9859,7 +9859,7 @@ Test how Buildroot deals with many files with: .... ./build-buildroot \ - --buildroot-config 'BR2_PACKAGE_LKMC_MANY_FILES=y' \ + --config 'BR2_PACKAGE_LKMC_MANY_FILES=y' \ -- \ lkmc_many_files-reconfigure \ |& \ @@ -10536,7 +10536,7 @@ See <> for the gory details. === Default command line arguments -It gets annoying to retype `--arch aarch64` for every single command, or to remember `--buildroot-config` setups. +It gets annoying to retype `--arch aarch64` for every single command, or to remember `--config` setups. So simplify that, do: @@ -10952,15 +10952,15 @@ but it feels hackish, and the build was slower than normal, looks like the build Allows you to have multiple versions of the GCC toolchain or root filesystem. -Analogous to the <> but with the `--buildroot-build-id` option instead: +Analogous to the <> but with the `--build-id` option instead: .... ./build-buildroot git -C "$(./getvar buildroot_src_dir)" checkout 2018.05 -./build-buildroot --buildroot-build-id 2018.05 +./build-buildroot --build-id 2018.05 git -C "$(./getvar buildroot_src_dir)" checkout - ./run -./run --buildroot-build-id 2018.05 +./run --build-id 2018.05 .... === Directory structure @@ -11007,13 +11007,13 @@ Every directory inside it is a Buildroot package. Those packages get automatically added to Buildroot's `BR2_EXTERNAL`, so all you need to do is to turn them on during build, e.g.: .... -./build-buildroot --buildroot-config 'BR2_SAMPLE_PACKAGE=y' +./build-buildroot --config 'BR2_SAMPLE_PACKAGE=y' .... or force a rebuild after the first one with: .... -./build-buildroot --buildroot-config 'BR2_SAMPLE_PACKAGE=y' -- sample_package-reconfigure +./build-buildroot --config 'BR2_SAMPLE_PACKAGE=y' -- sample_package-reconfigure .... then test it out with: diff --git a/build-linux b/build-linux index 2474f65..6f0c451 100755 --- a/build-linux +++ b/build-linux @@ -10,9 +10,8 @@ class LinuxComponent(common.Component): parser.add_argument( '--config', default=[], action='append', help='''\ -Add a single kernel config configs to the current build. -The `CONFIG_` prefix is added automatically. Sample values: -'FORTIFY_SOURCE=y', `KGDB=n`. Can be used multiple times to add multiple +Add a single kernel config configs to the current build. Sample value: +'CONFIG_FORTIFY_SOURCE=y'. Can be used multiple times to add multiple configs. Takes precedence over any config files. ''' ) @@ -91,7 +90,7 @@ Configure the kernel, but don't build it. config_fragments.extend(args.config_fragment) if args.config != []: cli_config_fragment_path = os.path.join(build_dir, 'lkmc_cli_config_fragment') - cli_config_str = '\n'.join(map(lambda x: 'CONFIG_' + x, args.config)) + cli_config_str = '\n'.join(args.config) common.write_string_to_file(cli_config_fragment_path, cli_config_str) config_fragments.append(cli_config_fragment_path) common.cp(