mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
linux: add --linux-source-dir to have custom linux source dir
This commit is contained in:
36
README.adoc
36
README.adoc
@@ -561,7 +561,7 @@ To modify the Linux kernel, build and use it as usual:
|
||||
For gem5, do:
|
||||
|
||||
....
|
||||
git submodule update --init --depth 1 "$(./getvar linux_src_dir)"
|
||||
git submodule update --init --depth 1 "$(./getvar linux_source_dir)"
|
||||
sudo apt-get install qemu-utils
|
||||
./build-gem5
|
||||
./run --gem5 --prebuilt
|
||||
@@ -3491,14 +3491,14 @@ Overview: https://stackoverflow.com/questions/50364863/how-to-get-graphical-gui-
|
||||
More concretely:
|
||||
|
||||
....
|
||||
git -C "$(./getvar linux_src_dir)" fetch https://gem5.googlesource.com/arm/linux gem5/v4.15:gem5/v4.15
|
||||
git -C "$(./getvar linux_src_dir)" checkout gem5/v4.15
|
||||
git -C "$(./getvar linux_source_dir)" fetch https://gem5.googlesource.com/arm/linux gem5/v4.15:gem5/v4.15
|
||||
git -C "$(./getvar linux_source_dir)" checkout gem5/v4.15
|
||||
./build-linux \
|
||||
--arch arm \
|
||||
--custom-config-file "$(./getvar linux_src_dir)/arch/arm/configs/gem5_defconfig" \
|
||||
--custom-config-file "$(./getvar linux_source_dir)/arch/arm/configs/gem5_defconfig" \
|
||||
--linux-build-id gem5-v4.15 \
|
||||
;
|
||||
git -C "$(./getvar linux_src_dir)" checkout -
|
||||
git -C "$(./getvar linux_source_dir)" checkout -
|
||||
./run --arch arm --gem5 --linux-build-id gem5-v4.15
|
||||
....
|
||||
|
||||
@@ -3566,15 +3566,15 @@ Tested on: link:http://github.com/cirosantilli/linux-kernel-module-cheat/commit/
|
||||
For `aarch64` we also need to configure the kernel with link:linux_config/display[]:
|
||||
|
||||
....
|
||||
git -C "$(./getvar linux_src_dir)" fetch https://gem5.googlesource.com/arm/linux gem5/v4.15:gem5/v4.15
|
||||
git -C "$(./getvar linux_src_dir)" checkout gem5/v4.15
|
||||
git -C "$(./getvar linux_source_dir)" fetch https://gem5.googlesource.com/arm/linux gem5/v4.15:gem5/v4.15
|
||||
git -C "$(./getvar linux_source_dir)" checkout gem5/v4.15
|
||||
./build-linux \
|
||||
--arch aarch64 \
|
||||
--config-fragment linux_config/display \
|
||||
--custom-config-file "$(./getvar linux_src_dir)/arch/arm64/configs/gem5_defconfig" \
|
||||
--custom-config-file "$(./getvar linux_source_dir)/arch/arm64/configs/gem5_defconfig" \
|
||||
--linux-build-id gem5-v4.15 \
|
||||
;
|
||||
git -C "$(./getvar linux_src_dir)" checkout -
|
||||
git -C "$(./getvar linux_source_dir)" checkout -
|
||||
./run --arch aarch64 --gem5 --linux-build-id gem5-v4.15
|
||||
....
|
||||
|
||||
@@ -3590,15 +3590,15 @@ The key option to enable support in Linux is `DRM_MALI_DISPLAY=y` which we enabl
|
||||
|
||||
....
|
||||
./build-linux
|
||||
git -C "$(./getvar linux_src_dir)" fetch https://gem5.googlesource.com/arm/linux gem5/v4.15:gem5/v4.15
|
||||
git -C "$(./getvar linux_src_dir)" checkout gem5/v4.15
|
||||
git -C "$(./getvar linux_source_dir)" fetch https://gem5.googlesource.com/arm/linux gem5/v4.15:gem5/v4.15
|
||||
git -C "$(./getvar linux_source_dir)" checkout gem5/v4.15
|
||||
./build-linux \
|
||||
--arch aarch64 \
|
||||
--config-fragment linux_config/display \
|
||||
--custom-config-file "$(./getvar linux_src_dir)/arch/arm64/configs/gem5_defconfig" \
|
||||
--custom-config-file "$(./getvar linux_source_dir)/arch/arm64/configs/gem5_defconfig" \
|
||||
--linux-build-id gem5-v4.15 \
|
||||
;
|
||||
git -C "$(./getvar linux_src_dir)" checkout -
|
||||
git -C "$(./getvar linux_source_dir)" checkout -
|
||||
./run --arch aarch64 --dp650 --gem5 --linux-build-id gem5-v4.15
|
||||
....
|
||||
|
||||
@@ -4139,7 +4139,7 @@ cat /proc/version
|
||||
or in the source:
|
||||
|
||||
....
|
||||
cd "$(./getvar linux_src_dir)"
|
||||
cd "$(./getvar linux_source_dir)"
|
||||
git log | grep -E ' Linux [0-9]+\.' | head
|
||||
....
|
||||
|
||||
@@ -11415,12 +11415,12 @@ If you want to keep two builds around, one for the latest Linux version, and the
|
||||
./build-linux
|
||||
|
||||
# Build another branch.
|
||||
git -C "$(./getvar linux_src_dir)" fetch --tags --unshallow
|
||||
git -C "$(./getvar linux_src_dir)" checkout v4.16
|
||||
git -C "$(./getvar linux_source_dir)" fetch --tags --unshallow
|
||||
git -C "$(./getvar linux_source_dir)" checkout v4.16
|
||||
./build-linux --linux-build-id v4.16
|
||||
|
||||
# Restore master.
|
||||
git -C "$(./getvar linux_src_dir)" checkout -
|
||||
git -C "$(./getvar linux_source_dir)" checkout -
|
||||
|
||||
# Run master.
|
||||
./run
|
||||
@@ -11921,7 +11921,7 @@ This example is based on the Linux kernel, for which we used to have patches, bu
|
||||
# Last point before out patches.
|
||||
last_mainline_revision=v4.15
|
||||
next_mainline_revision=v4.16
|
||||
cd "$(./getvar linux_src_dir)"
|
||||
cd "$(./getvar linux_source_dir)"
|
||||
|
||||
# Create a branch before the rebase in case things go wrong.
|
||||
git checkout -b "lkmc-${last_mainline_revision}"
|
||||
|
||||
@@ -58,7 +58,7 @@ Configure the kernel, but don't build it.
|
||||
gcc = common.get_toolchain_tool(tool)
|
||||
prefix = gcc[:-len(tool)]
|
||||
common_args = {
|
||||
'cwd': common.linux_src_dir,
|
||||
'cwd': common.linux_source_dir,
|
||||
}
|
||||
ccache = shutil.which('ccache')
|
||||
if ccache is not None:
|
||||
@@ -99,7 +99,7 @@ Configure the kernel, but don't build it.
|
||||
)
|
||||
common.run_cmd(
|
||||
[
|
||||
os.path.join(common.linux_src_dir, 'scripts', 'kconfig', 'merge_config.sh'), common.Newline,
|
||||
os.path.join(common.linux_source_dir, 'scripts', 'kconfig', 'merge_config.sh'), common.Newline,
|
||||
'-m', common.Newline,
|
||||
'-O', build_dir, common.Newline,
|
||||
os.path.join(build_dir, '.config'), common.Newline,
|
||||
|
||||
13
common.py
13
common.py
@@ -48,10 +48,8 @@ submodules_dir = os.path.join(root_dir, 'submodules')
|
||||
buildroot_src_dir = os.path.join(submodules_dir, 'buildroot')
|
||||
crosstool_ng_src_dir = os.path.join(submodules_dir, 'crosstool-ng')
|
||||
crosstool_ng_supported_archs = set(['arm', 'aarch64'])
|
||||
linux_src_dir = os.path.join(submodules_dir, 'linux')
|
||||
linux_config_dir = os.path.join(common.root_dir, 'linux_config')
|
||||
rootfs_overlay_dir = os.path.join(common.root_dir, 'rootfs_overlay')
|
||||
extract_vmlinux = os.path.join(linux_src_dir, 'scripts', 'extract-vmlinux')
|
||||
qemu_src_dir = os.path.join(submodules_dir, 'qemu')
|
||||
parsec_benchmark_src_dir = os.path.join(submodules_dir, 'parsec-benchmark')
|
||||
ccache_dir = os.path.join('/usr', 'lib', 'ccache')
|
||||
@@ -316,6 +314,12 @@ Use the docker download Ubuntu root filesystem instead of the default Buildroot
|
||||
'--linux-build-dir',
|
||||
help='Select the directory that contains the Linux kernel build. Overrides linux-build-id.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--linux-source-dir',
|
||||
help='''\
|
||||
Use the given directory as the Linux source tree.
|
||||
'''
|
||||
)
|
||||
parser.add_argument(
|
||||
'--machine',
|
||||
help='''Machine type.
|
||||
@@ -859,6 +863,11 @@ def setup(parser):
|
||||
common.run_cmd_file = os.path.join(common.run_dir, 'run.sh')
|
||||
|
||||
# Linux
|
||||
if args.linux_source_dir is None:
|
||||
common.linux_source_dir = os.path.join(submodules_dir, 'linux')
|
||||
else:
|
||||
common.linux_source_dir = args.linux_source_dir
|
||||
common.extract_vmlinux = os.path.join(linux_source_dir, 'scripts', 'extract-vmlinux')
|
||||
common.linux_buildroot_build_dir = os.path.join(common.buildroot_build_build_dir, 'linux-custom')
|
||||
if args.linux_build_dir is None:
|
||||
common.linux_build_dir = os.path.join(common.out_dir, 'linux', args.linux_build_id, args.arch)
|
||||
|
||||
Reference in New Issue
Block a user