mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
Debufs on fstab, go back to tty login to have job control, prepare target makefile for multiple progs
This commit is contained in:
@@ -10,6 +10,7 @@ First build will take a while (GCC, Linux kernel).
|
||||
|
||||
QEMU opens up, and you can run:
|
||||
|
||||
root
|
||||
insmod /hello.ko
|
||||
insmod /hello2.ko
|
||||
rmmod hello
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
CC = gcc
|
||||
|
||||
.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 '$@' '$<'
|
||||
|
||||
clean:
|
||||
rm ins_rm_mod
|
||||
rm -f *'$(OUT_EXT)'
|
||||
|
||||
Binary file not shown.
@@ -1,6 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
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
|
||||
insmod /debugfs.ko
|
||||
cd /debugfs/kernel_module_cheat
|
||||
|
||||
9
rootfs_overlay/etc/fstab
Normal file
9
rootfs_overlay/etc/fstab
Normal 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
|
||||
@@ -7,8 +7,8 @@
|
||||
::sysinit:/bin/hostname -F /etc/hostname
|
||||
::sysinit:/etc/init.d/rcS
|
||||
# https://unix.stackexchange.com/questions/299408/how-to-login-automatically-without-typing-root-in-buildroot-x86-64-qemu
|
||||
console::respawn:/bin/sh
|
||||
#console::respawn:/sbin/getty -n -L console 0 vt100
|
||||
#console::respawn:/bin/sh
|
||||
console::respawn:/sbin/getty -n -L console 0 vt100
|
||||
::ctrlaltdel:/sbin/reboot
|
||||
::shutdown:/etc/init.d/rcK
|
||||
::shutdown:/sbin/swapoff -a
|
||||
|
||||
Reference in New Issue
Block a user