Followed Steps
Add module to the menuconfig:
cd kernel/arpi/drivers/invcase/
# Invcase Device configuration
menuconfig INVCASE
tristate "Inverse Characters Case"
default y
help
Say Y to include this module
Say N will not build this module
Say M to build this module but not include to kernel yet
Append invcase to list of menu (kernel/arpi/drivers/Kconfig):
+ source "drivers/invcase/Kconfig"
Add module to Makefile:
kernel/arpi/drivers/invcase/Makefile or kernel/arpi/drivers/invcase/Kbuild
obj-$(CONFIG_INVCASE) += invcase.o
Append invcase to list of modules:
kernel/arpi/drivers/Kbuild or kernel/arpi/drivers/Makefile
+ obj-$(CONFIG_INVCASE) += invcase/
Build the kernel
cd kernel/arpi
$ export PATH=$HOME/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin:$PATH
$ ARCH=arm64 scripts/kconfig/merge_config.sh \
arch/arm64/configs/bcm2711_defconfig \
kernel/configs/android-base.config \
kernel/configs/android-recommended.config \
../../device/arpi/rpi4/can/linux_mcp2515.config
$ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make Image.gz -j $(nproc)
Change permission
The module is initialized or loaded by root user. Change the permission if needed:
device/arpi/rpi4/init.rpi4.rc
+ on boot
+ chown system system /dev/invcase
+ chmod 0600 /dev/invcase
Rebuild system image to include new module:
Note to change the kernel images and modules which is used for making AOSP system image. Follow the guide "Include custom kernel" for more details.
Build AOSP:
m all -j$(nproc)
Problem is that the module I am building is being built successfully but When try to check the wether kernel intialized successfully or not with this command ls -l /dev/invcase
, it shows that file not found.