mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
bak
This commit is contained in:
38
README.adoc
38
README.adoc
@@ -1295,7 +1295,24 @@ In the background, it uses `BR2_TARGET_ROOTFS_INITRAMFS`, and this makes the ker
|
|||||||
|
|
||||||
http://nairobi-embedded.org/initramfs_tutorial.html shows a full manual setup.
|
http://nairobi-embedded.org/initramfs_tutorial.html shows a full manual setup.
|
||||||
|
|
||||||
== ftrace
|
== Linux kernel
|
||||||
|
|
||||||
|
=== Use your own .config
|
||||||
|
|
||||||
|
By default, we use a `.config` that is a mixture of:
|
||||||
|
|
||||||
|
* Buildroot's minimal per machine `.config`, which has the minimal options needed to boot
|
||||||
|
* our link:kernel_config_fragment[] which enables options we want to play with
|
||||||
|
|
||||||
|
If you want to just use your own exact `.config` instead, do:
|
||||||
|
|
||||||
|
....
|
||||||
|
./build -K myconfig
|
||||||
|
....
|
||||||
|
|
||||||
|
Beware that Buildroot can `sed` override some of the configurations we make no matter what, e.g. it forces `CONFIG_BLK_DEV_INITRD=y` when `BR2_TARGET_ROOTFS_CPIO` is on.
|
||||||
|
|
||||||
|
=== ftrace
|
||||||
|
|
||||||
Trace a single function:
|
Trace a single function:
|
||||||
|
|
||||||
@@ -1390,7 +1407,11 @@ TODO: what do `+` and `!` mean?
|
|||||||
|
|
||||||
Each `enable` under the `events/` tree enables a certain set of functions, the higher the `enable` more functions are enabled.
|
Each `enable` under the `events/` tree enables a certain set of functions, the higher the `enable` more functions are enabled.
|
||||||
|
|
||||||
== Snapshot
|
== QEMU
|
||||||
|
|
||||||
|
Some QEMU specific features to play with and limitations to cry over.
|
||||||
|
|
||||||
|
=== Snapshot
|
||||||
|
|
||||||
https://stackoverflow.com/questions/40227651/does-qemu-emulator-have-checkpoint-function/48724371#48724371
|
https://stackoverflow.com/questions/40227651/does-qemu-emulator-have-checkpoint-function/48724371#48724371
|
||||||
|
|
||||||
@@ -1467,10 +1488,6 @@ This is useful to learn:
|
|||||||
|
|
||||||
To get started, have a look at the "Hardware device drivers" section under link:kernel_module/README.adoc[], and try to run those modules, and then grep the QEMU source code.
|
To get started, have a look at the "Hardware device drivers" section under link:kernel_module/README.adoc[], and try to run those modules, and then grep the QEMU source code.
|
||||||
|
|
||||||
== QEMU
|
|
||||||
|
|
||||||
Some QEMU specific features to play with and limitations to cry over.
|
|
||||||
|
|
||||||
=== 9P
|
=== 9P
|
||||||
|
|
||||||
This protocol allows sharing a mountable filesystem between guest and host.
|
This protocol allows sharing a mountable filesystem between guest and host.
|
||||||
@@ -1479,7 +1496,7 @@ With networking, it's boring, we can just use any of the old tools like sshfs an
|
|||||||
|
|
||||||
https://superuser.com/questions/628169/how-to-share-a-directory-with-the-host-without-networking-in-qemu
|
https://superuser.com/questions/628169/how-to-share-a-directory-with-the-host-without-networking-in-qemu
|
||||||
|
|
||||||
One advantage of this method over NFS is that can run without `sudo` on host, or having to pass host cretendials on guest for sshfs.
|
One advantage of this method over NFS is that can run without `sudo` on host, or having to pass host credentials on guest for sshfs.
|
||||||
|
|
||||||
TODO performance compared to NFS.
|
TODO performance compared to NFS.
|
||||||
|
|
||||||
@@ -1541,8 +1558,15 @@ and on `aarch64`:
|
|||||||
mount: mounting host0 on /mnt/my9p failed: Invalid argument
|
mount: mounting host0 on /mnt/my9p failed: Invalid argument
|
||||||
....
|
....
|
||||||
|
|
||||||
|
and dmesg gives:
|
||||||
|
|
||||||
|
....
|
||||||
|
9pnet_virtio: no channels available for device
|
||||||
|
....
|
||||||
|
|
||||||
A few hits:
|
A few hits:
|
||||||
|
|
||||||
|
* https://lists.gnu.org/archive/html/qemu-devel/2013-08/msg00044.html
|
||||||
* https://superuser.com/questions/502205/libvirt-9p-kvm-mount-in-fstab-fails-to-mount-at-boot-time
|
* https://superuser.com/questions/502205/libvirt-9p-kvm-mount-in-fstab-fails-to-mount-at-boot-time
|
||||||
|
|
||||||
==== 9P gem5
|
==== 9P gem5
|
||||||
|
|||||||
28
build
28
build
@@ -8,10 +8,11 @@ config_fragments='buildroot_config_fragment buildroot_config_fragment_cli'
|
|||||||
extra_make_args=''
|
extra_make_args=''
|
||||||
gem5=false
|
gem5=false
|
||||||
j="$(($(nproc) - 2))"
|
j="$(($(nproc) - 2))"
|
||||||
|
linux_kernel_custom_config_file=''
|
||||||
post_script_args=''
|
post_script_args=''
|
||||||
qemu_sdl='--enable-sdl --with-sdlabi=2.0'
|
qemu_sdl='--enable-sdl --with-sdlabi=2.0'
|
||||||
v=0
|
v=0
|
||||||
while getopts 'a:c:Cgj:i:klp:qS:v' OPT; do
|
while getopts 'a:c:Cgj:i:kK:lp:qS:v' OPT; do
|
||||||
case "$OPT" in
|
case "$OPT" in
|
||||||
a)
|
a)
|
||||||
arch="$OPTARG"
|
arch="$OPTARG"
|
||||||
@@ -34,6 +35,9 @@ while getopts 'a:c:Cgj:i:klp:qS:v' OPT; do
|
|||||||
k)
|
k)
|
||||||
extra_make_args="$extra_make_args kernel_module-reconfigure"
|
extra_make_args="$extra_make_args kernel_module-reconfigure"
|
||||||
;;
|
;;
|
||||||
|
K)
|
||||||
|
linux_kernel_custom_config_file="$OPTARG"
|
||||||
|
;;
|
||||||
l)
|
l)
|
||||||
extra_make_args="$extra_make_args linux-reconfigure"
|
extra_make_args="$extra_make_args linux-reconfigure"
|
||||||
;;
|
;;
|
||||||
@@ -83,7 +87,7 @@ config_file="${out_dir}/.config"
|
|||||||
if "$configure"; then
|
if "$configure"; then
|
||||||
cd "${buildroot_dir}"
|
cd "${buildroot_dir}"
|
||||||
for p in $(find "${root_dir}/buildroot_patches/" -maxdepth 1 -name '*.patch' -print); do
|
for p in $(find "${root_dir}/buildroot_patches/" -maxdepth 1 -name '*.patch' -print); do
|
||||||
patch -N -r - -p 1 <"$p" || :
|
patch -N -r - -p 1 <"$p" || :
|
||||||
done
|
done
|
||||||
make O="$out_dir" BR2_EXTERNAL="${root_dir}/kernel_module:${root_dir}/gem5:${root_dir}/parsec-benchmark" "$defconfig"
|
make O="$out_dir" BR2_EXTERNAL="${root_dir}/kernel_module:${root_dir}/gem5:${root_dir}/parsec-benchmark" "$defconfig"
|
||||||
# TODO Can't get rid of these for now.
|
# TODO Can't get rid of these for now.
|
||||||
@@ -96,20 +100,26 @@ BR2_JLEVEL=$j
|
|||||||
BR2_ROOTFS_POST_SCRIPT_ARGS=\"$post_script_args\"
|
BR2_ROOTFS_POST_SCRIPT_ARGS=\"$post_script_args\"
|
||||||
" >> "${config_file}"
|
" >> "${config_file}"
|
||||||
if "$gem5"; then
|
if "$gem5"; then
|
||||||
printf "\
|
if [ -z "$linux_kernel_custom_config_file" ]; then
|
||||||
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE=\"../kernel_config_${arch_dir}\"
|
printf "BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE=\"../kernel_config_${arch_dir}\"" >> "${config_file}"
|
||||||
BR2_PACKAGE_GEM5=y
|
fi
|
||||||
" >> "${config_file}"
|
printf "BR2_PACKAGE_GEM5=\"../kernel_config_${arch_dir}\"" >> "${config_file}"
|
||||||
else
|
else
|
||||||
printf "\
|
if [ -z "$linux_kernel_custom_config_file" ]; then
|
||||||
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES=\"../kernel_config_fragment\"
|
printf "BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES=\"../kernel_config_fragment\"" >> "${config_file}"
|
||||||
" >> "${config_file}"
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$arch" = 'mips64' ]; then
|
if [ "$arch" = 'mips64' ]; then
|
||||||
# Workaround for:
|
# Workaround for:
|
||||||
# http://lists.busybox.net/pipermail/buildroot/2017-August/201053.html
|
# http://lists.busybox.net/pipermail/buildroot/2017-August/201053.html
|
||||||
sed -Ei 's/^BR2_PACKAGE_LINUX_TOOLS_GPIO/BR2_PACKAGE_LINUX_TOOLS_GPIO=n/' "${config_file}"
|
sed -Ei 's/^BR2_PACKAGE_LINUX_TOOLS_GPIO/BR2_PACKAGE_LINUX_TOOLS_GPIO=n/' "${config_file}"
|
||||||
fi
|
fi
|
||||||
|
# TODO why is this needed. Otherwise kernel .config does not change, even though Buildroot
|
||||||
|
# .config did due to -K. even if we are running linux-kernel-reconfigure!
|
||||||
|
rm -f "${out_dir}/build/linux-custom/.config"
|
||||||
|
if [ -n "$linux_kernel_custom_config_file" ]; then
|
||||||
|
printf "BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE=\"../${linux_kernel_custom_config_file}\"" >> "${config_file}"
|
||||||
|
fi
|
||||||
make O="$out_dir" olddefconfig
|
make O="$out_dir" olddefconfig
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
# Changes to this file are automatically trigger kernel reconfigures
|
# Changes to this file are automatically trigger kernel reconfigures
|
||||||
# even without using the linux-reconfigure target.
|
# even without using the linux-reconfigure target.
|
||||||
#
|
|
||||||
# Beware that buildroot can override some of the configurations we make, e.g.
|
|
||||||
# it forces CONFIG_BLK_DEV_INITRD=y when BR2_TARGET_ROOTFS_CPIO is on.
|
|
||||||
|
|
||||||
CONFIG_MODULE_SRCVERSION_ALL=y
|
CONFIG_MODULE_SRCVERSION_ALL=y
|
||||||
CONFIG_BLK_DEV_INITRD=y
|
CONFIG_BLK_DEV_INITRD=y
|
||||||
@@ -69,13 +66,16 @@ CONFIG_NET_9P=y
|
|||||||
CONFIG_NET_9P_DEBUG=y
|
CONFIG_NET_9P_DEBUG=y
|
||||||
CONFIG_NET_9P_VIRTIO=y
|
CONFIG_NET_9P_VIRTIO=y
|
||||||
|
|
||||||
## Virtio. TODO: aarch64 hangs before boot if I do all of these.
|
## Virtio
|
||||||
|
CONFIG_VIRTIO_PCI=y
|
||||||
|
CONFIG_VFIO_PCI_INTX=y
|
||||||
|
CONFIG_VFIO_PCI_MMAP=y
|
||||||
|
# TODO: aarch64 hangs before boot if I do all of these.
|
||||||
#CONFIG_RPMSG_VIRTIO=y
|
#CONFIG_RPMSG_VIRTIO=y
|
||||||
#CONFIG_VIRTIO_BALLOON=y
|
#CONFIG_VIRTIO_BALLOON=y
|
||||||
#CONFIG_VIRTIO_BLK=y
|
#CONFIG_VIRTIO_BLK=y
|
||||||
#CONFIG_VIRTIO_BLK_SCSI=y
|
#CONFIG_VIRTIO_BLK_SCSI=y
|
||||||
#CONFIG_VIRTIO_INPUT=y
|
#CONFIG_VIRTIO_INPUT=y
|
||||||
#CONFIG_VIRTIO_PCI=y
|
|
||||||
#CONFIG_VIRTIO_VSOCKETS=y
|
#CONFIG_VIRTIO_VSOCKETS=y
|
||||||
|
|
||||||
## Networking
|
## Networking
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
echo "hello S98"
|
echo "hello S98"
|
||||||
if [ -n "$lkmc_eval" ]; then
|
if [ -n "$lkmc_eval" ]; then
|
||||||
|
echo "$lkmc_eval"
|
||||||
eval "$lkmc_eval"
|
eval "$lkmc_eval"
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user