Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to migrate uboot from 0 to support exynos4412?

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to port uboot from 0 to support exynos4412?, Xiaobian thinks it is quite practical, so share it with you for reference. I hope you can gain something after reading this article.

The main purpose of this article is how to compile and transplant uboot from 0, increase serial port, network, emmc and other functions, so that he supports exynos4412 development board.

I. Transplantation steps 1. Uboot configuration

1. Specify the cross-compile toolchain to enter the root directory of uboot code

$ cd u-boot-2013.01

Modify Makefile

ifeq ($(HOSTARCH),$(ARCH)) CROSS_COMPILE ?= endif

added

ifeq (arm,$(ARCH)) CROSS_COMPILE ?= arm-none-linux-gnueabi- endif

Cross-compilation tools

2. CPU for our products is exynos 4412;

View u-boot source code:

arch/arm/cpu/armv7/exynos/

U-boot already supports this CPU.

3. Specific product BOARD Samsung has released initialization programs for the exynos 4412:

origen

4. CPU hardware information corresponding to the CPU hardware information header file is located in the following locations:

include/configs/origen.h

This file defines some of the resource information required for uboot startup about exynos 4412.

5.boards.cfg In uboot-2013-01, check the boards it supports and the corresponding information in the boards.cfs file under the top-level directory. The subsequent compilation process needs to retrieve the corresponding information according to the configuration name. The format of the document is as follows:

The configuration is more standardized than in previous versions, and these are just a description of a folder of related file categories. Following this hierarchy, we can easily configure our boards.

6. Compile u-boot

Different versions of uboot configuration commands may be different, the source package file README usually has the corresponding configuration command [other versions of uboot will be different]:

The configuration and compilation commands are as follows:

$ make distclean $ make origen_config

The configuration command generates the following files:

include/config.h

config.h

Compile:

$ make all

The u-boot.bin generated after compilation is the executable image file.

But it doesn't generate uboot that really fits our board, it just fits the reference board, the file can't run on our board yet, we need to modify the u-boot source code accordingly.

2. Confirm that the first command has been run to (lighting method)

Add the lighting program after arch/arm/cpu/armv7/start.S line 134

#if 1 ldr r0, =0x11000c40 @GPX2_7 led2 ldr r1, [r0] bic r1, r1, #0xf0000000 orr r1, r1, #0x10000000 str r1, [r0] ldr r0, =0x11000c44 mov r1,#0xff str r1, [r0] #endif

Because uboot just started, the serial port did not have time to initialize, we can determine whether the program is executed here by lighting the LED.

Code detailed reference "ten, LED assembly, C language driver writing"

3. Add Samsung encryption method

Exynos requires the initial boot encryption provided by Samsung before our u-boot can be booted to run. This requires the following commands or tools provided by Samsung. The purpose of these operations is to perform some processing on uboot.bin according to the startup requirements of Samsung's chip, including adding and verifying information at specific length positions and inserting some file segments.

$cp sdfuse_q u-boot-2013.01 -rf $ chmod 777 u-boot-2013.01/sdfuse_q -R $cp CodeSign4SecureBoot u-boot-2013.01 -rf

Note: CodeSign4SecureBoot is a secure boot method provided by Samsung, and the corresponding program is provided by Samsung. The files in the sdfuse_q directory are encrypted files written for the Sanxingdui uboot.bin file format.

Modify the root directory Makefile, implement sdfuse_q compilation

$(obj)u-boot.bin: $(obj)u-boot $(OBJCOPY) ${OBJCFLAGS} -O binary $

< $@ $(BOARD_SIZE_CHECK) 下添加 @#./mkuboot @split -b 14336 u-boot.bin bl2 @make -C sdfuse_q/ @#cp u-boot.bin u-boot-4212.bin @#cp u-boot.bin u-boot-4412.bin @#./sdfuse_q/add_sign @./sdfuse_q/chksum @./sdfuse_q/add_padding @rm bl2a* @echo 注意是tab键缩进的,否则makefile编译报错 注意如果执行了make distclean 需重新拷贝CodeSign4SecureBoot 为方便起见,在根目录下创建编译脚本build.sh,该脚本将自动完成添加加密方式。 1 #!/bin/sh 2 3 sec_path="CodeSign4SecureBoot/" 4 CPU_JOB_NUM=$(grep processor /proc/cpuinfo | awk '{field=$NF};END{print field+1}') 5 ROOT_DIR=$(pwd) 6 CUR_DIR=${ROOT_DIR##*/} 7 8 case "$1" in 9 clean) 10 echo make clean 11 make mrproper 12 ;; 13 *) 14 15 if [ ! -d $sec_path ] 16 then 17 echo "**********************************************" 18 echo "[ERR]please get the CodeSign4SecureBoot first" 19 echo "**********************************************" 20 return 21 fi 22 23 make origen_config 24 25 make -j$CPU_JOB_NUM 26 27 if [ ! -f checksum_bl2_14k.bin ] 28 then 29 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" 30 echo "There are some error(s) while building uboot, please use command make to check." 31 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" 32 exit 0 33 fi 34 35 cp -rf checksum_bl2_14k.bin $sec_path 36 cp -rf u-boot.bin $sec_path 37 rm checksum_bl2_14k.bin 38 39 cd $sec_path 40 cat E4412_N.bl1.SCP2G.bin bl2.bin all00_padding.bin u-boot.bin tzsw_SMDK4412_SCP_2GB.bin >

