zoukankan      html  css  js  c++  java
  • X-009 FriendlyARM tiny4412 uboot移植之SD Card用起来Kernel boot起来

    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 

    开发环境:win7 64 + VMware12 + Ubuntu14.04 64

    工具链:linaro提供的gcc-linaro-6.1.1-2016.08-x86_64_arm-linux-gnueabi

    要移植的u-boot版本:u-boot-2016-11

    Git仓库地址:https://github.com/X-Project-FriendlyARMTiny4412/u-boot

    Tiny4412开发板硬件版本为

        底板:  Tiny4412/Super4412SDK 1506

           核心板:Tiny4412 - 1412

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 

     

    在上一节中我们已经完成了把u-boot.binSD卡上拷贝到DDR内存,并跳转到DDR内存中去执行u-boot的工作。这节仅先记录下如何把SDCard用起来,并且把Kernelboot起来的一些具体的操作,详细分析后面再写。

     

    1Tiny4412 SDCard用起来

    代码修改如下:

    diff --git a/arch/arm/dts/exynos4412-tiny4412.dts b/arch/arm/dts/exynos4412-tiny4412.dts

    index a467250..3010f50 100644

    --- a/arch/arm/dts/exynos4412-tiny4412.dts

    +++ b/arch/arm/dts/exynos4412-tiny4412.dts

    @@ -1,29 +1,135 @@

     /*

    - * FriendlyARM Tiny4412 board device tree source

    - *

    + * FriendlyARM's Exynos4412 based TINY4412 board device tree source

      *             2016

      *  Author  AP0904225 <ap0904225@qq.com>

      *

    - * SPDX-License-Identifier:    GPL-2.0+

    - */

    + * Device tree source file for FriendlyARM's TINY4412 board which is based on

    + * Samsung's Exynos4412 SoC.

    + *

    + * This program is free software; you can redistribute it and/or modify

    + * it under the terms of the GNU General Public License version 2 as

    + * published by the Free Software Foundation.

    + *

    + * SPDX-License-Identifier:    GPL-2.0+

    + *

    +*/

     

     /dts-v1/;

     #include "exynos4412.dtsi"

     

     / {

    -   model = "Tiny4412 based on Exynos4412";

    -   compatible = "samsung,tiny4412", "samsung,exynos4412";

    -

    -   chosen {

    -       stdout-path = "serial0";

    -   };

    +   model = "FriendlyARM TINY4412 board based on Exynos4412";

    +   compatible = "friendlyarm,tiny4412", "samsung,exynos4412", "samsung,exynos4";

     

        aliases {

            serial0 = "/serial@13800000";

            console = "/serial@13800000";

    +       mmc2 = "/sdhci@12530000";

    +       mmc4 = "/dwmmc@12550000";

        };

     

    -   serial0:serial@13810000 {

    +   memory {

    +       reg = <0x40000000 0x40000000>;

    +   };

    +

    +   serial0:serial@13800000 {

            status = "okay";

        };

    +

    +   serial1:serial@13810000 {

    +       status = "disabled";

    +   };

    +

    +   serial2:serial@13820000 {

    +       status = "disabled";

    +   };

    +

    +   serial3:serial@13830000 {

    +       status = "disabled";

    +   };

    +

    +   serial4:serial@13840000 {

    +       status = "disabled";

    +   };

    +

    +   i2c@13860000 {

    +       status = "disabled";

    +   };

    +

    +   i2c@13870000 {

    +       status = "disabled";

    +   };

    +

    +   i2c@13880000 {

    +       status = "disabled";

    +   };

    +

    +   i2c@13890000 {

    +       status = "disabled";

    +   };

    +

    +   i2c@138a0000 {

    +       status = "disabled";

    +   };

    +

    +   i2c@138b0000 {

    +       status = "disabled";

    +   };

    +

    +   i2c@138c0000 {

    +       status = "disabled";

    +   };

    +

    +   i2c@138d0000 {

    +       status = "disabled";

    +   };

    +

    +   sdhci@12510000 {

    +       compatible = "samsung,exynos4412-sdhci";

    +       status = "disabled";

    +   };

    +

    +   sdhci@12520000 {

    +       compatible = "samsung,exynos4412-sdhci";

    +       status = "disabled";

    +   };

    +

    +   sdhci@12530000 {

    +       compatible = "samsung,exynos4412-sdhci";

    +       samsung,bus-width = <4>;

    +       samsung,timing = <1 2 3>;

    +       cd-gpios = <&gpk2 2 0>;

    +   };

    +

    +   sdhci@12540000 {

    +       compatible = "samsung,exynos4412-sdhci";

    +       status = "disabled";

    +   };

    +

    +   dwmmc@12550000 {

    +       samsung,bus-width = <8>;

    +       samsung,timing = <2 1 0>;

    +       samsung,removable = <0>;

    +       fifoth_val = <0x203f0040>;

    +       bus_hz = <400000000>;

    +       div = <0x3>;

    +       index = <4>;

    +   };

    +

    +   ehci@12580000 {

    +       compatible = "samsung,exynos-ehci";

    +       reg = <0x12580000 0x100>;

    +       #address-cells = <1>;

    +       #size-cells = <1>;

    +       phy {

    +           compatible = "samsung,exynos-usb-phy";

    +           reg = <0x125B0000 0x100>;

    +       };

    +   };

    +

    +   emmc-reset {

    +       compatible = "samsung,emmc-reset";

    +       reset-gpio = <&gpk1 2 0>;

    +   };

    +

     };

    diff --git a/configs/tiny4412_defconfig b/configs/tiny4412_defconfig

    index 19d0dda..62ed0d2 100644

    --- a/configs/tiny4412_defconfig

    +++ b/configs/tiny4412_defconfig

    @@ -1,6 +1,3 @@

    -#

    -# U-Boot 2016.11 Configuration for FriendlyARM tiny4412

    -#

     CONFIG_ARM=y

     CONFIG_ARCH_EXYNOS=y

     CONFIG_ARCH_EXYNOS4=y

    @@ -11,34 +8,43 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y

     CONFIG_SYS_CONSOLE_INFO_QUIET=y

     CONFIG_SPL=y

     CONFIG_HUSH_PARSER=y

    -CONFIG_SYS_PROMPT="TINY4412 # "

    +CONFIG_SYS_PROMPT="Tiny4412 # "

     CONFIG_CMD_BOOTZ=y

    +# CONFIG_CMD_IMLS is not set

    +# CONFIG_CMD_XIMG is not set

    +CONFIG_DM_MMC=y

     CONFIG_CMD_MMC=y

    +CONFIG_CMD_DFU=y

    +CONFIG_CMD_USB_MASS_STORAGE=y

    +# CONFIG_CMD_FPGA is not set

    +# CONFIG_CMD_NET is not set

    +CONFIG_CMD_DHCP=y

    +# CONFIG_CMD_NFS is not set

     CONFIG_CMD_MII=y

     CONFIG_CMD_CACHE=y

    +# CONFIG_CMD_MISC is not set

     CONFIG_CMD_EXT2=y

     CONFIG_CMD_EXT4=y

     CONFIG_CMD_EXT4_WRITE=y

     CONFIG_CMD_FAT=y

     CONFIG_CMD_FS_GENERIC=y

     CONFIG_OF_CONTROL=y

    +CONFIG_DFU_MMC=y

    +CONFIG_USB=y

    +CONFIG_DM_USB=y

    +CONFIG_USB_GADGET=y

    +CONFIG_USB_GADGET_DWC2_OTG=y

    +CONFIG_USB_GADGET_DOWNLOAD=y

    +CONFIG_G_DNL_MANUFACTURER="Samsung"

    +CONFIG_G_DNL_VENDOR_NUM=0x04e8

    +CONFIG_G_DNL_PRODUCT_NUM=0x6601

     

     #

     #DEBUG UART

     #

    -CONFIG_DEBUG_UART=y

    -CONFIG_SPL_SERIAL_SUPPORT=y

    -CONFIG_SPL_GPIO_SUPPORT=y

    -CONFIG_DEBUG_UART_S5P=y

    -CONFIG_DEBUG_UART_BASE=0x13800000

    -CONFIG_DEBUG_UART_CLOCK=100000000

    -

    -#

    -#NOTE:do not delete this:

    -#

    -# CONFIG_CMD_IMLS is not set

    -# CONFIG_CMD_XIMG is not set

    -# CONFIG_CMD_MISC is not set

    -# CONFIG_CMD_FPGA is not set

    -# CONFIG_CMD_NET is not set

    -# CONFIG_CMD_NFS is not set

    +#CONFIG_DEBUG_UART=y

    +#CONFIG_SPL_SERIAL_SUPPORT=y

    +#CONFIG_SPL_GPIO_SUPPORT=y

    +#CONFIG_DEBUG_UART_S5P=y

    +#CONFIG_DEBUG_UART_BASE=0x13800000

    +#CONFIG_DEBUG_UART_CLOCK=100000000

    diff --git a/include/configs/tiny4412.h b/include/configs/tiny4412.h

    index 3a02f9e..4197e16 100644

    --- a/include/configs/tiny4412.h

    +++ b/include/configs/tiny4412.h

    @@ -1,5 +1,5 @@

     /*

    - *         2016

    + *         2017

      *     Author AP0904225 <ap0904225@qq.com>

      *

      * Configuration settings for the FriendlyARM TINY4412 (EXYNOS4412) board.

    @@ -15,10 +15,6 @@

     

     #include <configs/exynos4-common.h>

     

    -/* TIZEN THOR downloader support */

    -#undef CONFIG_CMD_THOR_DOWNLOAD

    -#undef CONFIG_USB_FUNCTION_THOR

    -

     /* High Level Configuration Options */

     #define TINY4412           1   /* working with TINY4412*/

     

    @@ -36,15 +32,15 @@

     #define CONFIG_SYS_LOAD_ADDR       (CONFIG_SYS_SDRAM_BASE + 0x3E00000)

     

     #define CONFIG_SYS_TEXT_BASE       0x43E00000

    +#define CONFIG_SYS_INIT_SP_ADDR        (CONFIG_SYS_TEXT_BASE - 0x1000000)

     

     #define CONFIG_MACH_TYPE       MACH_TYPE_TINY4412

     

     /* select serial console configuration */

    -#define CONFIG_SERIAL2

     #define CONFIG_BAUDRATE            115200

     

     /* Console configuration */

    -#define CONFIG_DEFAULT_CONSOLE     "console=ttySAC1,115200n8"

    +#define CONFIG_DEFAULT_CONSOLE     "console=ttySAC0,115200n8"

     

     #define CONFIG_SYS_MEM_TOP_HIDE    (1 << 20)   /* ram console */

     

    @@ -93,10 +89,10 @@

        "fi;"

        "load mmc ${mmcdev} ${loadaddr} uImage; bootm ${loadaddr} "

     

    -#define CONFIG_CLK_1000_400_200

    +/* //#define CONFIG_CLK_1000_400_200 */

     

     /* MIU (Memory Interleaving Unit) */

    -#define CONFIG_MIU_2BIT_21_7_INTERLEAVED

    +/* //#define CONFIG_MIU_2BIT_21_7_INTERLEAVED */

     

     #define CONFIG_ENV_IS_IN_MMC

     #define CONFIG_SYS_MMC_ENV_DEV     0

    @@ -109,13 +105,10 @@

     #define CONFIG_SPL_LDSCRIPT    "board/samsung/common/exynos-uboot-spl.lds"

     #define CONFIG_SPL_MAX_FOOTPRINT   (14 * 1024)

     

    -#define CONFIG_SYS_INIT_SP_ADDR        0x02040000

    -

    -/* U-Boot copy size from SD/MMC to DRAM.*/

    +/* U-Boot copy size from boot Media to DRAM.*/

     #define COPY_BL2_SIZE      0x80000

     #define BL2_START_OFFSET   ((CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)/512)

     #define BL2_SIZE_BLOC_COUNT    (COPY_BL2_SIZE/512)  /* u-boot size is 512K */

    -

     /*

      *    SD/MMC(1 Block = 512B) layout:

      *    +------------+-------------------------------------------------------------------------------------------------+

    @@ -130,5 +123,4 @@

      */

     

     

    -

     #endif /* __CONFIG_H */

     

     

     

     

    2Kernel boot起来

        2.1 先把u-boot烧进SD卡,并把uImageramdisk.imgexynos4412-tiny4412.dtb拷贝进SD卡,这三个文件的下载地址为:http://files.cnblogs.com/files/AP0904225/tiny4412-test-image.tar.gz

    tiny4412开发板从SD卡启动后,使其进入u-boot命令行状态,如下图所示:

    image

    2.2 输入mmcinfo命令查看下SD/MMC设备信息:

    image

    2.3 设置bootcmd参数

    设置bootcmd变量为 "load mmc 0 0x40007000 uImage; load mmc 0 0x48000000 ramdisk.img; load mmc 0 0x42000000 exynos4412-tiny4412.dtb; bootm 0x40007000 0x48000000 0x42000000";并保存。

    load mmc 0 0x40007000 uImage 是把SD卡上的uImage文件读到内存地址为0x40007000处;

    load mmc 0 0x48000000 ramdisk.img 是把SD卡上的ramdisk.img文件读到内存地址为0x48000000处;

    load mmc 0 0x42000000 exynos4412-tiny4412.dtb是把SD卡上的exynos4412-tiny4412.dtb读到内存地址为0x42000000处;

    bootm 0x40007000 0x48000000 0x42000000是告诉u-boot0x40007000处启动内核,并告诉内核ramdisk.img和设备树文件(*.dtb)的地址为0x480000000x42000000

    image

    2.4查看下u-boot的环境变量:

    image

    然输入boot命令后就把kernel boot起来了

    image

     

     

  • 相关阅读:
    java算法
    2012 要找回曾经的忘我的激情
    啊啊啊
    利用ORACLE JOB 模拟多线程应用
    有没有一种数据库叫思科
    且行好事,莫问前程
    女人浪漫的好点子
    What is the difference between interface and abstract class
    优秀是一种习惯
    C#判断ContextMenuStrip右键菜单的来源(从哪个控件弹出来的) (转载)
  • 原文地址:https://www.cnblogs.com/LoTGu/p/6405131.html
Copyright © 2011-2022 走看看