歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux內核 >> Linux內核在運行時的一些問題

Linux內核在運行時的一些問題

日期:2017/2/28 16:26:18   编辑:Linux內核

1. 問題一
  下載內核到flash中,運行到如下即停止沒有下文:
Uncompressing Linux……………………done,booting the kernel
卡在這裡不動了
原因分析:
可能是內核的啟動參數傳遞時沒有填寫正確
也可能是在linux內核中沒對flash分區
還有另一可能原因是在內核編譯配置時沒將串口驅動勾選
解決辦法:
如果是命令參數問題,則作如下修改:注釋掉arch/arm/kernel/setup.c文件中的parse_tag_cmdline()函數中的 strlcpy()函數,這樣就可以使用默認的CONFIG_CMDLINE了,在.config文件中它被定義為"root=/dev /mtdblock2 ro init=/linuxrc console=ttySAC0,115200"(視具體情況而定),在內核配置文件的Boot options中填入也可。
如果是內核NAND flash分區的問題,則作如下修改:
1. 1 修改文件arch/arm/mach-s3c2410/devs.c,添加如下信息:
#include <linux/mtd/partitions.h>
#include <asm/arch/nand.h>
#include <linux/mtd/nand.h>
static struct mtd_partition partition_info[]=
{
{
name:"bootloader",
size:0x00040000,
offset:0,
},
{
name:"kernel",
size:0x001c0000,
offset:0x00040000,
},
{
name:"rootfs",
size: 0x01e00000,
offset:0x00200000,
},
{
name:"ext-fs1",
size: 0x01000000,
offset:0x02000000,
},
{
name:"ext-fs2",
size: 0x01000000,
offset:0x03000000,
},
};
//以上分區和NAND flash物理分區一樣,分區不一樣沒試過,根據自己板子情況而定
struct s3c2410_nand_set nandset=
{
nr_partitions:5,
partitions:partition_info,
};
struct s3c2410_platform_nand s3c_nand_info=
{
tacls:0,
twrph0:30,
twrph1:0,
sets:&nandset,
nr_sets:1,
};
以上分區和NAND flash物理分區一樣,分區不一樣沒試過,根據自己板子情況而定
struct s3c2410_nand_set nandset=
{
nr_partitions:5,
partitions:partition_info,
};
struct s3c2410_platform_nand s3c_nand_info=
{
tacls:0,
twrph0:30,
twrph1:0,
sets:&nandset,
nr_sets:1,
};
struct platform_device s3c_device_nand={
.name="s3c2410-nand",
.id = -1,
.num_resources = ARRAY_SIZE(s3c_nand_resources),
.resource = s3c_nand_resource, /*黑體為新加內容*/
.dev = {
.platform_data=&s3c_nand_info
}
};
1.2 在arch/arm/mach-s3c2410/mach-smdk2410.c文件中添加&s3c_device_nand,如下所示:
static struct platform_device * smdk2410_device[] _initdata=
{
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
&s3c_device_nand,
};
配置好以上內容後重新編譯內核即可。
如果是串口驅動沒有勾選,則一定記住將勾上如下選項:
Character devices
-> Serial Drivers下的項全勾上.

Copyright © Linux教程網 All Rights Reserved