mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-22 17:55:57 +01:00
build-buildroot: add the --no-overlay option
Initial motivation: modprobe. More to come most likely.
This commit is contained in:
16
README.adoc
16
README.adoc
@@ -3172,9 +3172,7 @@ We are not installing out custom `./build-modules` modules there, because:
|
||||
|
||||
* we don't know the right way. Why is there no `install` or `install_modules` target for kernel modules?
|
||||
+
|
||||
This can of course be solved by running Buildroot in verbose mode, and copying whatever it is doing.
|
||||
+
|
||||
See also: https://askubuntu.com/questions/299676/how-to-install-3rd-party-module-so-that-it-is-loaded-on-boot
|
||||
This can of course be solved by running Buildroot in verbose mode, and copying whatever it is doing, initial exploration at: https://stackoverflow.com/questions/22783793/how-to-install-kernel-modules-from-source-code-error-while-make-process/53169078#53169078
|
||||
* we would have to think how to not have to include the kernel modules twice in the root filesystem, but still have <<9p>> working for fast development as described at: <<your-first-kernel-module-hack>>
|
||||
|
||||
=== kmod
|
||||
@@ -11322,17 +11320,15 @@ A custom build script can give you more flexibility: e.g. the package can be mad
|
||||
|
||||
Source: link:buildroot_packages/kernel_modules/[]
|
||||
|
||||
An example of how to kernel modules in Buildroot.
|
||||
|
||||
Procedure described in detail at: https://stackoverflow.com/questions/40307328/how-to-add-a-linux-kernel-driver-module-as-a-buildroot-package/43874273#43874273
|
||||
An example of how to use kernel modules in Buildroot.
|
||||
|
||||
Usage:
|
||||
|
||||
....
|
||||
rm -rf "$(./getvar out_rootfs_overlay_dir)/lib/modules"
|
||||
./build-buildroot \
|
||||
--build-linux \
|
||||
--config 'BR2_PACKAGE_KERNEL_MODULES=y' \
|
||||
--no-overlay \
|
||||
-- \
|
||||
kernel_modules-reconfigure \
|
||||
;
|
||||
@@ -11346,10 +11342,14 @@ Then test one of the modules with:
|
||||
|
||||
Source: link:buildroot_packages/kernel_modules/buildroot_hello.c[]
|
||||
|
||||
The `rm -rf` is required otherwise our `modules.order` generated by `./build-linux` and installed with `BR2_ROOTFS_OVERLAY` overwrites the Buildroot generated one.
|
||||
As you have just seen, this sets up everything so that <<modprobe>> can conrrectly find the module.
|
||||
|
||||
`./build-buildroot --build-linux` and `./run --buildroot-linux` are needed because the Buildroot kernel modules must use the Buildroot Linux kernel at build and run time.
|
||||
|
||||
The `--no-overlay` is required otherwise our `modules.order` generated by `./build-linux` and installed with `BR2_ROOTFS_OVERLAY` overwrites the Buildroot generated one.
|
||||
|
||||
Implementattion described at: https://stackoverflow.com/questions/40307328/how-to-add-a-linux-kernel-driver-module-as-a-buildroot-package/43874273#43874273
|
||||
|
||||
==== patches directory
|
||||
|
||||
===== patches/global
|
||||
|
||||
@@ -46,6 +46,15 @@ Pass multiple times to use multiple fragment files.
|
||||
help='''\
|
||||
Don't build the all target which normally gets build by default.
|
||||
That target builds the root filesystem and all its dependencies.
|
||||
'''
|
||||
)
|
||||
parser.add_argument(
|
||||
'--no-overlay', default=self._defaults['no_all'], action='store_true',
|
||||
help='''\
|
||||
Don't add our overlay which contains all files we build without going through Buildroot.
|
||||
This prevents us from overwriting certain Buildroot files. Remember however that you must
|
||||
still rebuild the Buildroot package that provides those files to actually put the Buildroot
|
||||
files on the root filesystem.
|
||||
'''
|
||||
)
|
||||
parser.add_argument(
|
||||
@@ -106,9 +115,6 @@ usually extra Buildroot targets.
|
||||
'BR2_PACKAGE_OVERRIDE_FILE="{}"'.format(
|
||||
self._path_relative_to_buildroot(os.path.join(common.root_dir, 'buildroot_override'))
|
||||
),
|
||||
'BR2_ROOTFS_OVERLAY="{}"'.format(
|
||||
self._path_relative_to_buildroot(common.out_rootfs_overlay_dir),
|
||||
),
|
||||
'BR2_ROOTFS_POST_BUILD_SCRIPT="{}"'.format(
|
||||
self._path_relative_to_buildroot(os.path.join(common.root_dir, 'rootfs-post-build-script'))
|
||||
),
|
||||
@@ -116,6 +122,10 @@ usually extra Buildroot targets.
|
||||
self._path_relative_to_buildroot(os.path.join(common.root_dir, 'user_table'))
|
||||
),
|
||||
])
|
||||
if not args.no_overlay:
|
||||
configs.append('BR2_ROOTFS_OVERLAY="{}"'.format(
|
||||
self._path_relative_to_buildroot(common.out_rootfs_overlay_dir)
|
||||
))
|
||||
config_fragments = [
|
||||
os.path.join(common.root_dir, 'buildroot_config', 'default')
|
||||
] + args.config_fragment
|
||||
|
||||
@@ -2,4 +2,4 @@ config BR2_PACKAGE_KERNEL_MODULES
|
||||
bool "kernel_modules"
|
||||
depends on BR2_LINUX_KERNEL
|
||||
help
|
||||
https://github.com/cirosantilli/linux-kernel-module-cheat#kernel_modules-package
|
||||
See README.adoc
|
||||
|
||||
1
buildroot_packages/kernel_modules/README.adoc
Normal file
1
buildroot_packages/kernel_modules/README.adoc
Normal file
@@ -0,0 +1 @@
|
||||
https://github.com/cirosantilli/linux-kernel-module-cheat#kernel_modules-package
|
||||
Reference in New Issue
Block a user