关闭

将u-boot-2016.11移植到TINY4412

1201人阅读 评论(0) 收藏 举报
分类:

    在工作之余显得有点无聊,就想着将u-boot-2016.11移植到TINY4412上试一试,下面是自己的移植过程,也当作一个学习笔记吧,记录记录下步骤和自己解决问题的过程。

    移植之前也看了一写博客,因为想支持uboot的spl,所以就选择origen左右模板移植一个uboot到tiny4412上

    1. 首先我们在终端上通过find -name "*origen*" 看和origen相关的文件有哪些,然后将这些文件或者文件夹复制成TINY4412。

   

   

上面的图修正一下, ./board/samsung/tiny4412/tools/tiny4412.c 重命名为mktiny4412spl.c

    2. 修改相关文件的内容

    这一步其实也很简单,我们这边在终端通过 grep -insr "origen" 查看和origen相关的内容,然后模仿origen,将origen字眼改成tiny4412即可。

    2.1 修改顶层目录的makefile

diff --git a/Makefile b/Makefile
index 8ca1db5..c65f484 100644
--- a/Makefile
+++ b/Makefile
@@ -246,6 +246,9 @@ ifeq ($(HOSTARCH),$(ARCH))
 CROSS_COMPILE ?=
 endif
 
+ARCH ?= arm
+CROSS_COMPILE ?= arm-none-eabi-
+
 KCONFIG_CONFIG ?= .config
 export KCONFIG_CONFIG


    2.2 修改exynos4210-tiny4412.dts文件并将其添加到makefile文件中

    ----- arch/arm/dts/exynos4210-tiny4412.dts

diff --git a/arch/arm/dts/exynos4210-tiny4412.dts b/arch/arm/dts/exynos4210-tiny4412.dts
index 26c4d7f..a4fe14f 100644
--- a/arch/arm/dts/exynos4210-tiny4412.dts
+++ b/arch/arm/dts/exynos4210-tiny4412.dts
@@ -1,5 +1,5 @@
 /*
- * Samsung's Exynos4210 based Origen board device tree source
+ * Tiny4412 board device tree source
  *
  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  *             http://www.samsung.com
@@ -9,22 +9,29 @@
 
 /dts-v1/;
 #include "skeleton.dtsi"
-#include "exynos4210.dtsi"
+//#include "exynos4210.dtsi"
+#include "exynos4412.dtsi"
 
 / {
-       model = "Insignal Origen evaluation board based on Exynos4210";
-       compatible = "insignal,origen", "samsung,exynos4210";
+       model = "Insignal Tiny4412 evaluation board based on Exynos4412";
+       compatible = "insignal,tiny4412", "samsung,exynos4412";
 
        chosen {
                bootargs ="";
+               /* 设置uart0作为终端 */
+               stdout-path="serial0";
        };
 
        aliases {
                serial0 = "/serial@13800000";
-               console = "/serial@13820000";
+               console = "/serial@13800000";
                mmc2 = "/sdhci@12530000";
        };
 
+       serial0:serial@13810000 {
+               status = "okay";
+       };
+
        sdhci@12510000 {
                status = "disabled";
        };

    ----- arch/arm/dts/Makefile

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 836a8c4..bfd1c06 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -10,6 +10,7 @@ dtb-$(CONFIG_AT91FAMILY) += at91sam9260-smartweb.dtb \
 dtb-$(CONFIG_S5PC100) += s5pc1xx-smdkc100.dtb
 dtb-$(CONFIG_S5PC110) += s5pc1xx-goni.dtb
 dtb-$(CONFIG_EXYNOS4) += exynos4210-origen.dtb \
+       exynos4210-tiny4412.dtb \
        exynos4210-smdkv310.dtb \
        exynos4210-universal_c210.dtb \
        exynos4210-trats.dtb \

    2.2 修改arch/arm/include/asm/mach-types.h

