arm linux kernel编译问题总结

1 make menuconfig报错

guang@guang-kylin:~/Develop/linux-stable$ make menuconfig
HOSTCC scripts/basic/fixdep
* Unable to find the ncurses libraries or the
* required header files.
* ‘make menuconfig’ requires the ncurses libraries.linux


* Install ncurses (ncurses-devel or libncurses-dev
* depending on your distribution) and try again.web


scripts/kconfig/Makefile:219: recipe for target ‘scripts/kconfig/dochecklxdialog’ failed
make[1]: * [scripts/kconfig/dochecklxdialog] Error 1
Makefile:528: recipe for target ‘menuconfig’ failed
make: * [menuconfig] Error 2
guang@guang-kylin:~/Develop/linux-stable$ express

解决,安装ncurses:

sudo apt install ncurses-devubuntu

3 busybox执行 make menuconfig报错

guang@guang-ubuntu:~/Develop/busybox$ make menuconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/basic/split-include
scripts/basic/split-include.c: In function ‘main’:
scripts/basic/split-include.c:134:6: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
fgets(old_line, buffer_size, fp_target);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HOSTCC scripts/basic/docproc
HOSTCC scripts/kconfig/conf.o
scripts/kconfig/conf.c: In function ‘conf_askvalue’:
scripts/kconfig/conf.c:145:3: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
fgets(line, 128, stdin);
^~~~~~~~~~~~~~~~~~~
scripts/kconfig/conf.c: In function ‘conf_choice’:
scripts/kconfig/conf.c:393:4: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
fgets(line, 128, stdin);
^~~~~~~~~~~~~~~~~~~
HOSTCC scripts/kconfig/kxgettext.o
HOSTCC scripts/kconfig/mconf.o
scripts/kconfig/mconf.c: In function ‘show_textbox’:
scripts/kconfig/mconf.c:847:2: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write(fd, text, strlen(text));
^~~~~~~~~~~~~~~~~~~~~~~~~
scripts/kconfig/mconf.c: In function ‘exec_conf’:
scripts/kconfig/mconf.c:481:2: warning: ignoring return value of ‘pipe’, declared with attribute warn_unused_result [-Wunused-result]
pipe(pipefd);
^~~~~~~~
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/mconf
HOSTCC scripts/kconfig/lxdialog/checklist.o
:0:12: fatal error: curses.h: No such file or directory
compilation terminated.
scripts/Makefile.host:120: recipe for target ‘scripts/kconfig/lxdialog/checklist.o’ failed
make[2]: * [scripts/kconfig/lxdialog/checklist.o] Error 1
/home/guang/Develop/busybox/scripts/kconfig/Makefile:14: recipe for target ‘menuconfig’ failed
make[1]: * [menuconfig] Error 2
Makefile:443: recipe for target ‘menuconfig’ failed
make: * [menuconfig] Error 2dom

解决:

sudo apt-get install libncurses5-dev libncursesw5-devsvg

make menuconfig执行效果以下

这里写图片描述

4 开发板启动过程当中报:can’t run ‘/etc/init.d/rcS’: Permission denied

这里写图片描述

解决:增长rcS可执行权限

guang@arm-vexpress:/ # cd etc/init.d/
guang@arm-vexpress:/etc/init.d # ls
rcS
guang@arm-vexpress:/etc/init.d # ls -al
total 3
drwxr-xr-x 2 0 0 1024 Jun 11 18:26 .
drwxr-xr-x 3 0 0 1024 Jun 11 18:26 ..
-rw-r–r– 1 0 0 328 Jun 11 18:26 rcS
guang@arm-vexpress:/etc/init.d # chmod -R 777 rcS
guang@arm-vexpress:/etc/init.d # ls -al
total 3
drwxr-xr-x 2 0 0 1024 Jun 11 18:26 .
drwxr-xr-x 3 0 0 1024 Jun 11 18:26 ..
-rwxrwxrwx 1 0 0 328 Jun 11 18:26 rcSpost

5 没法重启开发板,报

guang@arm-vexpress:/etc/init.d # reboot
reboot: can’t open ‘/proc’: No such file or directory
VFS: Mounted root (ext3 filesystem) on device 179:0.
Freeing unused kernel memory: 1024K
random: crng init done
mount: mounting proc on /proc failed: No such file or directory
mount: mounting tmpfs on /tmp failed: No such file or directory
mount: mounting sysfs on /sys failed: No such file or directoryflex

mdev: /sys/dev: No such file or directory

Welcome to arm vexpress-a9 board

can’t open /dev/console: No such file or directory
can’t open /dev/console: No such file or directory
can’t open /dev/console: No such file or directory
can’t open /dev/console: No such file or directory
can’t open /dev/console: No such file or directory
can’t open /dev/console: No such file or directoryui

解决:排查了一下,是制做完善rootfs的时候,建立了etc目录,而根目录下对应的proc、mnt、tmp、sys等文件夹忘记建立了,建立了就OK,新增以下文件

这里写图片描述

效果以下

这里写图片描述

6 make编译ko文件报错

guang@guang-ubuntu:~/Develop/trainning/ko_file/20180611$ make
make -C /home/guang/Develop/linux-stable M=/home/guang/Develop/trainning/ko_file/20180611 modules
make[1]: Entering directory ‘/home/guang/Develop/linux-stable’
Building modules, stage 2.
MODPOST 1 modules
/bin/sh: 1: scripts/mod/modpost: not found
scripts/Makefile.modpost:92: recipe for target ‘__modpost’ failed
make[2]: * [__modpost] Error 127
Makefile:1576: recipe for target ‘modules’ failed
make[1]: * [modules] Error 2
make[1]: Leaving directory ‘/home/guang/Develop/linux-stable’
Makefile:17: recipe for target ‘default’ failed
make: * [default] Error 2es5

解决:以下的库能够解决上面相似的大多数问题

sudo apt-get install bison
sudo apt-get install flex

7 make menuconfig报错:

guang@guang-kylin:~/Develop/linux-stable$ make clear
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
YACC scripts/kconfig/zconf.tab.c
/bin/sh: 1: bison: not found
scripts/Makefile.lib:196: recipe for target ‘scripts/kconfig/zconf.tab.c’ failed
make[2]: * [scripts/kconfig/zconf.tab.c] Error 127
Makefile:528: recipe for target ‘syncconfig’ failed
make[1]: * [syncconfig] Error 2
make: * No rule to make target ‘clear’. Stop.
guang@guang-kylin:~/Develop/linux-stable$

解决:

sudo apt-get install bison
sudo apt-get install flex

8 刚下载完成的linux kernel,make clear失败,make clean成功了,还没来得及分析,记录一下:

guang@guang-kylin:~/Develop/linux-stable$ make clear
LEX scripts/kconfig/zconf.lex.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf –syncconfig Kconfig


* Configuration file “.config” not found!


* Please run some configurator (e.g. “make oldconfig” or
* “make menuconfig” or “make xconfig”).


scripts/kconfig/Makefile:40: recipe for target ‘syncconfig’ failed
make[2]: * [syncconfig] Error 1
Makefile:528: recipe for target ‘syncconfig’ failed
make[1]: * [syncconfig] Error 2
make: * No rule to make target ‘clear’. Stop.
guang@guang-kylin:~/Develop/linux-stable$ make clean

guang@guang-kylin:~/Develop/linux-stable$ ls