问题解决办法总结_Failed_to_execute_/linuxrc

本文总结了Linux 2.6.38移植过程中遇到的问题及解决办法,如编译内核时yaffs2报错、移植到开发板后出现data abort错误、系统不能启动、内核启动时执行/linuxrc失败等,还提及了制作文件系统工具及串口驱动编译问题等。

根据网友们遇到的这个共同问题,总结一下各种解决的办法。

遇到这样问题的网友可以根据下面的建议逐个检查。
1. bin/busybox文件是可以执行的。
2. 在配置busybox的时候要选中shell选项中的一个选项
3. linuxrc 是可执行的。
4. 制作文件系统的时候利用的工具也要留意区分:
    mkcramfs                制作cramfs镜像的工具
    mkimage                        制作jffs2镜像的工具
    mkyaffs2image                制作2.6的yaffs2的镜像工具(针对Nand Flash是128MB到1GB的)
    mkyaffsimage                制作2.6.13的yaffs2的镜像工具
    mkyaffsimage_2                制作2.6.25.8或2.6.30.4或更高版本内核的yaffs2的镜像工具(针对Nand Flash是  64MB的)
4. 你使用的是256MB的Nand Flash,而在配置内核的nand时选择ecc校验???(在选择了出现问题,注销了就不出问题了)

在移植linux2.6.38过程中,遇见了很多的问题,通过在网上查阅相关信息和在图书馆不停的查阅资料,终于成功了。下面将移植过程中产生的问题及其解放方法与大家共享一下。

1、编译内核时yaffs2出现unknown field 'clear_inode' specified in initializer的

错误,原因是所下载的yaffs2不支持linux2.6.38.
   解决方法:最新的yaffs2采用git发布,所以采用git工具下载最新的yaffs2源代码。

具体为在终端输入git clone    git://www.aleph1.co.uk/yaffs2下载最新的yaffs2,下

载完成给内核打补丁,进入yaffs目录,执行
 ./patch-ker.sh c m opt/Andy/linux-2.6.38(以自己的内核目录为准),其中的c代表复制,m代表复合类型。

2、移植linux内核到开发板后,出现data abort的错误,错误原因为内核大小超过了2M,

天嵌的Uboot只分配给内核2M的空间,所以报错。
   解决方法:精简内核,使其小于2M。或者修改Uboot,是内核大小大于2M。
所以个人认为天嵌的Uboot值得改进,下一步我将移植Uboot,用自己的Uboot就不存在这个问题了。嘿嘿

3.移植内核时,出现Uncompressing Linux... done, booting the kernel后,系统不能启动,网上好多人说是因为在menuconfig选项中的Boot options中的Default kernel command string中没有设置noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0 rootfs=yaffs2 rw。其实不用设置这个参数也可以,我采用在内核配置文件中将Kernel Feature/Provide old way to pass kernel parameters选上就行了,因为天嵌用的bootloader太老了,从打印的内核信息中就可以看出。(ATAG_INITRD is deprecated; please update your bootloader.)

4.内核启动时,出现Failed to execute /linuxrc的错误,原因是:
(1)文件系统中没有包含linuxrc的可执行文件。在文件系统中添加linuxrc就可完成linux的启动。
(2)在/driver/mtd/nand/s3c2410.c中将chip->ecc.mode = NAND_ECC_SOFT;改为chip->ecc.mode = NAND_ECC_NONE;并在配置内核中将Samsung S3C NAND Hardware ECC选项删掉。

    这个问题纠结了我好久,我遇见这个问题后,先尝试用nfs挂载,能够挂载上,所以我确定肯定是nandflash出了问题了,以为nandflash坏了(因为被我不停的擦写,嘿嘿),后来用天嵌自带的镜像试了是好的,我就明白了,估计是我的nand驱动有问题了,仔细检查驱动,发现内核配置中的Samsung S3C NAND Hardware ECC没有去掉,,一个小小的问题折磨了我这么久。所以一定一定要仔细啊。

5.编译串口驱动是出现error: implicit declaration of function 's3c2410_gpio_cfgpin'的错误,是因为内核版本2.6.38的内核定义s3c2410_gpio_cfgpin是在linux/gpio.h中,所以添加#include <linux/gpio.h>后即可。

6.编译串口驱动是出现error: 'S3C2410_GPH6' undeclared (first use in this function)是因为在内核版本2.6.38的内核定义s3c2410_gpio_cfgpin的函数变量采用的是S3C2410_GPH(6),而非S3C2410_GPH6,将其改为S3C2410_GPH(6)即可解决问题。

