新聞中心

EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > ARM 內(nèi)核移植中常見(jiàn)的錯(cuò)誤

ARM 內(nèi)核移植中常見(jiàn)的錯(cuò)誤

作者: 時(shí)間:2016-11-11 來(lái)源:網(wǎng)絡(luò) 收藏
1.下載linux-2.6.36.1.tar.bz2
問(wèn)題:tar -zxvf 解壓壓縮文件出現(xiàn)問(wèn)題,無(wú)法識(shí)別.
解決:1.通過(guò)file linux-2.6.36.1.tar.bz2 查看壓縮格式
2.通過(guò)命令 bzip2 -d linux-2.6.36.1.tar.bz2解壓
3.再通過(guò)tar xvf linux-2.6.36.1.tar解壓,不能使用
tar zxvf linux-2.6.22.6.tar解壓
4.上面也可以通過(guò)一條指令bzip2 -dc linux-2.6.XX.tar.bz2 | tar xvf -
其中XX為內(nèi)核壓縮包文件名

2.下載patch-2.6.36.1.bz2補(bǔ)丁文件
1.解壓 bzip2 -d patch-2.6.36.1.bz2
2.cd linux-2.6.36.1/
3.patch -p1 < ../patch-2.6.36.1

3.先編譯看下內(nèi)核有沒(méi)有問(wèn)題,運(yùn)行make命令出現(xiàn)下面的錯(cuò)誤:
問(wèn)題:drivers/input/touchscreen/eeti_ts.c:65: 錯(cuò)誤: 隱式聲明函數(shù)‘irq_to_gpio’
解決:重新make menuconfig,將driver中的輸入設(shè)備->觸摸設(shè)備中,將EETI選項(xiàng)不選,保存退出后,重新make.

4.將編譯成功的內(nèi)核zImage下載到板子中,出現(xiàn)如下問(wèn)題:
問(wèn)題:NOW, Booting Linux......
Uncompressing Linux... done, booting the kernel.
然后沒(méi)有反應(yīng)....
解決:1.Device Drivers--->Character devices--->Serial drivers
下,選擇:Samsung SoC serial support
Support for console on Samsung SoC serial port
Samsung S3C2440/S3C2442 Serial port support
2.發(fā)現(xiàn)對(duì)應(yīng)選項(xiàng)在Device Drivers->Character devices->Serial drivers中
一看,原來(lái)根本就沒(méi)有加載Samsung SoC serial support , 選成靜態(tài)編譯之后又出現(xiàn)了
Support for console on Samsung SoC serial port ,就是它了,選上, 退出的時(shí)候順便把
Kernel low-level debugging functions給取消了否則我們?cè)O(shè)置的printk會(huì)自行輸出,就不知道ttySAC有沒(méi)有加載成功了
3.最后發(fā)現(xiàn)原來(lái)時(shí)內(nèi)核編譯時(shí)需要傳入一個(gè)啟動(dòng)命令:noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0,
make menuconfig -> Boot options -> 第三行添加上面的啟動(dòng)命令,保存退出,啟動(dòng)成功~

