Linux内核移植的六大问题解决

本文发布时间: 2019-Mar-22
问题一:linux2.6.30内核编译『zImage』出现Error: unrecognized/unsupported machine ID解决方法一======================================================Linux 内核启动时出现:bad machine ID,原因大致是u-boot 传递给内核的machine ID错误,可以手动在内核源代码中添加machine ID.解决方法一:在u-boot 命令行中输入bdinfo查看板卡信息,我的输出如下:FS2410# bdinfoarch_number = 0x000000C1env_t = 0x00000000boot_params = 0x30000100DRAM bank = 0x00000000-> start = 0x30000000-> size = 0x04000000ethaddr = 08:00:3E:26:0A:5Bip_addr = 10.1.8.245baudrate = 115200 bps修改内核的arch/arm/kernel/head.S,直接将s3c2410的参数赋给内核# cd linux-2.6.19# vi arch/arm/kernel/head.S +72----------------------------------------------70 __INIT71 .type stext, %function72 ENTRY(stext)mov r0, #0mov r1, #0xc1ldr r2, =0x3000010073 msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | SVC_MODE @ ensure svc mode解决方法二修改u-boot,填写ID;# vi common/cmd_boot.c----------------------------------------------31 #if defined(CONFIG_I386)32 DECLARE_GLOBAL_DATA_PTR;33 #endif====>31 //#if defined(CONFIG_I386)32 DECLARE_GLOBAL_DATA_PTR;33 //#endif...60 #if !defined(CONFIG_NIOS)if(argc==2)rc = ((ulong (*)(int, char *[]))addr) (0, gd->bd->bi_arch_number);else61 rc = ((ulong (*)(int, char *[]))addr) (--argc, &argv[1]);62 #else63问题二:BusyBox编译时出现的问题:file included from /opt/EmbedSky/4.3.3/bin/../arm-none-linux-gnueabi/libc/usr/include/linux/if_tunnel.h:5,from /opt/EmbedSky/BusyBox-1.2.0/networking/libiproute/iptunnel.c:32:/opt/EmbedSky/4.3.3/bin/../arm-none-linux-gnueabi/libc/usr/include/linux/ip.h:85: error: redefinition of 'struct iphdr'make[1]: *** [/opt/EmbedSky/BusyBox-1.2.0/networking/libiproute/iptunnel.o] Error 1make: *** [_all] Error 2这句话讲了:In file included from /opt/EmbedSky/4.3.3/bin/../arm-none-linux-gnueabi/libc/usr/include/linux/if_tunnel.h:5,在头文件if_tunnel.h第五行调用了ip.h这个头文件;下面这句话:/opt/EmbedSky/4.3.3/bin/../arm-none-linux-gnueabi/libc/usr/include/linux/ip.h:85: error: redefinition of 'struct iphdr'在头文件ip.h的85行又redefinition(翻译成中文是:重复定义)了结构体 iphdr。iphdr结构在另外一个头文件中定义了:arm-none-linux-gnueabi/libc/usr/include/netinet/ip.h的45行。而这个头文件正好现在iptunnel.c文件的17行调用了。linux/if_tunnel.h头文件在24行调用的。最合理的解决方法:修改busybox的源码:把busybox-1.13.0\networking\libiproute\iptunnel.c文件的24行屏蔽掉就行了。问题三:NAND Flash分区问题:修改arch/arm/plat-s3c24xx/common-smdk.c中111行的static struct mtd_partition smdk_default_nand_part[]的nandflash分区为:static struct mtd_partition smdk_default_nand_part[] = { [0] = { .name = "Rojian_Boot", .size = 0x00040000, .offset = 0x00000000, }, [1] = { .name = " Rojian_param", .offset = 0x00040000, .size =0x00020000, }, [2] = { .name = " Rojian_kernel", .offset = 0x00200000, .size = 0x00300000, }, [3] = { .name = " Rojian_yaff2", .offset = 0x00500000, .size = MTDPART_SIZ_FULL, }}; 然后修改“drivers/mtd/nand/s3c2410.c”文件的752行(Linux-2.6.30.4)或者669行(Linux-2.6.25.8),将原来的内容改为如下所示:chip->ecc.mode =NAND_ECC_NONE; 最后在终端输入#make menuconfig配置相关选项。问题四:编译内核时出现问题[drivers/video/console/vgacon.o]drivers/video/console/vgacon.o:987:warning:comparison is always true due to limited range of data typemake[3]:***[drivers/video/console/vgacon.o] error 1make[2]:***[drivers/video/console2] error 2make[1]:***[drivers/video1] error 2make:***[drivers] error 2解决方法:在make menuconfig 时Graphics support ->console display driver support->vga text console(不选这个)问题五:red hat在哪里设置机器IP可以进入/etc/sysconfig/network-scripts。找到ifcfg-eth0.编辑它如下:DEVICE = eth0ONBOOT = yesBOOTPROTO = staticIPADDR= 10.9.100.221(你需要的固定ip)NETMASK=255.0.0.0GATEWAY=10.255.255.254如果需要动态分配IP,那么DEVICE = eth0ONBOOT = yesUSERCTL = yesBOOTPROTO = dhcp改了再运行/etc/rc.d/init.d/network restart问题六:编译busybox-1.13.0错误解决In file included from /opt/EmbedSky/4.3.3/bin/../arm-none-linux-gnueabi/libc/usr/include/linux/if_tunnel.h:5,from /opt/EmbedSky/BusyBox-1.2.0/networking/libiproute/iptunnel.c:32:/opt/EmbedSky/4.3.3/bin/../arm-none-linux-gnueabi/libc/usr/include/linux/ip.h:85: error: redefinition of 'struct iphdr'make[1]: *** [/opt/EmbedSky/BusyBox-1.2.0/networking/libiproute/iptunnel.o] Error 1make: *** [_all] Error 2解决办法:make menuconfig找到下面的这一个设置项:networking utilites->ip tunnel在[ *] ip tunnel用空格键取消 *即变成 [ ] ip tunnel 保存即可


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:11pm
栏目列表