Introduce -G option that forces gem5 rebuild in addition to -g.
This commit is contained in:
Ciro Santilli
2018-03-24 22:11:57 +00:00
parent 39ad57a309
commit baccf8ff07
3 changed files with 59 additions and 50 deletions

View File

@@ -73,7 +73,7 @@ git ls-files | grep modulename
=== Rebuild
After making changes to a package, you must explicitly tell it to be rebuilt.
After making changes to a package, you must explicitly request it to be rebuilt.
For example, you you modify the kernel modules, you must rebuild with:
@@ -92,17 +92,25 @@ where `kernel_module` is the name of out Buildroot package that contains the ker
Other important targets are:
....
./build -- linux-reconfigure host-qemu-reconfigure
./build -l -q -G
....
which are aliased respectively to:
which rebuild the Linux kernel, and QEMU and gem5 respectively. They are essentially aliases for:
....
./build -l -q
./build -- linux-reconfigure host-qemu-reconfigure gem5-reconfigure
....
However, some of our aliases such as `-l` also have some magic convenience properties. So generally just use the aliases instead.
We don't rebuild by default because, even with `make` incremental rebuilds, the timestamp check takes a few annoying seconds.
Not all packages have an alias, when they don't, just use the form:
....
./build -- <pkg>-reconfigure
....
=== Clean the build
You did something crazy, and nothing seems to work anymore?
@@ -1417,11 +1425,10 @@ So the only argument that QEMU needs is the `-kernel`, no `-drive` not even `-in
Try it out with:
....
touch kernel_config_fragment
./build -I && ./run -I
./build -I -l && ./run -I
....
The `touch` should only be used the first time you move to / from a different root filesystem method (ext2 or cpio) to initramfs to overcome: <<force-linux-kernel-configuration-update>>. Further builds should be done simply as:
The `-l` (ell) should only be used the first time you move to / from a different root filesystem method (ext2 or cpio) to initramfs to overcome: https://stackoverflow.com/questions/49260466/why-when-i-change-br2-linux-kernel-custom-config-file-and-run-make-linux-reconfi
....
./build -I && ./run -I
@@ -1457,12 +1464,9 @@ By default, we use a `.config` that is a mixture of:
If you want to just use your own exact `.config` instead, do:
....
touch myconfig
./build -K myconfig
./build -K myconfig -l
....
The `touch` is only need the first time you move to a new kernel configuration: <<force-linux-kernel-configuration-update>>.
Beware that Buildroot can `sed` override some of the configurations we make no matter what, e.g. it forces `CONFIG_BLK_DEV_INITRD=y` when `BR2_TARGET_ROOTFS_CPIO` is on, so you might want to double check as explained at <<find-the-kernel-config>>. TODO check if there is a way to prevent that patching and maybe patch Buildroot for it, it is too fuzzy. People should be able to just build with whatever `.config` they want.
==== Find the kernel config
@@ -1479,26 +1483,6 @@ or on host:
cat buildroot/output.*~/build/linux-custom/.config
....
==== Force Linux kernel configuration update
https://stackoverflow.com/questions/49260466/why-when-i-change-br2-linux-kernel-custom-config-file-and-run-make-linux-reconfi
To save rebuild time, Buildroot does many things based on timestamps.
This means that some operations end up not updating the Linux kernel `.config`, and we just require you to do it manually with:
....
touch kernel_config_fragment
....
When this works, you should see Buildroot run the kernel rebuild commands:
The reason we don't do that automatically all the time, is that this would defeat the purpose of the timestamp, and add some overhead even when you are not modifying the config at all.
Maybe we could think of smarter methods to overcome this problem more automatically, e.g. take hashes and check them whenever a suspicious operations happens.
But for now we just require you to do the `touch` manually yourself, and document when this is needed.
=== Find the kernel version
We try to use the latest possible kernel major release version.

28
build
View File

@@ -9,11 +9,12 @@ config_fragments='br2'
extra_make_args=''
gem5=false
j="$(($(nproc) - 2))"
linux_reconfigure=false
linux_kernel_custom_config_file=''
post_script_args=''
qemu_sdl='--enable-sdl --with-sdlabi=2.0'
v=0
while getopts 'a:b:c:Cgj:hIiK:klp:qSv' OPT; do
while getopts 'a:b:c:CGgj:hIiK:klp:qSv' OPT; do
case "$OPT" in
a)
arch="$OPTARG"
@@ -27,6 +28,10 @@ while getopts 'a:b:c:Cgj:hIiK:klp:qSv' OPT; do
C)
configure=false
;;
G)
extra_make_args="$extra_make_args gem5-reconfigure"
gem5=true
;;
g)
gem5=true
;;
@@ -58,6 +63,7 @@ BR2_TARGET_ROOTFS_INITRAMFS=n
extra_make_args="$extra_make_args kernel_module-reconfigure"
;;
l)
linux_reconfigure=true
extra_make_args="$extra_make_args linux-reconfigure"
;;
p)
@@ -121,17 +127,29 @@ BR2_ROOTFS_POST_SCRIPT_ARGS=\"$post_script_args\"
fi
fi
fi
if [ -z "$linux_kernel_custom_config_file" ]; then
if [ -n "$linux_kernel_custom_config_file" ]; then
f="../${linux_kernel_custom_config_file}"
if [ -f "$f" ]; then
printf "BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE=\"${f}\"\n" >> "${config_file}"
if "${linux_reconfigure}"; then
touch "$f"
fi
else
echo "error: -K: file does not exist: ${linux_kernel_custom_config_file}" 1>&2
exit 1
fi
else
printf "BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES=\"../kernel_config_fragment\"\n" >> "${config_file}"
if "${linux_reconfigure}"; then
# https://stackoverflow.com/questions/49260466/why-when-i-change-br2-linux-kernel-custom-config-file-and-run-make-linux-reconfi
touch "$f"
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/' "${config_file}"
fi
if [ -n "$linux_kernel_custom_config_file" ]; then
printf "BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE=\"../${linux_kernel_custom_config_file}\"\n" >> "${config_file}"
fi
make O="$out_dir" olddefconfig
fi

View File

@@ -4,6 +4,8 @@
./build [OPTIONS] [-- EXTRA_MAKE_ARGS]
....
== Configuration options
[options="header"]
|===
|Name |Argument name | Description
@@ -14,25 +16,30 @@
Example: `-B 'BR2_TARGET_ROOTFS_EXT2_SIZE="500M"'`
|`-c` |`BR2_FILE` | Also use the given Buildroot configuration fragment file.
Pass multiple times to use multiple fragment files.
|`-C` | | Skip the Buildroot configuration. Saves a few seconds, but requires
you to know what you are doing :-)
|`-g` | | Enable gem5 build. You also need to use `-- gem5-reconfigure`
to rebuild gem5 after the initial build.
|`-C` | | Skip the Buildroot configuration. Saves a few seconds,
but requires you to know what you are doing :-)
|`-g` | | Enable gem5 build and disable QEMU build. You also need
to use `-G` or `-- gem5-reconfigure` to rebuild gem5
after the initial build.
|`-h` | | Show this help message.
|`-I` | | Enable initramfs for the current build.
|`-i` | | Enable initrd for the current build.
|`-K` |`KERNEL_CONFIG_FILE` | Use `KERNEL_CONFIG_FILE` as the exact Linux
kernel configuration. Ignore the default `kernel_config_fragment`.
You also need to `touch KERNEL_CONFIG_FILE` if that file is
older than the latest build.
|`-k` | | Reconfigure and rebuild the kernel module package.
Shortcut for `-- kernel_module-reconfigure`.
|`-l` | | Reconfigure and rebuild the linux kernel.
Shortcut for `-- linux-reconfigure`.
|`-K` |`KERNEL_CONFIG_FILE` | Use `KERNEL_CONFIG_FILE` as the exact Linux kernel
configuration. Ignore the default `kernel_config_fragment`.
|`-p` | | Pass extra arguments to the `rootfs_post_build_script`.
|`-q` | | Reconfigure and rebuild QEMU.
Shortcut for `-- host-qemu-reconfigure`.
|`-S` | | Don't build QEMU with SDL support.
Graphics such as X11 won't work, only the terminal.
|`-v` | | Do a verbose build.
|===
== Build target options
[options="header"]
|===
|Name |Forces rebuild of |Extra actions
|`-G` |gem5 |Implies `-g`.
|`-k` |Kernel modules |
|`-l` |Linux kernel |Touches kernel configuration files to overcome:
https://stackoverflow.com/questions/49260466/why-when-i-change-br2-linux-kernel-custom-config-file-and-run-make-linux-reconfi
|`-q` |QEMU |
|===