diff --git a/arch/arm/include/asm/mach-types.h b/arch/arm/include/asm/mach-types.h
index d51be0b..1e64b18 100644
--- a/arch/arm/include/asm/mach-types.h
+++ b/arch/arm/include/asm/mach-types.h
@@ -1062,6 +1062,7 @@ extern unsigned int __machine_arch_type;
 #define MACH_TYPE_MONCH                3453
 #define MACH_TYPE_CURACAO              3454
 #define MACH_TYPE_ORIGEN               3455
+#define MACH_TYPE_TINY4412             5555
 #define MACH_TYPE_EPC10                3456
 #define MACH_TYPE_SGH_I740             3457
 #define MACH_TYPE_TUNA                 3458
@@ -13672,6 +13673,18 @@ extern unsigned int __machine_arch_type;
 # define machine_is_origen()   (0)
 #endif
 
+#ifdef CONFIG_MACH_TINY4412
+# ifdef machine_arch_type
+#  undef machine_arch_type
+#  define machine_arch_type    __machine_arch_type
+# else
+#  define machine_arch_type    MACH_TYPE_TINY4412
+# endif
+# define machine_is_tiny4412() (machine_arch_type == MACH_TYPE_TINY4412)
+#else
+# define machine_is_tiny4412() (0)
+#endif
+
 #ifdef CONFIG_MACH_EPC10
 # ifdef machine_arch_type
 #  undef machine_arch_type

    2.3 修改arch/arm/mach-exynos/Kconfig

diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig
index ce2a16f..1672a59 100644
--- a/arch/arm/mach-exynos/Kconfig
+++ b/arch/arm/mach-exynos/Kconfig
@@ -50,6 +50,10 @@ config TARGET_ORIGEN
        bool "Exynos4412 Origen board"
        select SUPPORT_SPL
 
+config TARGET_TINY4412
+       bool "Exynos4412 Tiny4412 board"
+       select SUPPORT_SPL
+
 config TARGET_TRATS2
        bool "Exynos4412 Trat2 board"
 
@@ -143,6 +147,7 @@ source "board/samsung/smdkv310/Kconfig"
 source "board/samsung/trats/Kconfig"
 source "board/samsung/universal_c210/Kconfig"
 source "board/samsung/origen/Kconfig"
+source "board/samsung/tiny4412/Kconfig"
 source "board/samsung/trats2/Kconfig"
 source "board/samsung/odroid/Kconfig"
 source "board/samsung/arndale/Kconfig"

    2.4 修改arch/arm/mach-exynos/dmc_init_exynos4.c

diff --git a/arch/arm/mach-exynos/dmc_init_exynos4.c b/arch/arm/mach-exynos/dmc_init_exynos4.c
index ecddc72..1d3c388 100644
--- a/arch/arm/mach-exynos/dmc_init_exynos4.c
+++ b/arch/arm/mach-exynos/dmc_init_exynos4.c
@@ -175,7 +175,7 @@ void mem_ctrl_init(int reset)
         * 0: full_sync
         */
        writel(1, ASYNC_CONFIG);
-#ifdef CONFIG_ORIGEN
+#if (defined CONFIG_ORIGEN) || (defined CONFIG_TINY4412)
        /* Interleave: 2Bit, Interleave_bit1: 0x15, Interleave_bit0: 0x7 */
        writel(APB_SFR_INTERLEAVE_CONF_VAL, EXYNOS4_MIU_BASE +
                APB_SFR_INTERLEAVE_CONF_OFFSET);

    2.5 修改 arch/arm/mach-exynos/exynos4_setup.h

diff --git a/arch/arm/mach-exynos/exynos4_setup.h b/arch/arm/mach-exynos/exynos4_setup.h
index 9f29d94..f880dc9 100644
--- a/arch/arm/mach-exynos/exynos4_setup.h
+++ b/arch/arm/mach-exynos/exynos4_setup.h
@@ -6,8 +6,14 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
+/*
 #ifndef _ORIGEN_SETUP_H
 #define _ORIGEN_SETUP_H
+*/
+
+/* 不确定这样更改是否有问题,先改着 */
+#ifndef _TINY4412_SETUP_H
+#define _TINY4412_SETUP_H
 
 #include <config.h>
 #include <asm/arch/cpu.h>
