移植Linux操作系统时候遇到的问题

    xiaoxiao2022-07-16  134

     1.Kernel panic - not syncing: Attempted to kill init!

      上网搜索了一些相关信息,找到了解决问题的途径。 原因在于:编译内核和busybox使用的编译器是arm-linux-gcc 4.3.2,而这个编译器默认是打开“EABI选项”的,这样编译出来的busybox就是EABI的。但是内核编译的时候,默认是把“EABI选项”关掉的。所以busybox和内核无法正常配合。把“EABI选项”打开,重新编译内核后,一切正常。

      Kernel Features  --->

      [*] Use the ARM EABI to compile the kernel

      [*]   Allow old ABI binaries to run with this kernel (EXPERIMENTAL) (NEW)

      ---------------------------------------------------------------------------------

      2.启动时提示:cannot run '/etc/init.d/rcS': Permission denied

      RAMDISK: gzip image found at block 0

      VFS: Mounted root (ext2 filesystem) on device 1:0.

      Freeing init memory: 120K

      cannot run '/etc/init.d/rcS': Permission denied

      (none) login:

      ---rcS需要有执行权限,chmod 777 rcS后就好了。

      ------------------------------------------------------------------------

      3.启动时提示输入登录用户及密码:(none) login:

      RAMDISK: gzip image found at block 0

      VFS: Mounted root (ext2 filesystem) on device 1:0.

      Freeing init memory: 120K

      (none) login:

      -----要求登录认证,我把inittab里的::respawn:-/bin/sh去掉之后就没有了

      --------------------------------------------------------------------------------

      4.提法不能运行文件,是因为shell脚本有非法字符(肉眼看不到,其实不是空格)

      RAMDISK: gzip image found at block 0

      VFS: Mounted root (ext2 filesystem) on device 1:0.

      Freeing init memory: 120K

      cannot run '/etc/init.d/rcS': No such file or directory

      --------rcS是shell脚本文件,我是从网上拷的,所以在行尾可能有多余的非法字符,手动输入后,就开始执行rcS文件的内容了。

      --------------------------------------------------------------------

      5.进不了shell,呈死机状态

      ::askfirst:/bin/sh

      我在inittab里加上这一句就好了。

     6.有两个文件找不到:

      mount: mounting tmpfs on /dev/shm failed: No such file or directory

      mount: mounting devpts on /dev/pts failed: No such file or directory

      我们之前建立文件系统的目录结构的时候没有建立这两个目录,重新建一下就好了。

      ---------------------------------------------------------------------------

      7.出现提示:/bin/sh: can't access tty; job control turned off

      Please press Enter to activate this console.

      /bin/sh: can't access tty; job control turned off

      其实只要有这个-表示该shell是login shell就行了。busybox inittab的id字段是用来标识tty的,如果没有明确指明就是tty1即console。

      把::askfirst:/bin/sh改为:::askfirst:-/bin/sh

      可以看看busybox的examples目录下的例子就明白了。

      ----------------------------------------------------------------

      8.通过启启信息发现,profile文件没有执行

      ::askfirst:/bin/sh加了“-”之后,没有执行profile文件的问题也解决了。

      -----------------------------------------------------------------

      9.在busybox里设置setenv时,分号“;"输入之后,后面的内容就设置不到环境变量里。

      解决方法是:在分号前加反斜杠"\"!

      算是一个有用的小技巧吧   

    最新内容请见作者的GitHub页:http://qaseven.github.io/

       

    相关资源:敏捷开发V1.0.pptx
    最新回复(0)