新聞中心

        EEPW首頁 > 嵌入式系統 > 設計應用 > real6410移植記錄一

        real6410移植記錄一

        作者: 時間:2016-11-10 來源:網絡 收藏
        配置開發板的NFS驅動和移植NandFlash驅動

        開發板為華天正的real6410,選定的內核版本為linux-2.6.37,交叉工具鏈為開發板自帶的。

        本文引用地址:http://www.104case.com/article/201611/317277.htm

        1、修改Makefile

        首先修改Makefile,對交叉工具和目標架構進行設置。具體如下:

        -ARCH ?= $(SUBARCH)

        -CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)

        +ARCH ?= arm

        +CROSS_COMPILE ?= arm-none-linux-gnueabi-

        2、修改機器碼

        可以修改u-boot,也可以修改kernel,只要兩者匹配即可。建議修改kernel的,因為內核的修改比較容易一些。

        在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相關配置,并從NFS啟動系統

        設置啟動方式:

        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和相關的網絡驅動,否則出現如下錯誤:

        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)

        [] (unwind_backtrace+0x0/0xec) from [] (panic+0x54/0x174)

        [] (panic+0x54/0x174) from [] (mount_block_root+0x25c/0x2ac)

        [] (mount_block_root+0x25c/0x2ac) from [] (prepare_namespace+0x164/0x1bc)

        [] (prepare_namespace+0x164/0x1bc) from [] (kernel_init+0x10c/0x14c)

        [] (kernel_init+0x10c/0x14c) from [] (kernel_thread_exit+0x0/0x8)

        相關的配置如下圖所示,注意,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,

        },

        };

        將驅動s3c_nand.c、regs-nand.h文件拷貝到相應的目錄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

        需要選擇如下驅動配置:

        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

        編譯內核,出現如下錯誤:

        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

        修改內核配置,make menuconfig,添加分區支持配置。

        Device Drivers --->

        <*> Memory Technology Device (MTD) support --->

        [*] MTD partitioning support

        系統啟動,出現如下信息時,說明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"

        根文件系統啟動到最后,出現如下錯誤。

        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)

        [] (unwind_backtrace+0x0/0xec) from [] (panic+0x54/0x174)

        [] (panic+0x54/0x174) from [] (mount_block_root+0x1d0/0x210)

        [] (mount_block_root+0x1d0/0x210) from [] (mount_root+0xa0/0xc0)

        [] (mount_root+0xa0/0xc0) from [] (prepare_namespace+0x164/0x1bc)

        [] (prepare_namespace+0x164/0x1bc) from [] (kernel_init+0x10c/0x14c)

        [] (kernel_init+0x10c/0x14c) from [] (kernel_thread_exit+0x0/0x8)

        上面的問題在于沒有配置好mtd的驅動,對驅動進行如下配置,下面分別表示可以將MTD設備當作字符設備和塊設備進行操作。選擇之后通過NFS掛載,在/dev/目錄下出現mtdblock1、mtdblock2、mtdblock3、mtdblock4設備節點。

        <*> Memory Technology Device (MTD) support --->

        <*> Direct char device access to MTD devices

        <*> Caching block device access to MTD devices

        上面的配置完成后,出現如下錯誤:

        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)

        [] (unwind_backtrace+0x0/0xec) from [] (panic+0x54/0x174)

        [] (panic+0x54/0x174) from [] (mount_block_root+0x1d0/0x210)

        [] (mount_block_root+0x1d0/0x210) from [] (mount_root+0xa0/0xc0)

        [] (mount_root+0xa0/0xc0) from [] (prepare_namespace+0x164/0x1bc)

        [] (prepare_namespace+0x164/0x1bc) from [] (kernel_init+0x10c/0x14c)

        [] (kernel_init+0x10c/0x14c) from [] (kernel_thread_exit+0x0/0x8)

        在網上查了下,說是要關閉Hard ECC,關閉之后又出現如下錯誤,可能是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)

        [] (unwind_backtrace+0x0/0xec) from [] (panic+0x6c/0x188)

        [] (panic+0x6c/0x188) from [] (mount_block_root+0x1d0/0x210)

        [] (mount_block_root+0x1d0/0x210) from [] (mount_root+0xa0/0xc0)

        [] (mount_root+0xa0/0xc0) from [] (prepare_namespace+0x158/0x1b0)

        [] (prepare_namespace+0x158/0x1b0) from [] (kernel_init+0x10c/0x14c)

        [] (kernel_init+0x10c/0x14c) from [] (kernel_thread_exit+0x0/0x8)

        5、制作ubifs文件系統

        先使用NFS掛載文件系統,使用如下配置:

        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文件系統,其中mtd3分區即為ubifs分區。使用如下命令將文件系統燒錄進nand中。(注意需要關閉硬件ECC校驗,否則/sbin/ubiattach /dev/ubi_ctrl -m 3會出錯)。

        且讀取啟動開發板時會出現如下錯誤:

        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,當出現如下錯誤時,說明ubifs文件系統未配置好。

        ubiattach: error!: UBI is not present in the system

        再次執行make menuconfig配置好ubifs文件系統

        File systems --->

        [*] Miscellaneous filesystems --->

        <*> UBIFS file system support

        新建一個文件夾rootfs_qtopia,將開發板所提供的源碼包qtopia.tar.gz解壓進去。同時解壓源碼包qtopia-2.2.0-Real6410.tar.bz2,并對其進行編譯,執行./build命令。安裝結果就在qtopia-2.2.0-Real6410/qtopia/image/opt目錄。使用編譯出來的qtopia-2.2.0-Real6410/qtopia/image/opt替換rootfs_qtopia/opt。打包成Qt文件系統

        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

        /



        關鍵詞: real6410移植記

        評論


        技術專區

        關閉
        主站蜘蛛池模板: 芜湖县| 新沂市| 平邑县| 博客| 沭阳县| 哈尔滨市| 宕昌县| 太康县| 泸水县| 阳城县| 郸城县| 桂平市| 松潘县| 甘谷县| 葵青区| 澄江县| 大荔县| 青铜峡市| 剑河县| 长宁县| 合川市| 胶州市| 安泽县| 长乐市| 金秀| 富源县| 凌海市| 和政县| 东阳市| 湄潭县| 吕梁市| 大悟县| 洛扎县| 七台河市| 南宁市| 甘德县| 霍州市| 肥东县| 佛冈县| 兴安县| 三亚市|