mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
Start sketching parsec buildroot package
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -11,3 +11,6 @@
|
|||||||
[submodule "gem5/gem5"]
|
[submodule "gem5/gem5"]
|
||||||
path = gem5/gem5
|
path = gem5/gem5
|
||||||
url = https://gem5.googlesource.com/public/gem5
|
url = https://gem5.googlesource.com/public/gem5
|
||||||
|
[submodule "parsec-benchmark/parsec-benchmark"]
|
||||||
|
path = parsec-benchmark/parsec-benchmark
|
||||||
|
url = https://github.com/cirosantilli/parsec-benchmark
|
||||||
|
|||||||
23
README.adoc
23
README.adoc
@@ -76,29 +76,36 @@ git ls-files | grep modulename
|
|||||||
|
|
||||||
=== Rebuild
|
=== Rebuild
|
||||||
|
|
||||||
If you make changes to the kernel modules or most configurations tracked on this repository, you can just use again:
|
After making changes to a package, you must explicitly tell it to be rebuilt.
|
||||||
|
|
||||||
|
For example, you you modify the kernel modules, you must rebuild with:
|
||||||
|
|
||||||
....
|
....
|
||||||
./build
|
./build -k
|
||||||
./run
|
|
||||||
....
|
....
|
||||||
|
|
||||||
and the modified files will be rebuilt.
|
which is just an alias for:
|
||||||
|
|
||||||
If you change any package besides `kernel_module`, you must also request those packages to be reconfigured or rebuilt with extra targets, e.g.:
|
....
|
||||||
|
./build -t kernel_module-reconfigure
|
||||||
|
....
|
||||||
|
|
||||||
|
where `kernel_module` is the name of out Buildroot package that contains the kernel modules.
|
||||||
|
|
||||||
|
Other important targets are:
|
||||||
|
|
||||||
....
|
....
|
||||||
./build -t linux-reconfigure -t host-qemu-reconfigure
|
./build -t linux-reconfigure -t host-qemu-reconfigure
|
||||||
....
|
....
|
||||||
|
|
||||||
Those aren't turned on by default because they take quite a few seconds.
|
which are aliased respectively to:
|
||||||
|
|
||||||
Linux and QEMU rebuilds are so common that we have dedicated shortcut flags for them:
|
|
||||||
|
|
||||||
....
|
....
|
||||||
./build -l -q
|
./build -l -q
|
||||||
....
|
....
|
||||||
|
|
||||||
|
We don't rebuild by default because, even with `make` incremental rebuilds, the timestamp check takes a few annoying seconds.
|
||||||
|
|
||||||
=== Clean the build
|
=== Clean the build
|
||||||
|
|
||||||
You did something crazy, and nothing seems to work anymore?
|
You did something crazy, and nothing seems to work anymore?
|
||||||
|
|||||||
29
build
29
build
@@ -19,6 +19,9 @@ while getopts 'a:gj:lp:qSt:v' OPT; do
|
|||||||
j)
|
j)
|
||||||
j="$OPTARG"
|
j="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
l)
|
||||||
|
extra_targets="$extra_args kernel_module-reconfigure"
|
||||||
|
;;
|
||||||
l)
|
l)
|
||||||
extra_targets="$extra_args linux-reconfigure"
|
extra_targets="$extra_args linux-reconfigure"
|
||||||
;;
|
;;
|
||||||
@@ -64,14 +67,15 @@ if "$gem5"; then
|
|||||||
post_script_args="$post_script_args -n"
|
post_script_args="$post_script_args -n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rootdir="$(pwd)"
|
||||||
cd kernel_module
|
cd kernel_module
|
||||||
./make-host.sh -j "$j" clean
|
./make-host.sh -j "$j" clean
|
||||||
cd ../buildroot
|
cd "$rootdir/buildroot"
|
||||||
for p in $(find '../buildroot_patches/' -maxdepth 1 -name '*.patch' -print); do
|
for p in $(find "${rootdir}/buildroot_patches/" -maxdepth 1 -name '*.patch' -print); do
|
||||||
patch -N -r - -p 1 <"$p" || :
|
patch -N -r - -p 1 <"$p" || :
|
||||||
done
|
done
|
||||||
outdir="output.${arch_dir}~"
|
outdir="output.${arch_dir}~"
|
||||||
make O="$outdir" BR2_EXTERNAL="$(pwd)/../kernel_module:$(pwd)/../gem5" "$defconfig"
|
make O="$outdir" BR2_EXTERNAL="${rootdir}/kernel_module:${rootdir}/gem5:${rootdir}/parsec" "$defconfig"
|
||||||
# TODO Can't get rid of this for now.
|
# TODO Can't get rid of this for now.
|
||||||
# http://stackoverflow.com/questions/44078245/is-it-possible-to-use-config-fragments-with-buildroots-config
|
# http://stackoverflow.com/questions/44078245/is-it-possible-to-use-config-fragments-with-buildroots-config
|
||||||
cat ../buildroot_config_fragment >> "${outdir}/.config"
|
cat ../buildroot_config_fragment >> "${outdir}/.config"
|
||||||
@@ -101,20 +105,21 @@ make O="$outdir" olddefconfig
|
|||||||
#
|
#
|
||||||
# Even if were an autotools package, there is no general way currently to pass extra configs to it:
|
# Even if were an autotools package, there is no general way currently to pass extra configs to it:
|
||||||
# https://stackoverflow.com/questions/44341188/how-to-pass-extra-custom-configure-autotools-options-to-a-buildroot-package/44341225#44341225
|
# https://stackoverflow.com/questions/44341188/how-to-pass-extra-custom-configure-autotools-options-to-a-buildroot-package/44341225#44341225
|
||||||
time \
|
cmd="time \
|
||||||
env \
|
env \
|
||||||
-u LD_LIBRARY_PATH \
|
-u LD_LIBRARY_PATH \
|
||||||
make \
|
make \
|
||||||
O="$outdir" \
|
O='$outdir' \
|
||||||
BR2_JLEVEL="$j" \
|
BR2_JLEVEL='$j' \
|
||||||
BR2_PACKAGE_GEM5="$("$gem5" && echo y || echo n)" \
|
BR2_PACKAGE_GEM5='$("$gem5" && echo y || echo n)' \
|
||||||
BR2_ROOTFS_POST_SCRIPT_ARGS="$post_script_args" \
|
BR2_ROOTFS_POST_SCRIPT_ARGS='$post_script_args' \
|
||||||
HOST_QEMU_OPTS="--enable-debug --extra-cflags='-DDEBUG_PL061=1' --enable-trace-backends=simple $qemu_sdl" \
|
HOST_QEMU_OPTS='--enable-debug --extra-cflags=-DDEBUG_PL061=1 --enable-trace-backends=simple $qemu_sdl' \
|
||||||
V="$v" \
|
V='$v' \
|
||||||
kernel_module-rebuild \
|
|
||||||
$extra_targets \
|
$extra_targets \
|
||||||
all \
|
all \
|
||||||
;
|
"
|
||||||
|
echo "$cmd" | tee "${rootdir}/build.log"
|
||||||
|
eval "$cmd"
|
||||||
cd ..
|
cd ..
|
||||||
if "$gem5"; then
|
if "$gem5"; then
|
||||||
./build-gem5 -a "$arch"
|
./build-gem5 -a "$arch"
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
BR2_ENABLE_LOCALE=y
|
# Custom packages
|
||||||
|
BR2_PACKAGE_KERNEL_MODULE=y
|
||||||
|
BR2_PACKAGE_PARSEC=y
|
||||||
|
BR2_PACKAGE_PARSEC_BUILD_LIST="splash2"
|
||||||
|
# Required for parsec.
|
||||||
|
BR2_TARGET_ROOTFS_EXT2_SIZE="1G"
|
||||||
|
|
||||||
BR2_GCC_ENABLE_GRAPHITE=y
|
BR2_GCC_ENABLE_GRAPHITE=y
|
||||||
BR2_GCC_ENABLE_LTO=y
|
BR2_GCC_ENABLE_LTO=y
|
||||||
BR2_GCC_ENABLE_OPENMP=y
|
BR2_GCC_ENABLE_OPENMP=y
|
||||||
BR2_GLOBAL_PATCH_DIR="../global_patch_dir"
|
BR2_GLOBAL_PATCH_DIR="../global_patch_dir"
|
||||||
BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="../busybox_config_fragment"
|
BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="../busybox_config_fragment"
|
||||||
BR2_PACKAGE_DHRYSTONE=y
|
BR2_PACKAGE_DHRYSTONE=y
|
||||||
BR2_PACKAGE_KERNEL_MODULE=y
|
|
||||||
BR2_PACKAGE_OVERRIDE_FILE="../buildroot_override"
|
BR2_PACKAGE_OVERRIDE_FILE="../buildroot_override"
|
||||||
# For qemu-ga on guest. TODO: do something with it, and document it.
|
# For qemu-ga on guest. TODO: do something with it, and document it.
|
||||||
BR2_PACKAGE_QEMU=y
|
BR2_PACKAGE_QEMU=y
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
HOST_QEMU_OVERRIDE_SRCDIR = ../qemu
|
HOST_QEMU_OVERRIDE_SRCDIR = ../qemu
|
||||||
LINUX_OVERRIDE_SRCDIR = ../linux
|
LINUX_OVERRIDE_SRCDIR = ../linux
|
||||||
|
PARSEC_OVERRIDE_SRCDIR = ../parsec-benchmark/parsec-benchmark
|
||||||
QEMU_OVERRIDE_SRCDIR = ../qemu
|
QEMU_OVERRIDE_SRCDIR = ../qemu
|
||||||
|
|||||||
9
configure
vendored
9
configure
vendored
@@ -12,19 +12,20 @@ while getopts t OPT; do
|
|||||||
done
|
done
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
|
|
||||||
|
submodules='buildroot linux qemu gem5/gem5'
|
||||||
(
|
(
|
||||||
set -e
|
set -e
|
||||||
# Shallow clonning saves a considerable ammount of time, specially because of the linux kernel.
|
# Shallow cloning saves a considerable amount of time, specially because of the linux kernel.
|
||||||
# However, git submodules are buggy as usual, and this is the best way i've found to get it done:
|
# However, git submodules are buggy as usual, and this is the best way I've found to get it done:
|
||||||
# https://stackoverflow.com/questions/2144406/git-shallow-submodules/47374702#47374702
|
# https://stackoverflow.com/questions/2144406/git-shallow-submodules/47374702#47374702
|
||||||
# In particular:
|
# In particular:
|
||||||
# - `shallow = true` on the submodule has no effect for the non default educational branches of our submodules
|
# - `shallow = true` on the submodule has no effect for the non default educational branches of our submodules
|
||||||
# - QEMU's submodules point to commits that are neither under branches nor tags, and so `--shallow-submodules` fails
|
# - QEMU's submodules point to commits that are neither under branches nor tags, and so `--shallow-submodules` fails
|
||||||
git submodule update --depth 1 --jobs 4 --init
|
git submodule update --depth 1 --jobs 4 --init -- $submodules
|
||||||
cd qemu
|
cd qemu
|
||||||
git submodule update --init
|
git submodule update --init
|
||||||
) &
|
) &
|
||||||
wait $! || git submodule update --init
|
wait $! || git submodule update --init -- $submodules
|
||||||
|
|
||||||
pkgs="\
|
pkgs="\
|
||||||
automake \
|
automake \
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
config BR2_PACKAGE_GEM5
|
config BR2_PACKAGE_GEM5
|
||||||
bool "gem5"
|
bool "gem5"
|
||||||
help
|
help
|
||||||
GEM5
|
gem5 system simulator. Only builds the m5 guest instrumentation
|
||||||
|
tool for now, not the simulator itself.
|
||||||
|
|
||||||
|
http://gem5.org
|
||||||
|
|||||||
16
parsec-benchmark/Config.in
Normal file
16
parsec-benchmark/Config.in
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
config BR2_PACKAGE_PARSEC
|
||||||
|
bool "PARSEC"
|
||||||
|
help
|
||||||
|
Parsec system benchmark.
|
||||||
|
|
||||||
|
http://parsec.cs.princeton.edu/
|
||||||
|
|
||||||
|
if BR2_PACKAGE_PARSEC
|
||||||
|
|
||||||
|
config BR2_PACKAGE_PARSEC_BUILD_LIST
|
||||||
|
string "build_list"
|
||||||
|
default all
|
||||||
|
help
|
||||||
|
Space separated list of parsec packages to build.
|
||||||
|
|
||||||
|
endif
|
||||||
1
parsec-benchmark/external.desc
Normal file
1
parsec-benchmark/external.desc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
name: PARSEC
|
||||||
23
parsec-benchmark/external.mk
Normal file
23
parsec-benchmark/external.mk
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
################################################################################
|
||||||
|
#
|
||||||
|
# PARSEC
|
||||||
|
#
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
PARSEC_VERSION = master
|
||||||
|
PARSEC_SITE = git@github.com:cirosantilli/parsec-benchmark.git
|
||||||
|
PARSEC_SITE_METHOD = git
|
||||||
|
|
||||||
|
define PARSEC_BUILD_CMDS
|
||||||
|
cd $(@D) && . env.sh && for pkg in $(BR2_PACKAGE_PARSEC_BUILD_LIST); do parsecmgmt -a build -p $$pkg; done
|
||||||
|
#cd '$(@D)/gem5/util/m5' && $(MAKE) -f 'Makefile.$(ARCH_MAKE)' CC='$(TARGET_CC)' LD='$(TARGET_LD)'
|
||||||
|
endef
|
||||||
|
|
||||||
|
define PARSEC_INSTALL_TARGET_CMDS
|
||||||
|
# This is a bit coarse and makes the image huge with useless source code,
|
||||||
|
# and input files, but I don't feel like creating per-package installs.
|
||||||
|
# And it doesn't matter much for simulators anyways.
|
||||||
|
rsync -av '$(@D)/' '$(TARGET_DIR)/parsec'
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(generic-package))
|
||||||
1
parsec-benchmark/parsec-benchmark
Submodule
1
parsec-benchmark/parsec-benchmark
Submodule
Submodule parsec-benchmark/parsec-benchmark added at 7ce7fde923
Reference in New Issue
Block a user