移植新的(3.4.2)內(nèi)核至開發(fā)板中
date: 2018年1月25日
1.下載并初步編譯
- 解壓并修改Makefile
vim Makefile + 195
- ARCH ?= $(SUBARCH)
- CROSS_COMPILE = $(CONFIG_CROSS_COMPILE: "%" = %)
+ ARCH ?= arm
+ CROSS_COMPILE = arm-linux-
- 使用默認(rèn)配置進行初次編譯
make s3c2410_defconfig (可以在 arch/arm/configs 中查看相關(guān)配置文件)
make uImage
# 期間報錯Can't use 'defined(@array)' (Maybe you should just omit the
# defined()?) at kernel/timeconst.pl line 373
# 解決方案:進入 kernel/timeconst.pl line 373
- if (!defined(@val)) {
+ if (!(@val)) {
- 修改代碼支持 JZ2440
/* arch/arm/mach-s3c24xx/mach-s3c2440.c line 165 */
- s3c24xx_init_clocks(16934400);
+ s3c24xx_init_clocks(12000000);
- 修改分區(qū)表
/* arch/arm/mach-s3c24xx/common-smdk.c line 111:(static struct mtd_partition smdk_default_nand_part[] ) */
// 更改為:
static struct mtd_partition smdk_default_nand_part[] = {
[0] = {
.name = "bootloader",
.size = SZ_256K,
.offset = 0,
},
[1] = {
.name = "params",
.offset = MTDPART_OFS_APPEND,
.size = SZ_128K,
},
[2] = {
.name = "kernel",
.offset = MTDPART_OFS_APPEND,
.size = SZ_1M * 3,
},
[3] = {
.name = "rootfs",
.offset = MTDPART_OFS_APPEND,
.size = MTDPART_SIZ_FULL,
},
};
- nfs 下載文件時出現(xiàn)如下錯誤:
T T *** ERROR: Cannot umount
解決方法: 在主機的 /etc/hosts 中加入如下內(nèi)容:
# 開發(fā)板IP nfs文件目錄
192.168.1.17 /path/to/nfs_root/
- 文件系統(tǒng)啟動之后出現(xiàn)如下報錯:
Attempted to kill init! exitcode=0x00000004
原因及解決方法:
報錯碼 0x00000004 即為 SIGILL --- 非法指令郑诺;而產(chǎn)生非法指令的原因是竖共,我們在編譯時用的是
arm-none-linux-guneabi。 其中eabi的意思是指可執(zhí)行層應(yīng)用程序二進制接口淀歇,所以內(nèi)核也需要
支持這種接口
make menuconfig # search EABI
Kernel Features
[*]USE the ARM EABI to compile the kernel # y to select
make uImage
編譯支持yaffs2
- 下載yaffs2 源碼
- 依據(jù)yaffs2 提供的README 來將yaffs2 拷到內(nèi)核之中:
./patch_ker.sh c m /path/to/kernel
- 配置添加yaffs2支持
make menuconfig
# 如果提示類似fs/yaffs2/Kconfig:131: unknown option "If"的錯誤,可以把
# fs/yaffs2/Kconfig文件中的help選項后的說明文字的空行刪除姚糊。
# 配置選項的路徑如下:
# File systems/Miscellaneous file systems/ yaffs2
make uImage
- 掛載無法運行的錯誤(我沒有遇到)
/* u-boot: drivers/mtd/nand/nand_util.c line 518 */
- if (!need_skip && !(flags & WITH_DROP_FFS))
+ if (!need_skip && !(flags & WITH_DROP_FFS) && !(flags & WITH_YAFFS_OOB))
裁剪
make menuconfig
System Type
Samsung S3C24xx Supports
# 去掉無關(guān)的soc
PS: 自己改變分區(qū)大小贿衍,無法啟動,報錯信息如下
NAND read: device 0 offset 0xa0000, size 0x200000
2097152 bytes read: error
## Booting kernel from Legacy Image at 72000000 ...
Image Name: Linux-2.6.30
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1939156 Bytes = 1.8 MB
Load Address: 70008000
Entry Point: 70008000
Verifying Checksum ... Bad CRC or data
Error: Can't get kernel image!
解決方案
- 問題出現(xiàn)的原因是因為救恨,燒寫內(nèi)核和文件系統(tǒng)的地方出現(xiàn)了壞塊贸辈,導(dǎo)致無法正確識別到 kernel
文件 - 解決方法:就是利用 “ nand scrub” 命令將壞塊清除掉然后重新編譯