mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-27 04:01:36 +01:00
rename kernel_module to kernel_modules, start README mass factorings
This commit is contained in:
886
README.adoc
886
README.adoc
File diff suppressed because it is too large
Load Diff
19
build
19
build
@@ -19,7 +19,7 @@ defaults = {
|
|||||||
'kernel_config': [],
|
'kernel_config': [],
|
||||||
'kernel_config_fragment': [],
|
'kernel_config_fragment': [],
|
||||||
'kernel_custom_config_file': None,
|
'kernel_custom_config_file': None,
|
||||||
'kernel_module_reconfigure': False,
|
'kernel_modules_reconfigure': False,
|
||||||
'linux_reconfigure': False,
|
'linux_reconfigure': False,
|
||||||
'nproc': None,
|
'nproc': None,
|
||||||
'skip_configure': False,
|
'skip_configure': False,
|
||||||
@@ -35,8 +35,8 @@ def main(args, extra_args=None):
|
|||||||
args = common.resolve_args(defaults, args, extra_args)
|
args = common.resolve_args(defaults, args, extra_args)
|
||||||
os.makedirs(common.out_dir, exist_ok=True)
|
os.makedirs(common.out_dir, exist_ok=True)
|
||||||
extra_make_args = shlex.split(args.extra_make_args)
|
extra_make_args = shlex.split(args.extra_make_args)
|
||||||
if args.kernel_module_reconfigure:
|
if args.kernel_modules_reconfigure:
|
||||||
extra_make_args.append('kernel_module-reconfigure')
|
extra_make_args.append('kernel_modules-reconfigure')
|
||||||
if args.linux_reconfigure:
|
if args.linux_reconfigure:
|
||||||
extra_make_args.append('linux-reconfigure')
|
extra_make_args.append('linux-reconfigure')
|
||||||
if args.gem5:
|
if args.gem5:
|
||||||
@@ -190,13 +190,6 @@ def main(args, extra_args=None):
|
|||||||
os.symlink(variant_dir, custom_dir)
|
os.symlink(variant_dir, custom_dir)
|
||||||
symlink_buildroot_variant(common.linux_build_dir, common.linux_variant_dir)
|
symlink_buildroot_variant(common.linux_build_dir, common.linux_variant_dir)
|
||||||
|
|
||||||
## Manage gem5 variants.
|
|
||||||
#if "$common_gem5"; then
|
|
||||||
# if [ ! -e "${common_gem5_src_dir}/.git" ]; then
|
|
||||||
# git -C "$common_gem5_default_src_dir" worktree add -b "wt/${common_gem5_variant}" "${common_gem5_src_dir}"
|
|
||||||
# fi
|
|
||||||
#fi
|
|
||||||
|
|
||||||
# Do the actual build.
|
# Do the actual build.
|
||||||
assert common.run_cmd(
|
assert common.run_cmd(
|
||||||
[
|
[
|
||||||
@@ -228,7 +221,7 @@ def main(args, extra_args=None):
|
|||||||
def get_argparse():
|
def get_argparse():
|
||||||
parser = common.get_argparse(argparse_args={'description':'Run Linux on an emulator'})
|
parser = common.get_argparse(argparse_args={'description':'Run Linux on an emulator'})
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-B', '--br2-config', default=defaults['buildroot_config'], action='append',
|
'-B', '--buildroot-config', default=defaults['buildroot_config'], action='append',
|
||||||
help='''Add a single Buildroot config to the current build.
|
help='''Add a single Buildroot config to the current build.
|
||||||
Example value: 'BR2_TARGET_ROOTFS_EXT2_SIZE="512M"'.
|
Example value: 'BR2_TARGET_ROOTFS_EXT2_SIZE="512M"'.
|
||||||
Can be used multiple times to add multiple configs.
|
Can be used multiple times to add multiple configs.
|
||||||
@@ -236,7 +229,7 @@ Takes precedence over any Buildroot config files.
|
|||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-b', '--br2-config-fragment', default=defaults['buildroot_config_fragment'], action='append',
|
'-b', '--buildroot-config-fragment', default=defaults['buildroot_config_fragment'], action='append',
|
||||||
help='''Also use the given Buildroot configuration fragment file.
|
help='''Also use the given Buildroot configuration fragment file.
|
||||||
Pass multiple times to use multiple fragment files.'''
|
Pass multiple times to use multiple fragment files.'''
|
||||||
)
|
)
|
||||||
@@ -274,7 +267,7 @@ but requires you to know what you are doing :-)'''
|
|||||||
Still uses options explicitly passed with `-C` and `-c` on top of it.'''
|
Still uses options explicitly passed with `-C` and `-c` on top of it.'''
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-k', '--kernel-module-reconfigure', default=defaults['kernel_module_reconfigure'], action='store_true',
|
'-k', '--kernel-modules-reconfigure', default=defaults['kernel_modules_reconfigure'], action='store_true',
|
||||||
help='Reconfigure and rebuild the kernel modules'
|
help='Reconfigure and rebuild the kernel modules'
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
|||||||
@@ -21,6 +21,14 @@ binaries_dir = os.path.join(common.gem5_system_dir, 'binaries')
|
|||||||
disks_dir = os.path.join(common.gem5_system_dir, 'disks')
|
disks_dir = os.path.join(common.gem5_system_dir, 'disks')
|
||||||
os.makedirs(binaries_dir, exist_ok=True)
|
os.makedirs(binaries_dir, exist_ok=True)
|
||||||
os.makedirs(disks_dir, exist_ok=True)
|
os.makedirs(disks_dir, exist_ok=True)
|
||||||
|
if not os.path.exists(os.path.join(common.gem5_src_dir, '.git')):
|
||||||
|
subprocess.check_call([
|
||||||
|
'git',
|
||||||
|
'-C', common.gem5_default_src_dir,
|
||||||
|
'worktree', 'add',
|
||||||
|
'-b', os.path.join('wt', args.gem5_build_id),
|
||||||
|
common.gem5_src_dir
|
||||||
|
])
|
||||||
if args.arch == 'x86_64':
|
if args.arch == 'x86_64':
|
||||||
dummy_img_path = os.path.join(disks_dir, 'linux-bigswap2.img')
|
dummy_img_path = os.path.join(disks_dir, 'linux-bigswap2.img')
|
||||||
with open(dummy_img_path, 'wb') as dummy_img_file:
|
with open(dummy_img_path, 'wb') as dummy_img_file:
|
||||||
|
|||||||
@@ -13,25 +13,27 @@ BR2_TOOLCHAIN_BUILDROOT_CXX=y
|
|||||||
BR2_TOOLCHAIN_BUILDROOT_FORTRAN=y
|
BR2_TOOLCHAIN_BUILDROOT_FORTRAN=y
|
||||||
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
|
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
|
||||||
|
|
||||||
# # Rootfs
|
# Rootfs
|
||||||
# BR2_TARGET_ROOTFS_CPIO=n
|
BR2_TARGET_ROOTFS_CPIO=n
|
||||||
# BR2_TARGET_ROOTFS_EXT2=y
|
BR2_TARGET_ROOTFS_EXT2=y
|
||||||
# BR2_TARGET_ROOTFS_INITRAMFS=n
|
BR2_TARGET_ROOTFS_INITRAMFS=n
|
||||||
# BR2_TARGET_ROOTFS_EXT2_SIZE="512M"
|
BR2_TARGET_ROOTFS_EXT2_SIZE="512M"
|
||||||
#
|
|
||||||
# # Host GDB
|
|
||||||
# BR2_GDB_VERSION="7.11.1"
|
|
||||||
# BR2_GDB_VERSION_7_10=n
|
|
||||||
# BR2_GDB_VERSION_7_11=y
|
|
||||||
# BR2_GDB_VERSION_7_12=n
|
|
||||||
# BR2_PACKAGE_HOST_GDB=y
|
|
||||||
# BR2_PACKAGE_HOST_GDB_PYTHON=y
|
|
||||||
# BR2_PACKAGE_HOST_GDB_SIM=y
|
|
||||||
# BR2_PACKAGE_HOST_GDB_TUI=y
|
|
||||||
|
|
||||||
# # Custom packages
|
# Host GDB
|
||||||
# BR2_PACKAGE_KERNEL_MODULE=y
|
BR2_GDB_VERSION="7.11.1"
|
||||||
# BR2_SAMPLE_PACKAGE=y
|
BR2_GDB_VERSION_7_10=n
|
||||||
|
BR2_GDB_VERSION_7_11=y
|
||||||
|
BR2_GDB_VERSION_7_12=n
|
||||||
|
BR2_PACKAGE_HOST_GDB=y
|
||||||
|
BR2_PACKAGE_HOST_GDB_PYTHON=y
|
||||||
|
BR2_PACKAGE_HOST_GDB_SIM=y
|
||||||
|
BR2_PACKAGE_HOST_GDB_TUI=y
|
||||||
|
|
||||||
|
# Custom packages
|
||||||
|
# Keepding those in because we control them fully
|
||||||
|
# and know for sure that are small.
|
||||||
|
BR2_PACKAGE_KERNEL_MODULES=y
|
||||||
|
BR2_SAMPLE_PACKAGE=y
|
||||||
|
|
||||||
# We were tempted to do this to disable S40network neatly,
|
# We were tempted to do this to disable S40network neatly,
|
||||||
# but that package also creates extra configuration files
|
# but that package also creates extra configuration files
|
||||||
|
|||||||
@@ -383,6 +383,7 @@ common_dir = os.path.join(out_dir, 'common')
|
|||||||
submodules_dir = os.path.join(root_dir, 'submodules')
|
submodules_dir = os.path.join(root_dir, 'submodules')
|
||||||
buildroot_src_dir = os.path.join(submodules_dir, 'buildroot')
|
buildroot_src_dir = os.path.join(submodules_dir, 'buildroot')
|
||||||
gem5_default_src_dir = os.path.join(submodules_dir, 'gem5')
|
gem5_default_src_dir = os.path.join(submodules_dir, 'gem5')
|
||||||
|
linux_src_dir = os.path.join(submodules_dir, 'linux')
|
||||||
qemu_src_dir = os.path.join(submodules_dir, 'qemu')
|
qemu_src_dir = os.path.join(submodules_dir, 'qemu')
|
||||||
|
|
||||||
# Other default variables.
|
# Other default variables.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
config BR2_PACKAGE_GEM5
|
config BR2_PACKAGE_GEM5
|
||||||
bool "gem5"
|
bool "gem5"
|
||||||
help
|
help
|
||||||
gem5 system simulator. Only builds the m5 guest instrumentation
|
Only for the m5 guest instrumentation tool of the gem5 system simulator,
|
||||||
tool for now, not the simulator itself.
|
does not build the simulator itself.
|
||||||
|
|
||||||
http://gem5.org
|
http://gem5.org
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
name: KERNEL_MODULE
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
config BR2_PACKAGE_KERNEL_MODULE
|
config BR2_PACKAGE_KERNEL_MODULES
|
||||||
bool "kernel_module"
|
bool "kernel_modules"
|
||||||
depends on BR2_LINUX_KERNEL
|
depends on BR2_LINUX_KERNEL
|
||||||
help
|
help
|
||||||
Linux Kernel Module Cheat.
|
Linux Kernel Module Cheat.
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
obj-m += $(addsuffix .o, $(notdir $(basename $(filter-out %.mod.c, $(wildcard $(BR2_EXTERNAL_KERNEL_MODULE_PATH)/*.c)))))
|
obj-m += $(addsuffix .o, $(notdir $(basename $(filter-out %.mod.c, $(wildcard $(BR2_EXTERNAL_KERNEL_MODULES_PATH)/*.c)))))
|
||||||
ccflags-y := -DDEBUG -g -std=gnu99 -Werror -Wno-declaration-after-statement -Wframe-larger-than=1000000000
|
ccflags-y := -DDEBUG -g -std=gnu99 -Werror -Wno-declaration-after-statement -Wframe-larger-than=1000000000
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
1
packages/kernel_modules/external.desc
Normal file
1
packages/kernel_modules/external.desc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
name: KERNEL_MODULES
|
||||||
@@ -1,24 +1,24 @@
|
|||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# kernel_module
|
# kernel_modules
|
||||||
#
|
#
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
KERNEL_MODULE_VERSION = 1.0
|
KERNEL_MODULES_VERSION = 1.0
|
||||||
KERNEL_MODULE_SITE = $(BR2_EXTERNAL_KERNEL_MODULE_PATH)
|
KERNEL_MODULES_SITE = $(BR2_EXTERNAL_KERNEL_MODULES_PATH)
|
||||||
KERNEL_MODULE_SITE_METHOD = local
|
KERNEL_MODULES_SITE_METHOD = local
|
||||||
|
|
||||||
ifeq ($(BR2_PACKAGE_EIGEN),y)
|
ifeq ($(BR2_PACKAGE_EIGEN),y)
|
||||||
KERNEL_MODULE_DEPENDENCIES += eigen
|
KERNEL_MODULES_DEPENDENCIES += eigen
|
||||||
endif
|
endif
|
||||||
ifeq ($(BR2_PACKAGE_LIBDRM),y)
|
ifeq ($(BR2_PACKAGE_LIBDRM),y)
|
||||||
KERNEL_MODULE_DEPENDENCIES += libdrm
|
KERNEL_MODULES_DEPENDENCIES += libdrm
|
||||||
endif
|
endif
|
||||||
ifeq ($(BR2_PACKAGE_OPENBLAS),y)
|
ifeq ($(BR2_PACKAGE_OPENBLAS),y)
|
||||||
KERNEL_MODULE_DEPENDENCIES += openblas
|
KERNEL_MODULES_DEPENDENCIES += openblas
|
||||||
endif
|
endif
|
||||||
|
|
||||||
define KERNEL_MODULE_BUILD_CMDS
|
define KERNEL_MODULES_BUILD_CMDS
|
||||||
$(MAKE) -C '$(@D)/user' $(TARGET_CONFIGURE_OPTS) \
|
$(MAKE) -C '$(@D)/user' $(TARGET_CONFIGURE_OPTS) \
|
||||||
BR2_PACKAGE_EIGEN="$(BR2_PACKAGE_EIGEN)" \
|
BR2_PACKAGE_EIGEN="$(BR2_PACKAGE_EIGEN)" \
|
||||||
BR2_PACKAGE_LIBDRM="$(BR2_PACKAGE_LIBDRM)" \
|
BR2_PACKAGE_LIBDRM="$(BR2_PACKAGE_LIBDRM)" \
|
||||||
@@ -26,7 +26,7 @@ define KERNEL_MODULE_BUILD_CMDS
|
|||||||
;
|
;
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define KERNEL_MODULE_INSTALL_TARGET_CMDS
|
define KERNEL_MODULES_INSTALL_TARGET_CMDS
|
||||||
# The modules are already installed by the kernel-module package type
|
# The modules are already installed by the kernel-module package type
|
||||||
# under /lib/modules/**, but let's also copy the modules to the root
|
# under /lib/modules/**, but let's also copy the modules to the root
|
||||||
# for insmod convenience.
|
# for insmod convenience.
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
# We can almost do everything from the Makefile itself by using default values for
|
# We can almost do everything from the Makefile itself by using default values for
|
||||||
#
|
#
|
||||||
# LINUX_DIR ?= "/lib/modules/$(uname -r)/build"
|
# LINUX_DIR ?= "/lib/modules/$(uname -r)/build"
|
||||||
# BR2_EXTERNAL_KERNEL_MODULE_PATH="$(pwd)"
|
# BR2_EXTERNAL_KERNEL_MODULES_PATH="$(pwd)"
|
||||||
#
|
#
|
||||||
# The problem with that is that if you define those variables in your environment,
|
# The problem with that is that if you define those variables in your environment,
|
||||||
# the build breaks, so this is more portable.
|
# the build breaks, so this is more portable.
|
||||||
@@ -20,5 +20,5 @@ while getopts j: OPT; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $(($OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
make -j "$j" KERNEL_MODULE_PATH="$(pwd)" LINUX_DIR="/lib/modules/$(uname -r)/build" "$@"
|
make -j "$j" KERNEL_MODULES_PATH="$(pwd)" LINUX_DIR="/lib/modules/$(uname -r)/build" "$@"
|
||||||
make -C user/ -j "$j" "$@"
|
make -C user/ -j "$j" "$@"
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user