u-boot-origen.bin 41 mv u-boot-origen.bin $ROOT_DIR 42 43 rm checksum_bl2_14k.bin 44 rm u-boot.bin 45 46 echo 47 echo 48 ;; 49 50 esac

build script

$ chmod 777 u-boot-2013.01/ build.sh $ ./ buildsh

Note: build.sh script mode automatically adds encryption mode, compile and generate the required file u-boot_origin.bin

root@ubuntu:/home/peng/uboot/u-boot-2013.01# ls api config.mk examples Makefile sdfuse_q u-boot.bin arch COPYING fs mkconfig snapshot.commit u-boot.map board CREDITS helper.mk nand_spl spl u-boot-origen.bin boards.cfg disk include net System.map u-boot.srec build.sh doc lib post test CodeSign4SecureBoot drivers MAINTAINERS README tools common dts MAKEALL rules.mk u-boot

u-boot_origen.bin

4. Serial port output

Modify the lowlevel_init.S file

$vim board/samsung/origen/lowlevel_init.S

a) Add temporary stack,

41 lowlevel_init:

added after

ldr sp,=0x02060000 @use iRom stack in bl2

b) Add Close Watchdog Code:

67 beq wakeup_reset

added after

#if 1 /*for close watchdog */ /* PS-Hold high */ ldr r0, =0x1002330c ldr r1, [r0] orr r1, r1, #0x300 str r1, [r0] ldr r0, =0x11000c08 ldr r1, =0x0 str r1, [r0] /* Clear MASK_WDT_RESET_REQUEST */ ldr r0, =0x1002040c ldr r1, =0x00 str r1, [r0] #endif

c) Add serial port initialization code: in uart_asm_init:

351 str r1, [r0, #EXYNOS4_GPIO_A1_CON_OFFSET]

added after

ldr r0, =0x10030000 ldr r1, =0x666666 ldr r2, =CLK_SRC_PERIL0_OFFSET str r1, [r0, r2] ldr r1, =0x777777 ldr r2, =CLK_DIV_PERIL0_OFFSET str r1, [r0, r2]

d) comment out trustzone initialization comment out

104 bl uart_asm_init

The code below:

#if 0 bl tzpc_init #endif5. Network card transplantation

Because the network cards used by various manufacturers are different, the drivers provided by Samsung only reserve the function entry for network card initialization. For different boards, we need to transplant the driver of the network card for the circuit itself. The driver of the network card is explained in detail, which we will explain in detail in the later chapter.

1. Add network initialization code

$ vim board/samsung/origen/origen.c

in

31 struct exynos4_gpio_part2 *gpio2;

Add the following:

#ifdef CONFIG_DRIVER_DM9000 #define EXYNOS4412_SROMC_BASE 0X12570000 #define DM9000_Tacs (0x1) #define DM9000_Tcos (0x1) #define DM9000_Tacc (0x5) #define DM9000_Tcoh (0x1) #define DM9000_Tah (0xC) #define DM9000_Tacp (0x9) #define DM9000_PMC (0x1) struct exynos_sromc { unsigned int bw; unsigned int bc[6]; }; /* * s5p_config_sromc() - select the proper SROMC Bank and configure the * band width control and bank control registers * srom_bank - SROM * srom_bw_conf - SMC Band witdh reg configuration value * srom_bc_conf - SMC Bank Control reg configuration value */ void exynos_config_sromc(u32 srom_bank, u32 srom_bw_conf, u32 srom_bc_conf) { unsigned int tmp; struct exynos_sromc *srom = (struct exynos_sromc *)(EXYNOS4412_SROMC_BASE); /* Configure SMC_BW register to handle proper SROMC bank */ tmp = srom->bw; tmp &= ~(0xF bw = tmp; /* Configure SMC_BC register */ srom->bc[srom_bank] = srom_bc_conf; } static void dm9000aep_pre_init(void) { unsigned int tmp; unsigned char smc_bank_num = 1; unsigned int smc_bw_conf=0; unsigned int smc_bc_conf=0; /* gpio configuration */ writel(0x00220020, 0x11000000 + 0x120); writel(0x00002222, 0x11000000 + 0x140); /* 16 Bit bus width */ writel(0x22222222, 0x11000000 + 0x180); writel(0x0000FFFF, 0x11000000 + 0x188); writel(0x22222222, 0x11000000 + 0x1C0); writel(0x0000FFFF, 0x11000000 + 0x1C8); writel(0x22222222, 0x11000000 + 0x1E0); writel(0x0000FFFF, 0x11000000 + 0x1E8); smc_bw_conf &= ~(0xf

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report