5.啟動(dòng)過(guò)程中,出現(xiàn)問(wèn)題:
問(wèn)題:Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 80000005 [#1]
last sysfs file:
Modules linked in:
CPU: 0Not tainted(2.6.36.1 #20)
PC is at 0x0
LR is at s3c_gpio_setpull+0x80/0x8c
解決:參考網(wǎng)址:http://blog.csdn.net/ExclusivePig/archive/2010/10/24/5961869.aspx
將static inline int s3c_gpio_do_setpull函數(shù)修改為以下內(nèi)容:
static inline int s3c_gpio_do_setpull(struct s3c_gpio_chip *chip,
unsigned int off, s3c_gpio_pull_t pull)
{
if(NULL != chip->config->set_pull)
return (chip->config->set_pull)(chip, off, pull);
else
return EINVAL;
}

6.內(nèi)核終于啟動(dòng)起來(lái)了,但是接著又出現(xiàn)了下面的問(wèn)題:
問(wèn)題:List of all partitions:
1f00 256 mtdblock0 (driver?)
1f0164 mtdblock1 (driver?)
1f022048 mtdblock2 (driver?)
1f03 63152 mtdblock3 (driver?)
1f04 65536 mtdblock4 (driver?)
No filesystem could mount root, tried:cramfs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)
解決:原來(lái)是沒(méi)有添加YAFFS2文件系統(tǒng),從網(wǎng)上下載,給內(nèi)核打上補(bǔ)丁,重新make menuconfig,在file system中選擇YAFFS2,重新make.
打補(bǔ)丁如下:./patch-ker.sh c /work/system/linux-2.6.36.1

7.編譯出現(xiàn)問(wèn)題,最新內(nèi)核去掉了一些函數(shù),和改變了一些函數(shù)的名字,致使YAFFS2在編譯過(guò)程中出現(xiàn)錯(cuò)誤。
解決:請(qǐng)參考:http://www.linuxhq.com/kernel/v2.6/36-rc1/fs/attr.c

8.再次下載編譯好的內(nèi)核,運(yùn)行出現(xiàn)下面問(wèn)題:
問(wèn)題:yaffs: dev is 32505858 name is "mtdblock2"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
yaffs_read_super: isCheckpointed 0
VFS: Mounted root (yaffs filesystem) readonly on device 31:2.
devtmpfs: error mounting -2
Freeing init memory: 120K
Failed to execute /linuxrc.Attempting defaults...
Kernel panic - not syncing: No init found.Try passing init= option to kernel.
解決:1.啟動(dòng)命令有問(wèn)題,根據(jù)查看分區(qū)信息(supervivi:part show)得知root分區(qū)在mtdblock3上,不是在2上
修改為:noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC0
2.問(wèn)題依舊,重新make menuconfig,并對(duì)比友善之臂提供的mini2440源代碼配置,重新選擇,
Device Driver ->Generic Driver Options ->(取消)devtmpfs: error mounting -2被解決了,
但是依然無(wú)法啟動(dòng)繼續(xù)查看。
3.系統(tǒng)在啟動(dòng)過(guò)程中出現(xiàn)了很多yaffs: block 456 is marked bad,block 457 is bad這樣的錯(cuò)誤,越來(lái)越多,通過(guò)網(wǎng)上搜尋找到解決辦法:
我用的是板子自帶的supervivi,使用命令bon part 0,就起到格式化整個(gè)Nand Flash芯片的作用,假壞塊自然就化為烏有了。隨后問(wèn)題就柳暗花明。
4.將mini2440自帶的文件系統(tǒng)重新燒如板子,用mini2440自帶的內(nèi)核文件啟動(dòng),正常,說(shuō)明文件系統(tǒng)沒(méi)有問(wèn)題,將自己編譯的內(nèi)核下載進(jìn)去,依然無(wú)法啟動(dòng),
5.添加一些內(nèi)核輸出信息,終于發(fā)現(xiàn)內(nèi)核在:search_binary_handler()函數(shù)中的fn(bprm, regs)函數(shù)后,執(zhí)行失敗了。非常郁悶...
6.文件系統(tǒng)沒(méi)有問(wèn)題,顯然還是內(nèi)核編譯有問(wèn)題,然后通過(guò)網(wǎng)上查找說(shuō)是load_elf_binary執(zhí)行有問(wèn)題,可能是加載文件系統(tǒng)的文件時(shí)不識(shí)別文件格式,于是
重新make menuconfig最后發(fā)現(xiàn)原來(lái)是要將General setup--->Choose SLAB allocator --->選上SLAB,不要選擇SLUB。重新make


關(guān)鍵詞: ARM內(nèi)核移

評(píng)論


技術(shù)專區(qū)

關(guān)閉