Debufs on fstab, go back to tty login to have job control, prepare target makefile for multiple progs

This commit is contained in:
Ciro Santilli
2017-05-20 07:45:37 +01:00
parent f367ffc6cf
commit 3cb4d0bf28
6 changed files with 24 additions and 5 deletions

View File

@@ -10,6 +10,7 @@ First build will take a while (GCC, Linux kernel).
QEMU opens up, and you can run: QEMU opens up, and you can run:
root
insmod /hello.ko insmod /hello.ko
insmod /hello2.ko insmod /hello2.ko
rmmod hello rmmod hello

View File

@@ -1,9 +1,16 @@
CC = gcc
.PHONY: clean .PHONY: clean
ins_rm_mod: ins_rm_mod.c CC ?= gcc
IN_EXT ?= .c
OUT_EXT ?= .out
OUTS := $(addsuffix $(OUT_EXT), $(basename $(wildcard *$(IN_EXT))))
all: $(OUTS)
%$(OUT_EXT): %$(IN_EXT)
$(CC) -o '$@' '$<' $(CC) -o '$@' '$<'
clean: clean:
rm ins_rm_mod rm -f *'$(OUT_EXT)'

Binary file not shown.

View File

@@ -1,6 +1,8 @@
#!/bin/sh #!/bin/sh
set -ex set -ex
mkdir -p /debugfs mkdir -p /debugfs
# We also added a fstab entry that mounts this under /sys/kernel/debug autmoatically.
# That is the most common place to mount it.
mount -t debugfs none /debugfs mount -t debugfs none /debugfs
insmod /debugfs.ko insmod /debugfs.ko
cd /debugfs/kernel_module_cheat cd /debugfs/kernel_module_cheat

9
rootfs_overlay/etc/fstab Normal file
View File

@@ -0,0 +1,9 @@
# <file system> <mount pt> <type> <options> <dump> <pass>
/dev/root / ext2 rw,noauto 0 1
proc /proc proc defaults 0 0
devpts /dev/pts devpts defaults,gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs mode=0777 0 0
tmpfs /tmp tmpfs mode=1777 0 0
tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0
sysfs /sys sysfs defaults 0 0
debugfs /sys/kernel/debug debugfs defaults 0 0

View File

@@ -7,8 +7,8 @@
::sysinit:/bin/hostname -F /etc/hostname ::sysinit:/bin/hostname -F /etc/hostname
::sysinit:/etc/init.d/rcS ::sysinit:/etc/init.d/rcS
# https://unix.stackexchange.com/questions/299408/how-to-login-automatically-without-typing-root-in-buildroot-x86-64-qemu # https://unix.stackexchange.com/questions/299408/how-to-login-automatically-without-typing-root-in-buildroot-x86-64-qemu
console::respawn:/bin/sh #console::respawn:/bin/sh
#console::respawn:/sbin/getty -n -L console 0 vt100 console::respawn:/sbin/getty -n -L console 0 vt100
::ctrlaltdel:/sbin/reboot ::ctrlaltdel:/sbin/reboot
::shutdown:/etc/init.d/rcK ::shutdown:/etc/init.d/rcK
::shutdown:/sbin/swapoff -a ::shutdown:/sbin/swapoff -a