Linux內核移植問題總結
移植一個內核會涉及到很多東西,對想學arm的人來說還是挺有幫助的,會比直接拿別人移植好的內核來跑有趣的多。
一、串口打印問題
內核移植的第一步就是要有打印輸出。看不到打印信息,都不知道內核有沒有跑起來。我移植 linux-2.6.35編譯完成后運行,啟動一直停在starting kernel . . .,檢查machine-type、cpu-id、時鐘、入口地址等可能會導致問題的地方都沒有問題,最后想到可能是串口使用的引腳和內核不一致,最后才發現板子使用的是串口2作為打印輸出(也是我一開始沒想到的,因為一般都會默認使用串口1,糾結)。講啟動參數改成串口2,mx5_loco.c 里面的init串口改成UART2_BASE_ADDR,可以輸出信息了。
二、文件系統
1、自己編譯一個busybox來制作一個文件系統其實還是挺麻煩的,只能制作一個很簡單的文件系統,因為是在flash上加載,所以我最開始嘗試的是cramfs,加載文件系統階段一直出錯
List of all partitions:
1f00 131072 mtdblock0 (driver?)
No filesystem could mount root, tried: cramfs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,0)
這里只讀到了一個塊設備,block0,顯然flash的分區沒有成功,修改nandflash的分區,文件系統正常加載,啟動參數如下
setenv bootargs root=/dev/mtdblock3 rootfstype=cramfs rw console=ttymxc1,115200 init=/linuxrc
2、加載成功有時會出現Kernel panic - not syncing: Attempted to kill init!,這個很多人說要開
Kernel Features --->
[*] Use the ARM EABI to compile the kernel
[*] Allow old ABI binaries to run with this kernel (EXPERIMENTAL)(NEW)
我試過好像沒什么效果,出現這個問題有可能是文件系統的inittab和rcS兩個文件有問題。
3、jffs2文件系統
JFFS2 error: (1) jffs2_build_inode_pass1: child dir"alsa" (ino #1159) of dir ino #1074 appears to be a hard link JFFS2 error: (1) jffs2_build_inode_pass1:child dir "l" (ino #1170) of dir ino #1075 appears to be a hard link
原由 : flash沒有erase徹底.,多 nand erase幾次就好了
還有就是jffs2文件系統會有很多警告信息,我在源碼里面將打印都去掉還是不行
posted on 2014-06-03 09:52 順其自然EVO 閱讀(561) 評論(0) 編輯 收藏 所屬分類: linux