Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented task07 with procfs module entries #114

Open
wants to merge 8 commits into
base: Valentyn.Korniienko
Choose a base branch
from
12 changes: 12 additions & 0 deletions 07_procfs/07_module_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
dmesg -c
insmod procfs_module.ko
echo "123456" > /sys/kernel/basic_struct/list
cat /sys/kernel/basic_struct/list
echo "1234567890263321564654654654679874964321356" > /sys/kernel/basic_struct/list
echo "Hello world!" > /sys/kernel/basic_struct/list
cat /sys/kernel/basic_struct/list
cat /proc/task07_module_entries/module_author
cat /proc/task07_module_entries/write_requests
cat /proc/task07_module_entries/read_requests
rmmod procfs_module.ko
dmesg
12 changes: 12 additions & 0 deletions 07_procfs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

KERNELDIR ?=/home/valenti/Development/Embedded/exercise8/build_orange_zero_image/build/linux-5.10.10/

ifneq ($(KERNELRELEASE),)
obj-m := procfs_module.o
else

all:
$(MAKE) CFLAGS_MODULE="-DDEBUG " -C $(KERNELDIR) M=$(PWD) modules
clean:
$(MAKE) -C $(KERNELDIR) M=$(PWD) clean
endif
6 changes: 6 additions & 0 deletions 07_procfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@
* Build image for orange pi zero
* Attach console output from your development board


Reference links:
https://elixir.bootlin.com/linux/latest/source/samples/kobject/kobject-example.c#L131
https://elixir.bootlin.com/linux/latest/source/drivers/char/ds1620.c#L396
https://elixir.bootlin.com/linux/latest/source/drivers/staging/rtl8192u/r8192U_core.c#L602
https://elixir.bootlin.com/linux/latest/source/drivers/macintosh/via-pmu.c#L555
22 changes: 22 additions & 0 deletions 07_procfs/module_test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$ sh 07_module_test.sh
[ 310.840684] ==BASIC_STRUCT==:Called list_store with count:7
[ 310.845063] ==BASIC_STRUCT==:Called list_show with copied pointer_offset:7
[ 310.845773] ==BASIC_STRUCT==:Called list_store with count:44
[ 310.845917] ==BASIC_STRUCT==:Called list_store with count:13
[ 310.850309] ==BASIC_STRUCT==:Called list_show with copied pointer_offset:64
[ 310.874785] ==BASIC_STRUCT==:Module unloaded
123456
123456
1234567890263321564654654654679874964321356
Hello world!
Module author: Valentyn Korniienko <[email protected]>
Write requests: 3
Read requests: 2
[ 340.970209] ==BASIC_STRUCT==:Module ready
[ 340.971201] ==BASIC_STRUCT==:Called list_store with count:7
[ 340.975731] ==BASIC_STRUCT==:Called list_show with copied pointer_offset:7
[ 340.976451] ==BASIC_STRUCT==:Called list_store with count:44
[ 340.976597] ==BASIC_STRUCT==:Called list_store with count:13
[ 340.990634] ==BASIC_STRUCT==:Called list_show with copied pointer_offset:64
[ 341.006856] ==BASIC_STRUCT==:Module unloaded
$
Loading