# notes
1. /home/lake/lfs/linux-stable has already built an ARM kernel
2. Use ARM toolchain
lake@lake-Latitude-5491:~$ arm-none-linux-gnueabi-gcc -v
gcc version 4.6.4 (crosstool-NG hg+default-2685dfa9de14 - tc0002)
3. Build kernel first
lake@lake-Latitude-5491:~/lfs/linux-stable$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage LOADADDR=0x40007000
lake@lake-Latitude-5491:~/lfs/linux-stable$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- exynos4412-tiny4412.dtb
lake@lake-Latitude-5491:~/lfs/linux-stable$ cd -
/home/lake/lkm2019/hello_drv
4. Build module
lake@lake-Latitude-5491:~/lkm2019/hello_drv$ cat hello.c
/*
*/
#include <linux/init.h>
#include <linux/module.h>
static int __init hello_drv_init(void)
{
printk("-------%s-------------\n", __FUNCTION__);
return 0;
}
static void __exit hello_drv_exit(void)
{
printk("-------%s-------------\n", __FUNCTION__);
}
module_init(hello_drv_init);
module_exit(hello_drv_exit);
MODULE_LICENSE("GPL");
lake@lake-Latitude-5491:~/lkm2019/hello_drv$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- -C ~/lfs/linux-stable M=`pwd` clean
make: Entering directory '/home/lake/lfs/linux-stable'
CLEAN /home/lake/lkm2019/hello_drv/.tmp_versions
CLEAN /home/lake/lkm2019/hello_drv/Module.symvers
make: Leaving directory '/home/lake/lfs/linux-stable'
lake@lake-Latitude-5491:~/lkm2019/hello_drv$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- -C ~/lfs/linux-stable M=`pwd` modules
make: Entering directory '/home/lake/lfs/linux-stable'
CC [M] /home/lake/lkm2019/hello_drv/hello.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/lake/lkm2019/hello_drv/hello.mod.o
LD [M] /home/lake/lkm2019/hello_drv/hello.ko
make: Leaving directory '/home/lake/lfs/linux-stable'
lake@lake-Latitude-5491:~/lkm2019/hello_drv$
5. Test ARM/Tiny4412/Kernel 4.9.31
NFS boot
[root@tiny4412 /]# cat /proc/version
Linux version 4.9.31-00002-g404487b16963 (lake@lake-Latitude-5491) (gcc version 4.6.4 (crosstool-NG hg+default-2685dfa9de14 - tc0002) ) #4 SMP PREEMPT Fri Mar 22 14:30:43 CST 2019
[root@tiny4412 /]# mount
192.168.1.5:/home/lake/qemu/ramdisk on / type nfs (rw,relatime,vers=3,rsize=4096,wsize=4096,namlen=255,hard,nolock,proto=udp,timeo=11,retrans=3,sec=sys,mountaddr=192.168.1.5,mountvers=3,mountproto=udp,local_lock=all,addr=192.168.1.5)
devtmpf[ 162.955706] dma-pl330 12680000.pdma: Reset Channel-1 CS-20000f FTC-20000
y4412 hello_drv]#
[root@tiny4412 ]# ls
bin home lost+found proc sys var
dev lib mnt root tmp
etc linuxrc nfsmount.sh sbin usr
[root@tiny4412 ]# cat nfsmount.sh
#/bin/sh
mount -t nfs -o nolock 192.168.1.5:/home/lake /home/lake
[root@tiny4412 ]#
[root@tiny4412 ]# sh nfsmount.sh
[root@tiny4412 ]# cd /home/lake/
[root@tiny4412 lake]# ls
Android
Desktop
Documents
vmlinuz-4.19.9
[root@tiny4412 lake]# cd lkm2019/
[root@tiny4412 lkm2019]# ls
FS4412-201705 Hq-FS4412 hello_drv
[root@tiny4412 lkm2019]# cd hello_drv/
[root@tiny4412 hello_drv]# ls
Makefile hello.c hello.mod.c hello.o
Module.symvers hello.ko hello.mod.o modules.order
[root@tiny4412 hello_drv]# insmod hello.ko
[ 127.141057] hello: loading out-of-tree module taints kernel.
[ 127.142462] -------hello_drv_init-------------
[root@tiny4412 hello_drv]# cat /proc/version
Linux version 4.9.31-00002-g404487b16963 (lake@lake-Latitude-5491) (gcc version 4.6.4 (crosstool-NG hg+default-2685dfa9de14 - tc0002) ) #4 SMP PREEMPT Fri Mar 22 14:30:43 CST 2019
[root@tiny4412 hello_drv]#