rename kernel_module to kernel_modules, start README mass factorings

This commit is contained in:
Ciro Santilli
2018-09-08 07:14:31 +01:00
parent 0a2446edf7
commit a99e041c8a
101 changed files with 558 additions and 430 deletions

File diff suppressed because it is too large Load Diff

19
build
View File

@@ -19,7 +19,7 @@ defaults = {
'kernel_config': [],
'kernel_config_fragment': [],
'kernel_custom_config_file': None,
'kernel_module_reconfigure': False,
'kernel_modules_reconfigure': False,
'linux_reconfigure': False,
'nproc': None,
'skip_configure': False,
@@ -35,8 +35,8 @@ def main(args, extra_args=None):
args = common.resolve_args(defaults, args, extra_args)
os.makedirs(common.out_dir, exist_ok=True)
extra_make_args = shlex.split(args.extra_make_args)
if args.kernel_module_reconfigure:
extra_make_args.append('kernel_module-reconfigure')
if args.kernel_modules_reconfigure:
extra_make_args.append('kernel_modules-reconfigure')
if args.linux_reconfigure:
extra_make_args.append('linux-reconfigure')
if args.gem5:
@@ -190,13 +190,6 @@ def main(args, extra_args=None):
os.symlink(variant_dir, custom_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.
assert common.run_cmd(
[
@@ -228,7 +221,7 @@ def main(args, extra_args=None):
def get_argparse():
parser = common.get_argparse(argparse_args={'description':'Run Linux on an emulator'})
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.
Example value: 'BR2_TARGET_ROOTFS_EXT2_SIZE="512M"'.
Can be used multiple times to add multiple configs.
@@ -236,7 +229,7 @@ Takes precedence over any Buildroot config files.
'''
)
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.
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.'''
)
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'
)
parser.add_argument(

View File

@@ -21,6 +21,14 @@ binaries_dir = os.path.join(common.gem5_system_dir, 'binaries')
disks_dir = os.path.join(common.gem5_system_dir, 'disks')
os.makedirs(binaries_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':
dummy_img_path = os.path.join(disks_dir, 'linux-bigswap2.img')
with open(dummy_img_path, 'wb') as dummy_img_file:

View File

@@ -13,25 +13,27 @@ BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TOOLCHAIN_BUILDROOT_FORTRAN=y
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
# # Rootfs
# BR2_TARGET_ROOTFS_CPIO=n
# BR2_TARGET_ROOTFS_EXT2=y
# BR2_TARGET_ROOTFS_INITRAMFS=n
# 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
# Rootfs
BR2_TARGET_ROOTFS_CPIO=n
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_INITRAMFS=n
BR2_TARGET_ROOTFS_EXT2_SIZE="512M"
# # Custom packages
# BR2_PACKAGE_KERNEL_MODULE=y
# BR2_SAMPLE_PACKAGE=y
# 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
# 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,
# but that package also creates extra configuration files

View File

@@ -383,6 +383,7 @@ common_dir = os.path.join(out_dir, 'common')
submodules_dir = os.path.join(root_dir, 'submodules')
buildroot_src_dir = os.path.join(submodules_dir, 'buildroot')
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')
# Other default variables.

View File

@@ -1,7 +1,7 @@
config BR2_PACKAGE_GEM5
bool "gem5"
help
gem5 system simulator. Only builds the m5 guest instrumentation
tool for now, not the simulator itself.
Only for the m5 guest instrumentation tool of the gem5 system simulator,
does not build the simulator itself.
http://gem5.org

View File

@@ -1 +0,0 @@
name: KERNEL_MODULE

View File

@@ -1,5 +1,5 @@
config BR2_PACKAGE_KERNEL_MODULE
bool "kernel_module"
config BR2_PACKAGE_KERNEL_MODULES
bool "kernel_modules"
depends on BR2_LINUX_KERNEL
help
Linux Kernel Module Cheat.

View File

@@ -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
.PHONY: all clean

View File

@@ -0,0 +1 @@
name: KERNEL_MODULES

View File

@@ -1,24 +1,24 @@
################################################################################
#
# kernel_module
# kernel_modules
#
################################################################################
KERNEL_MODULE_VERSION = 1.0
KERNEL_MODULE_SITE = $(BR2_EXTERNAL_KERNEL_MODULE_PATH)
KERNEL_MODULE_SITE_METHOD = local
KERNEL_MODULES_VERSION = 1.0
KERNEL_MODULES_SITE = $(BR2_EXTERNAL_KERNEL_MODULES_PATH)
KERNEL_MODULES_SITE_METHOD = local
ifeq ($(BR2_PACKAGE_EIGEN),y)
KERNEL_MODULE_DEPENDENCIES += eigen
KERNEL_MODULES_DEPENDENCIES += eigen
endif
ifeq ($(BR2_PACKAGE_LIBDRM),y)
KERNEL_MODULE_DEPENDENCIES += libdrm
KERNEL_MODULES_DEPENDENCIES += libdrm
endif
ifeq ($(BR2_PACKAGE_OPENBLAS),y)
KERNEL_MODULE_DEPENDENCIES += openblas
KERNEL_MODULES_DEPENDENCIES += openblas
endif
define KERNEL_MODULE_BUILD_CMDS
define KERNEL_MODULES_BUILD_CMDS
$(MAKE) -C '$(@D)/user' $(TARGET_CONFIGURE_OPTS) \
BR2_PACKAGE_EIGEN="$(BR2_PACKAGE_EIGEN)" \
BR2_PACKAGE_LIBDRM="$(BR2_PACKAGE_LIBDRM)" \
@@ -26,7 +26,7 @@ define KERNEL_MODULE_BUILD_CMDS
;
endef
define KERNEL_MODULE_INSTALL_TARGET_CMDS
define KERNEL_MODULES_INSTALL_TARGET_CMDS
# The modules are already installed by the kernel-module package type
# under /lib/modules/**, but let's also copy the modules to the root
# for insmod convenience.

View File

@@ -3,7 +3,7 @@
# We can almost do everything from the Makefile itself by using default values for
#
# 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 build breaks, so this is more portable.
@@ -20,5 +20,5 @@ while getopts j: OPT; do
esac
done
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" "$@"

Some files were not shown because too many files have changed in this diff Show More