linux移植常见问题,LINUX内核移植遇到的问题解决

问题一:linux2.6.30内核编译『zImage』出现Error: unrecognized/unsupported machine ID

解决方法一

======================================================

Linux 内核启动时出现:bad machine ID,原因大致是u-boot 传递给

内核的machine ID错误,可以手动在内核源代码中添加machine ID.

解决方法一:

在u-boot 命令行中输入bdinfo

查看板卡信息,我的输出如下:

FS2410# bdinfo

arch_number = 0x000000C1

env_t = 0x00000000

boot_params = 0x30000100

DRAM bank = 0x00000000

-> start = 0x30000000

-> size = 0x04000000

ethaddr = 08:00:3E:26:0A:5B

ip_addr = 10.1.8.245

baudrate = 115200 bps

修改内核的arch/arm/kernel/head.S,直接将s3c2410的参数赋给内核

# cd linux-2.6.19

# vi arch/arm/kernel/head.S +72

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

70 __INIT

71 .type stext, %function

72 ENTRY(stext)

mov r0, #0

mov r1, #0xc1

ldr r2, =0x30000100

73 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);

else

61 rc = ((ulong (*)(int, char *[]))addr) (--argc, &argv[1]);

62 #else

63

问题二:BusyBox编译时出现的问题:

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 1

make: *** [_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 type

make[3]:***[drivers/video/console/vgacon.o] error 1

make[2]:***[drivers/video/console2] error 2

make[1]:***[drivers/video1] error 2

make:***[drivers] error 2

解决方法:

在make menuconfig 时

Graphics support ->

console display driver support->

vga text console(不选这个)问题五:red hat在哪里设置机器IP

可以进入/etc/sysconfig/network-scripts。找到ifcfg-eth0.编辑它如下:

DEVICE = eth0

ONBOOT = yes

BOOTPROTO = static

IPADDR= 10.9.100.221(你需要的固定ip)

NETMASK=255.0.0.0

GATEWAY=10.255.255.254

如果需要动态分配IP,那么

DEVICE = eth0

ONBOOT = yes

USERCTL = yes

BOOTPROTO = 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 1

make: *** [_all] Error 2解决办法:make menuconfig找到下面的这一个设置项:

networking utilites->ip tunnel

在[ *] ip tunnel用空格键取消 *即变成 [ ] ip tunnel 保存即可

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值