7.linux内核2.6.38的串口程序samsung.c在/driver/tty/serial中。这里与原来的内核版本不一致。这个要注意,内核版本改了,接口也改了,我当时找不到samsung.c,然后通过find命令一看,晕,原来在这里面。

8.在添加yaffs2内核支持时,找不到Kconfig,复制Yaffs2文件夹中的Kconfig_muti到linux内核的fs/yaffs2中,并将Kconfig_muti修改为Kconfig。

    还有一下细小的问题就不在这说了,有其他问题的朋友我们可以一起探讨,我们一起进步!最后,小小祝贺自己一下,今天终于可以睡个好觉了!哈哈!
————————————————
版权声明:本文为优快云博主「wzw12315」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.youkuaiyun.com/wzw12315/article/details/6366754

// SPDX-License-Identifier: GPL-2.0 #include <linux/unistd.h> #include <linux/kernel.h> #include <linux/fs.h> #include <linux/minix_fs.h> #include <linux/romfs_fs.h> #include <linux/initrd.h> #include <linux/sched.h> #include <linux/freezer.h> #include <linux/kmod.h> #include <uapi/linux/mount.h> #include "do_mounts.h" unsigned long initrd_start, initrd_end; int initrd_below_start_ok; unsigned int real_root_dev; /* do_proc_dointvec cannot handle kdev_t */ static int __initdata mount_initrd = 1; phys_addr_t phys_initrd_start __initdata; unsigned long phys_initrd_size __initdata; static int __init no_initrd(char *str) { mount_initrd = 0; return 1; } __setup("noinitrd", no_initrd); static int __init early_initrdmem(char *p) { phys_addr_t start; unsigned long size; char *endp; start = memparse(p, &endp); if (*endp == ',') { size = memparse(endp + 1, NULL); phys_initrd_start = start; phys_initrd_size = size; } return 0; } early_param("initrdmem", early_initrdmem); static int __init early_initrd(char *p) { return early_initrdmem(p); } early_param("initrd", early_initrd); static int __init init_linuxrc(struct subprocess_info *info, struct cred *new) { ksys_unshare(CLONE_FS | CLONE_FILES); console_on_rootfs(); /* move initrd over / and chdir/chroot in initrd root */ init_chdir("/root"); init_mount(".", "/", NULL, MS_MOVE, NULL); init_chroot("."); ksys_setsid(); return 0; } static void __init handle_initrd(void) { struct subprocess_info *info; static char *argv[] = { "linuxrc", NULL, }; extern char *envp_init[]; int error; pr_warn("using deprecated initrd support, will be removed in 2021.\n"); real_root_dev = new_encode_dev(ROOT_DEV); create_dev("/dev/root.old", Root_RAM0); /* mount initrd on rootfs' /root */ mount_block_root("/dev/root.old", root_mountflags & ~MS_RDONLY); init_mkdir("/old", 0700); init_chdir("/old"); /* * In case that a resume from disk is carried out by linuxrc or one of * its children, we need to tell the freezer not to wait for us. */ current->flags |= PF_FREEZER_SKIP; info = call_usermodehelper_setup("/linuxrc", argv, envp_init, GFP_KERNEL, init_linuxrc, NULL, NULL); if (!info) return; call_usermodehelper_exec(info, UMH_WAIT_PROC); current->flags &= ~PF_FREEZER_SKIP; /* move initrd to rootfs' /old */ init_mount("..", ".", NULL, MS_MOVE, NULL); /* switch root and cwd back to / of rootfs */ init_chroot(".."); if (new_decode_dev(real_root_dev) == Root_RAM0) { init_chdir("/old"); return; } init_chdir("/"); ROOT_DEV = new_decode_dev(real_root_dev); mount_root(); printk(KERN_NOTICE "Trying to move old root to /initrd ... "); error = init_mount("/old", "/root/initrd", NULL, MS_MOVE, NULL); if (!error) printk("okay\n"); else { if (error == -ENOENT) printk("/initrd does not exist. Ignored.\n"); else printk("failed\n"); printk(KERN_NOTICE "Unmounting old root\n"); init_umount("/old", MNT_DETACH); } } bool __init initrd_load(void) { if (mount_initrd) { create_dev("/dev/ram", Root_RAM0); /* * Load the initrd data into /dev/ram0. Execute it as initrd * unless /dev/ram0 is supposed to be our actual root device, * in that case the ram disk is just set up here, and gets * mounted in the normal path. */ if (rd_load_image("/initrd.image") && ROOT_DEV != Root_RAM0) { init_unlink("/initrd.image"); handle_initrd(); return true; } } init_unlink("/initrd.image"); return false; }
最新发布
10-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值