@@ -434,7 +440,7 @@ struct mem_timings {
 #define ABP_SFR_SLV1_SINGLE_ADDRMAP_START_OFFSET       0x828
 #define ABP_SFR_SLV1_SINGLE_ADDRMAP_END_OFFSET 0x830
 
-#ifdef CONFIG_ORIGEN
+#if (defined CONFIG_ORIGEN) || (defined CONFIG_TINY4412)
 /* Interleave: 2Bit, Interleave_bit1: 0x15, Interleave_bit0: 0x7 */
 #define APB_SFR_INTERLEAVE_CONF_VAL    0x20001507
 #define APB_SFR_ARBRITATION_CONF_VAL   0x00000001
@@ -556,7 +562,7 @@ struct mem_timings {
 
 #define CONTROL2_VAL           0x00000000
 
-#ifdef CONFIG_ORIGEN
+#if (defined CONFIG_ORIGEN) || (defined CONFIG_TINY4412)
 #define TIMINGREF_VAL          0x000000BB
 #define TIMINGROW_VAL          0x4046654f
 #define        TIMINGDATA_VAL          0x46400506

    2.6 修改 board/samsung/tiny4412/Kconfig

diff --git a/board/samsung/tiny4412/Kconfig b/board/samsung/tiny4412/Kconfig
index 63e3efe..06a7905 100644
--- a/board/samsung/tiny4412/Kconfig
+++ b/board/samsung/tiny4412/Kconfig
@@ -1,12 +1,12 @@
-if TARGET_ORIGEN
+if TARGET_TINY4412
 
 config SYS_BOARD
-       default "origen"
+       default "tiny4412"
 
 config SYS_VENDOR
        default "samsung"
 
 config SYS_CONFIG_NAME
-       default "origen"
+       default "tiny4412"
 
 endif

    2.7 修改 board/samsung/tiny4412/Makefile

diff --git a/board/samsung/tiny4412/Makefile b/board/samsung/tiny4412/Makefile
index 1add9fe..a167418 100644
--- a/board/samsung/tiny4412/Makefile
+++ b/board/samsung/tiny4412/Makefile
@@ -8,15 +8,15 @@ ifdef CONFIG_SPL_BUILD
 # necessary to create built-in.o
 obj- := __dummy__.o
 
-hostprogs-y := tools/mkorigenspl
+hostprogs-y := tools/mktiny4412spl
 always := $(hostprogs-y)
 
 # omit -O2 option to suppress
 #   warning: dereferencing type-punned pointer will break strict-aliasing rules
 #
 # TODO:
-# Fix the root cause in tools/mkorigenspl.c and delete the following work-around
-$(obj)/tools/mkorigenspl: HOSTCFLAGS:=$(filter-out -O2,$(HOSTCFLAGS))
+# Fix the root cause in tools/mktiny4412spl.c and delete the following work-around
+$(obj)/tools/mktiny4412spl: HOSTCFLAGS:=$(filter-out -O2,$(HOSTCFLAGS))
 else
-obj-y  += origen.o
+obj-y  += tiny4412.o
 endif

    2.8 修改 configs/tiny4412_defconfig

diff --git a/configs/tiny4412_defconfig b/configs/tiny4412_defconfig
index 0d91ec1..ee43047 100644
--- a/configs/tiny4412_defconfig
+++ b/configs/tiny4412_defconfig
@@ -1,14 +1,14 @@
 CONFIG_ARM=y
 CONFIG_ARCH_EXYNOS=y
 CONFIG_ARCH_EXYNOS4=y
-CONFIG_TARGET_ORIGEN=y
-CONFIG_IDENT_STRING=" for ORIGEN"
-CONFIG_DEFAULT_DEVICE_TREE="exynos4210-origen"
+CONFIG_TARGET_TINY4412=y
+CONFIG_IDENT_STRING=" for TINY4412"
+CONFIG_DEFAULT_DEVICE_TREE="exynos4210-tiny4412"
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_SPL=y
 CONFIG_HUSH_PARSER=y
-CONFIG_SYS_PROMPT="ORIGEN # "
+CONFIG_SYS_PROMPT="TINY4412 # "
 CONFIG_CMD_BOOTZ=y
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_XIMG is not set

    2.9 修改 include/configs/tiny4412.h

diff --git a/include/configs/tiny4412.h b/include/configs/tiny4412.h
index 26fe402..2c2b5b7 100644
--- a/include/configs/tiny4412.h
+++ b/include/configs/tiny4412.h
@@ -6,14 +6,28 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
+/*
 #ifndef __CONFIG_ORIGEN_H
 #define __CONFIG_ORIGEN_H
+*/
+
+#ifndef __CONFIG_TINY4412_H
+#define __CONFIG_TINY4412_H
 
 #include <configs/exynos4-common.h>
 
 /* High Level Configuration Options */
 #define CONFIG_EXYNOS4210              1       /* which is a EXYNOS4210 SoC */
 #define CONFIG_ORIGEN                  1       /* working with ORIGEN*/
+#define CONFIG_TINY4412                        1
+
+/* 设置串口 */
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_GPIO_SUPPORT
+#define CONFIG_DEBUG_UART
+#define CONFIG_DEBUG_UART_S5P
+#define CONFIG_DEBUG_UART_BASE 0x13800000
+#define CONFIG_DEBUG_UART_CLOCK (100000000)
 
 #define CONFIG_SYS_DCACHE_OFF          1
 
@@ -30,7 +44,10 @@
 
 #define CONFIG_SYS_TEXT_BASE           0x43E00000
 
+#if 0
 #define CONFIG_MACH_TYPE               MACH_TYPE_ORIGEN
+#endif
+#define CONFIG_MACH_TYPE               MACH_TYPE_TINY4412
 
 /* select serial console configuration */
 #define CONFIG_SERIAL2
@@ -52,7 +69,8 @@
 
 /* MMC SPL */
 #define COPY_BL2_FNPTR_ADDR    0x02020030
-#define CONFIG_SPL_TEXT_BASE   0x02021410
+/* 设置SPL链接地址 */
+#define CONFIG_SPL_TEXT_BASE   0x02023400
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
        "loadaddr=0x40007000\0" \
@@ -102,9 +120,15 @@
 
 #define CONFIG_SYS_INIT_SP_ADDR                0x02040000
 
-/* U-Boot copy size from boot Media to DRAM.*/
+/* 设置将uboot拷贝到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)
 
+#define COPY_UBOOT_SIZE        0x80000
+#define UBOOT_START_OFFSET     ((CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)/512)
+#define UBOOT_SIZE_BLOC_COUNT  (COPY_UBOOT_SIZE/512)
+

    到了这里,所有内容基本就修改完毕了。

   

    但是后来在我编译的时候发现,出现了编译异常,但是从结果来看,所需要的文件都编译出来了,所以这一点我现在也不是很清楚原因,不过根据报错的提示:

     是需要在合适的Kconfig文件中添加CONFIG_TINY4412 这个配置选项,所以做了如下修改

   

diff --git a/board/samsung/tiny4412/Kconfig b/board/samsung/tiny4412/Kconfig
index 06a7905..04658fe 100644
--- a/board/samsung/tiny4412/Kconfig
+++ b/board/samsung/tiny4412/Kconfig
@@ -1,5 +1,9 @@
 if TARGET_TINY4412
 
+config TINY4412
+       default y
+       bool "For CONFIG_TINY4412"
+
 config SYS_BOARD
        default "tiny4412"
 

    根据我现在的理解,添加的这config配置并没有实际的使用意义,应该不会对其他内容产生影响,暂且这样修改吧。


   好的,修改就到这里了,这些修改只是能够让编译能够通过了,但是离能在tiny4412上面运行,还有很长一段路呢。


0
2

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:6652次
    • 积分:183
    • 等级:
    • 排名:千里之外
    • 原创:9篇
    • 转载:18篇
    • 译文:0篇
    • 评论:2条
    最新评论