real6410移植記錄一
開發(fā)板為華天正的real6410,選定的內(nèi)核版本為linux-2.6.37,交叉工具鏈為開發(fā)板自帶的。
本文引用地址:http://m.butianyuan.cn/article/201611/317277.htm1、修改Makefile
首先修改Makefile,對交叉工具和目標(biāo)架構(gòu)進行設(shè)置。具體如下:
-ARCH ?= $(SUBARCH)
-CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
+ARCH ?= arm
+CROSS_COMPILE ?= arm-none-linux-gnueabi-
2、修改機器碼
可以修改u-boot,也可以修改kernel,只要兩者匹配即可。建議修改kernel的,因為內(nèi)核的修改比較容易一些。
在u-boot/include/configs/smdk6410.h文件中:
#define MACH_TYPE 1626
在linux-2.6.37/arch/arm/tools/mach-types中修改如下:
-real6410 MACH_REAL6410 REAL6410 2990
+real6410 MACH_REAL6410 REAL6410 1626
3、進行NFS相關(guān)配置,并從NFS啟動系統(tǒng)
設(shè)置啟動方式:
setenv bootargs noinitrd root=/dev/nfs console=ttySAC0 nfsroot=192.168.1.10:/home/fantity/work/real6410/target/real6410_fs ip=192.168.1.20:192.168.1.10:192.168.1.1:255.255.255.0::eth0:on fbcon=rotate:1 init=/linuxrc
移植過程中需要配置NFS和相關(guān)的網(wǎng)絡(luò)驅(qū)動,否則出現(xiàn)如下錯誤:
VFS: Cannot open root device "nfs" or unknown-block(0,255)
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,255)
[
[
[
[
[
相關(guān)的配置如下圖所示,注意,NFS的配置選項必須在TCP/IP選擇之后才可以看到。
[*] Networking support --->
Networking options --->
[*] TCP/IP networking
[*] IP: kernel level autoconfiguration
[*] IP: BOOTP support
Device Drivers --->
[*] Network device support --->
<*> PHY Device support and infrastructure --->
[*] Ethernet (10 or 100Mbit) --->
<*> DM9000 support
File systems --->
[*] Network File Systems --->
<*> NFS client support
[*] NFS client support for NFS version 3
[ ] NFS client support for the NFSv3 ACL protocol extension
[*] NFS client support for NFS version 4
[ ] NFS client support for NFSv4.1
[*] Root file system on NFS
4、Nand Flash配置
對arch/arm/mach-s3c64xx/mach-real6410.c作出如下修改:
static struct mtd_partition real6410_nand_part[] = {
[0] = {
- .name = "uboot",
- .size = SZ_1M,
- .offset = 0,
+ .name = "uboot",
+ .offset = 0,
+ .size = (256*SZ_1K),
+ .mask_flags = MTD_CAP_NANDFLASH,
},
[1] = {
- .name = "kernel",
- .size = SZ_2M,
- .offset = SZ_1M,
+ .name = "Kernel",
+ .offset = (256*SZ_1K),
+ .size = (4*SZ_1M) - (256*SZ_1K),
+ .mask_flags = MTD_CAP_NANDFLASH,
},
[2] = {
- .name = "rootfs",
- .size = MTDPART_SIZ_FULL,
- .offset = SZ_1M + SZ_2M,
+ .name = "cramfs",
+ .offset = (4*SZ_1M),
+ .size = (4*SZ_1M),
+ },
+ [3] = {
+ .name = "ubifs",
+ .offset = MTDPART_OFS_APPEND,
+ .size = MTDPART_SIZ_FULL,
},
};
將驅(qū)動s3c_nand.c、regs-nand.h文件拷貝到相應(yīng)的目錄drivers/mtd/nand/s3c_nand.c和arch/arm/plat-samsung/include/plat/regs-nand.h下。
同時修改文件drivers/mtd/nand/Kconfig
+config MTD_NAND_S3C
+ state "NAND Flash support for Samsung S3C SoCs"
+ depends on ARCH_S3C2410 || ARCH_S3C64XX
+ help
+ This enables the NAND flash controller on the S3C SoCs
+
+ No board specific support is done by this driver, each board
+ must advertise a platform_device for the driver to attach.
+
+config MTD_NAND_S3C_DEBUG
+ bool "Samsung S3C NAND driver debug"
+ depends on MTD_NAND_S3C
+ help
+ Enable debugging of the S3C NAND driver
+
+config MTD_NAND_S3C_HWECC
+ bool "Samsung S3C NAND Hardware ECC"
+ depends on MTD_NAND_S3C
+ help
+ Enable the use of the controllers internal ECC generator when
+ using NAND. Early versions of the chips have had problems with
+ incorrect ECC generation, and if using these, the default of
+ software ECC is preferable.
修改文件drivers/mtd/nand/Makefile
obj-$(CONFIG_MTD_NAND_S3C2410) += s3c2410.o
+obj-$(CONFIG_MTD_NAND_S3C) += s3c_nand.o
需要選擇如下驅(qū)動配置:
Device Drivers --->
<*> Memory Technology Device (MTD) support --->
<*> NAND Device Support --->
<> NAND Flash support for Samsung S3C SoCs //不選
<*> NAND Flash support for S3C SoC
[*] S3C NAND Hardware ECC
[ ] S3C NAND driver debug
編譯內(nèi)核,出現(xiàn)如下錯誤:
drivers/built-in.o: In function `s3c_nand_probe:
/home/weimen/Work/realarm/lsp/kernel/real6410_linux-2.6.37/drivers/mtd/nand/s3c_nand.c:1192: undefined reference to `add_mtd_partitions
修改內(nèi)核配置,make menuconfig,添加分區(qū)支持配置。
Device Drivers --->
<*> Memory Technology Device (MTD) support --->
[*] MTD partitioning support
系統(tǒng)啟動,出現(xiàn)如下信息時,說明nand driver移植正常。
S3C NAND Driver, (c) 2008 Samsung Electronics
S3C NAND Driver is using hardware ECC.
NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung )
Creating 4 MTD partitions on "NAND 1GiB 3,3V 8-bit":
0x000000000000-0x000000040000 : "uboot"
0x000000040000-0x000000400000 : "Kernel"
0x000000400000-0x000000800000 : "cramfs"
0x000000800000-0x000040000000 : "ubifs"
根文件系統(tǒng)啟動到最后,出現(xiàn)如下錯誤。
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "mtdblock2" or unknown-block(2,0)
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
[
[
[
[
[
[
上面的問題在于沒有配置好mtd的驅(qū)動,對驅(qū)動進行如下配置,下面分別表示可以將MTD設(shè)備當(dāng)作字符設(shè)備和塊設(shè)備進行操作。選擇之后通過NFS掛載,在/dev/目錄下出現(xiàn)mtdblock1、mtdblock2、mtdblock3、mtdblock4設(shè)備節(jié)點。
<*> Memory Technology Device (MTD) support --->
<*> Direct char device access to MTD devices
<*> Caching block device access to MTD devices
上面的配置完成后,出現(xiàn)如下錯誤:
end_request: I/O error, dev mtdblock2, sector 0
Buffer I/O error on device mtdblock2, logical block 0
s3c6400_setup_sdhci_cfg_card: CTRL 2=c0004100, 3=80808080
end_request: I/O error, dev mtdblock2, sector 0
Buffer I/O error on device mtdblock2, logical block 0
end_request: I/O error, dev mtdblock2, sector 8
Buffer I/O error on device mtdblock2, logical block 1
mmc0: mmc_rescan: trying to init card at 200000 Hz
end_request: I/O error, dev mtdblock2, sector 8
Buffer I/O error on device mtdblock2, logical block 1
end_request: I/O error, dev mtdblock2, sector 24
Buffer I/O error on device mtdblock2, logical block 3
s3c6400_setup_sdhci_cfg_card: CTRL 2=c0004100, 3=80808080
end_request: I/O error, dev mtdblock2, sector 24
Buffer I/O error on device mtdblock2, logical block 3
List of all partitions:
1f00 256 mtdblock0 (driver?)
1f01 3840 mtdblock1 (driver?)
1f02 4096 mtdblock2 (driver?)
1f03 1040384 mtdblock3 (driver?)
No filesystem could mount root, tried: cramfs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)
[
[
[
[
[
[
在網(wǎng)上查了下,說是要關(guān)閉Hard ECC,關(guān)閉之后又出現(xiàn)如下錯誤,可能是cramfs的問題,需要重新制作,這個問題后面再解決了。
List of all partitions:
1f00 256 mtdblock0 (driver?)
1f01 3840 mtdblock1 (driver?)
1f02 4096 mtdblock2 (driver?)
1f03 1040384 mtdblock3 (driver?)
No filesystem could mount root, tried: cramfs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)
[
[
[
[
[
[
5、制作ubifs文件系統(tǒng)
先使用NFS掛載文件系統(tǒng),使用如下配置:
setenv bootargs noinitrd root=/dev/nfs console=ttySAC0 nfsroot=192.168.1.115:/home/xx/Work/realarm/target/rootfs_cramfs ip=192.168.1.20:192.168.1.10:192.168.1.1:255.255.255.0::eth0:on fbcon=rotate:1 init=/linuxrc
使用ubifs文件系統(tǒng),其中mtd3分區(qū)即為ubifs分區(qū)。使用如下命令將文件系統(tǒng)燒錄進nand中。(注意需要關(guān)閉硬件ECC校驗,否則/sbin/ubiattach /dev/ubi_ctrl -m 3會出錯)。
且讀取啟動開發(fā)板時會出現(xiàn)如下錯誤:
UBI error: ubi_io_read: error -74 (ECC error) while reading 2048 bytes from PEB 547:2048, read 2048 bytes
UBI error: ubi_io_read: error -74 (ECC error) while reading 64 bytes from PEB 548:0, read 64 bytes
使用命令/sbin/ubiattach /dev/ubi_ctrl -m 3,當(dāng)出現(xiàn)如下錯誤時,說明ubifs文件系統(tǒng)未配置好。
ubiattach: error!: UBI is not present in the system
再次執(zhí)行make menuconfig配置好ubifs文件系統(tǒng)
File systems --->
[*] Miscellaneous filesystems --->
<*> UBIFS file system support
新建一個文件夾rootfs_qtopia,將開發(fā)板所提供的源碼包qtopia.tar.gz解壓進去。同時解壓源碼包qtopia-2.2.0-Real6410.tar.bz2,并對其進行編譯,執(zhí)行./build命令。安裝結(jié)果就在qtopia-2.2.0-Real6410/qtopia/image/opt目錄。使用編譯出來的qtopia-2.2.0-Real6410/qtopia/image/opt替換rootfs_qtopia/opt。打包成Qt文件系統(tǒng)
cd rootfs_qtopia/
$ /sbin/flash_eraseall /dev/mtd3
$ /sbin/ubiattach /dev/ubi_ctrl -m 3
$ /sbin/ubimkvol /dev/ubi0 -N rootfs -m
$ mount -t ubifs ubi0_0 /mnt/nfs
$ tar xvf /qtopia-2.2.0-Real6410.tar.bz2 -C /mnt/nfs/
$ sync
修改啟動命令為:
setenv bootargs noinitrd mem=224M console=ttySAC0 init=/linuxrc ubi.mtd=3 root=ubi0:rootfs rootfstype=ubifs
如下是啟動信息:
UBIFS: recovery completed
UBIFS: mounted UBI device 0, volume 0, name "rootfs"
UBIFS: file system size: 1034514432 bytes (1010268 KiB, 986 MiB, 4009 LEBs)
UBIFS: journal size: 33546240 bytes (32760 KiB, 31 MiB, 130 LEBs)
UBIFS: media format: w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root: 4952683 bytes (4836 KiB)
VFS: Mounted root (ubifs filesystem) on device 0:10.
Freeing init memory: 128K
hwclock: cant open /dev/misc/rtc: No such file or directory
amixer: Control default open error: No such file or directory
amixer: Control default open error: No such file or directory
/usr/sbin/alsactl: load_state:1236: No soundcards found...
Try to bring eth0 interface up....../etc/init.d/ifconfig-eth0: line 6: //ifconfig: not found
eth0: link up, 100Mbps, full-duplex, lpa 0x4DE1
Done
Now,starting the qtopia-2.2.0....
unifi_sdio: version magic 2.6.28.6 preempt mod_unload ARMv6 should be 2.6.37-gfb40001 preempt mod_unload ARMv6
insmod: cannot insert /lib/modules/2.6.28.6/unifi_sdio.ko: invalid module format
Please press Enter to activate this console. Cannot open touchscreen /dev/input/event1 (No such file or directory)
Mouse type intelliMouse:/dev/input/mice unsupported
Warning: could not register server
[root@Real6410 /]# pwd
/
評論