1、下载源码
2、安装附加包:sudo apt-get install libncurses-dev
3、解压源码
4、make menuconfig
5、make bzImage(在boot下名称是vmlinuz)
6、make modules
7、sudo make install
8、sudo make modules install   (在/lib/modules/)
9、sudo mkmitamfs
在/grub下的grub.cfg可以修改启动顺序


添加模块:
在源码所在目录中的drivers目录中新建文件(设为wangfangyong)并生成目录树(在目录下创建的有:cup目录(创建cup.c) test.c  test_net.c  usr.c),在wangfangyong目录中创建Makefile和Kconfig
在drivers/Kcongfig中增加source "drivers/wangfangyong/Kconfig"
在drivers/Makefile中增加obj-y      +=wangfangyong/
在 wangfangyong/Kconfig中增加:
menu "wangfangyong Driver"
config test
    bool "test support"
config usr
    tristate "test-space Interface"
       depends on test
endmenu
在wangfangyong/Makefile中增加:
  1 obj-$(CONFIG_TEST)+=test.o test_net.o
  2 obj-$(CONFIG_TEST_USR)+=usr.o
  3 obj-$(CONFIG_TEST_CPU)+=cpu/
现在在cup目录中创建Kconfig和Makefile
在Kconfig中增加:
menu "cup "
  config TEST_CUP
  bool "test cup"
  depends on test
endmenu
在Makefile中增加:
obj-$(CONFIG_TEST_CUP)+=cpu.o
现在在/drivers下编译make menuconfig后不会出现cup菜单,现在在上级目录wangfangyongzhong
中修改wangfangyong中的Kconfig和Makefile
在Kconfig中增加:
#cpu config
 source "drivers/wangfangyong/cup/Kconfig"
#end cup
在Makefile中增加:
obj-y  +=cup/
现在在/drivers下编译make menuconfig后就会出现cup菜单了。

相关文章:

  • 2022-12-23
  • 2021-09-07
  • 2021-12-14
  • 2021-08-14
  • 2021-12-02
  • 2021-12-06
  • 2022-02-08
  • 2022-03-08
猜你喜欢
  • 2021-08-13
  • 2021-12-19
  • 2022-01-27
  • 2021-08-17
  • 2022-01-13
  • 2021-09-19
  • 2022-12-23
相关资源
相似解决方案