본문 바로가기
임베디드기기

Orange Pi Plus (Allwinner H3) 부팅 메커니즘

by Joseph.Lee 2015. 7. 31.

2015.04.01. 22:16




SD카드에 PhoenixCard으로 이미지를 굽고, SD카드를 분석하면서 Allwinner H3의 부팅 메커니즘을 어느정도 알아내었습니다.

(아... 구조가 왜이렇게 난해하게 되어있는지...ㅠㅠ 노가다로 분석해야 되네요. 정보도 없구...)


우선 MBR은 다 지우고 테스트했습니다. 파티션이 하나도 없단 뜻이죠.


분석한 바로는 부트로더가 2부분으로 나뉘어져 있습니다.


16 ~ 79섹터 (64개) : bootloader1

38192 ~ 39951섹터 (1760개) : u-boot (bootloader2)


우선 bootloader1만 SD카드에 있을때 부팅로그입니다.

HELLO! BOOT0 is starting!

boot0 version : 4.0.0

fel_flag = 0x00000000

rtc[0] value = 0x00000000

rtc[1] value = 0x00000000

rtc[2] value = 0x00000000

rtc[3] value = 0x00000000

rtc[4] value = 0x00000000

rtc[5] value = 0x00000000

rtc[6] value = 0x00000000

rtc[7] value = 0x00000000

DRAM DRIVE INFO: V0.8

DRAM Type = 3 (2:DDR2,3:DDR3,6:LPDDR2,7:LPDDR3)

DRAM CLK = 672 MHz

DRAM zq value: 003b3bfb

READ DQS LCDL = 001f1e1f

DRAM SIZE =1024 M

odt delay

dram size =1024

card boot number = 0

card no is 0

sdcard 0 line count 4

[mmc]: mmc driver ver 2014-12-10 21:20:39

[mmc]: ***Try SD card 0***

[mmc]: SD/MMC Card: 4bit, capacity: 7639MB

[mmc]: vendor: Man 00284245 Snr 0000007c

[mmc]: product:

[mmc]: revision: 0.2

[mmc]: ***SD/MMC 0 init OK!!!***

sdcard 0 init ok

ERROR! NOT find the head of uboot.

ERROR! NOT find the head of uboot.

read all u-boot blk failed

Ready to disable icache.

read all u-boot blk failed 라고 나오고 더이상 부팅이 안되는걸 보니 u-boot을 읽어오는데 실패한것으로 보입니다.


bootloader 1+2 모두 SD카드에 있을 때

HELLO! BOOT0 is starting!

boot0 version : 4.0.0

fel_flag = 0x00000000

rtc[0] value = 0x00000000

rtc[1] value = 0x00000000

rtc[2] value = 0x00000000

rtc[3] value = 0x00000000

rtc[4] value = 0x00000000

rtc[5] value = 0x00000000

rtc[6] value = 0x00000000

rtc[7] value = 0x00000000

DRAM DRIVE INFO: V0.8

DRAM Type = 3 (2:DDR2,3:DDR3,6:LPDDR2,7:LPDDR3)

DRAM CLK = 672 MHz

DRAM zq value: 003b3bfb

READ DQS LCDL = 001f1e1f

DRAM SIZE =1024 M

odt delay

dram size =1024

card boot number = 0

card no is 0

sdcard 0 line count 4

[mmc]: mmc driver ver 2014-12-10 21:20:39

[mmc]: ***Try SD card 0***

[mmc]: SD/MMC Card: 4bit, capacity: 7639MB

[mmc]: vendor: Man 00284245 Snr 0000007c

[mmc]: product:

[mmc]: revision: 0.2

[mmc]: ***SD/MMC 0 init OK!!!***

sdcard 0 init ok

ERROR! NOT find the head of uboot.

The size of uboot is 000dc000.

sum=f4220f4d

src_sum=f4220f4d

Succeed in loading uboot from sdmmc flash.

Ready to disable icache.

Jump to secend Boot.

SUNXI_NORMAL_MODE

[      0.348]e mode


U-Boot 2011.09-rc1 (Mar 13 2015 - 12:54:51) Allwinner Technology


[      0.356]version: 1.1.0

normal mode

[      0.363]pmbus:   ready

not set main pmu id

axp_probe error

[      0.378]PMU: pll1 1200 Mhz,PLL6=600 Mhz

AXI=400 Mhz,AHB=200 Mhz, APB1=100 Mhz

sid read already

fel key new mode

run key detect

no key found

no key input

dram_para_set start

dram_para_set end

normal mode

[      0.408]DRAM:  1 GiB

relocation Offset is: 35af9000

[box standby] read rtc = 0x0

[box_start_os] mag be start_type no use

user_gpio config

user_gpio ok

gic: normal or no secure os mode

workmode = 0

MMC:     0

[      0.482][mmc]: mmc driver ver 2014-12-10 9:23:00

[      0.487][mmc]: get sdc_phy_wipe fail.

[      0.491][mmc]: get sdc0 sdc_erase fail.

[      0.495][mmc]: get sdc_f_max fail,use default 50000000Hz

[      0.500][mmc]: get sdc_ex_dly_used fail,use default dly

[      0.506][mmc]: SUNXI SD/MMC: 0

[      0.519][mmc]: *Try SD card 0*

[      0.552][mmc]: CID 0x28424520 0x20202020 0x2000000 0x7c00f2ed

[      0.557][mmc]: mmc clk 50000000

[      0.561][mmc]: SD/MMC Card: 4bit, capacity: 7639MB

[      0.565][mmc]: boot0 capacity: 0KB,boot1 capacity: 0KB

[      0.571][mmc]: ***SD/MMC 0 init OK!!!***

[      0.575][mmc]: erase_grp_size:0x1WrBlk * 0x200 = 0x200 Byte

[      0.581][mmc]: secure_feature 0x0

[      0.584][mmc]: secure_removal_type  0x0

[      0.588]sunxi flash init ok

script config pll_de to 864 Mhz

Not Found clk pll_video1 in script

script config pll_video to 297 Mhz

[boot]disp_init_tv

[DISP_TV] disp_init_tv enter g_tv_used

screen 0 do not support TV TYPE!

[BOOOT_DISP_TV] disp tv device_registered

unable to find regulator vcc-hdmi-18 from [pmu1_regu] or [pmu2_regu]

enable power vcc-hdmi-18, ret=-1

DRV_DISP_Init end

boot_disp.auto_hpd=1

auto hpd check has 50 times!

[disk_read_fs] no the partition

error: open disp_rsl.fex, maybe it is not exist

attched ok, mgr1<-->device1, type=2, mode=11----

ready to set mode

disp_tv_enable

[      1.429]finally, output_type=0x2, output_mode=0xb, screen_id=0x1, disp_para=0x20b0000

fail to find part named env

Using default environment


In:    serial

Out:   serial

Err:   serial

--------fastboot partitions--------

mbr not exist

base bootcmd=run setargs_nand boot_normal

bootcmd set setargs_mmc

key 0

cant find rcvy value

cant find fstbt value

no misc partition is found

to be run cmd=run setargs_mmc boot_normal

[      1.466][mmc]: MMC Device 2 not found

[      1.470][mmc]: Can not find mmc dev

[      1.474][mmc]: read first backup failed in fun sdmmc_secure_storage_read line 1849

sunxi_secstorage_read fail

get secure storage map err

the private part isn't exist

WORK_MODE_BOOT

adver not need show

sunxi_bmp_logo_display

[disk_read_fs] no the partition

error: open bootlogo.bmp, maybe it is not exist

sunxi bmp info error : unable to open logo file bootlogo.bmp

[      1.507]Hit any key to stop autoboot:  0

cant find part named boot

sunxi_flash - sunxi_flash sub-system


Usage:

sunxi_flash read command parmeters :

parmeters 0 : addr to load(hex only)

parmeters 1 : the name of the part to be load

[parmeters 2] : the number of bytes to be load(hex only)

if [parmeters 2] not exist, the number of bytes to be load is the size of the part indecated on partemeter 1

boota: bad boot image magic, maybe not a boot.img?

sunxi#

위와같은 오류가 뜨지만 u-boot는 잘 됩니다~

아무래도 특정한 다른 부분에 u-boot header정보가 있는걸로 보입니다.

예상가는 부분이 있었긴 한데 다시 확인해 봐야 되겠네요~

---음... 아니네요..ㅠㅠ 14번 섹터에 PHOENIX_CARD_IMG 이라고 시작하며

50 48 4F 45 4E 49 58 5F 43 41 52 44 5F 49 4D 47 PHOENIX_CARD_IMG

00 01 20 00 0B 00 02 00 00 00 00 00 00 00 00 00 ...........................


아래와 같은 내용이 있었습니다.

10 00 00 00 00 80 00 00 4B 4B 47 00 61 64 64 00 .....€..KKG.add.

 bootloader1섹터 위치 (00 00 00 10 / Little Endian)

30 95 00 00 00 C0 0D 00 11 78 26 05 61 64 64 00 0•...A...x&.add.

 bootloader2(u-boot)섹터 위치 (00 00 30 95 / Little Endian)

00 A0 00 00 00 00 01 00 BE 3A 01 00 61 64 64 00

00 20 01 00 00 14 7C 00 F8 4E 17 08 61 64 64 00

00 A0 01 00 00 00 02 00 4B 59 01 00 61 64 64 00

 u-boot env섹터 위치 (00 01 A0 00 / Little Endian)


이부분이 헤더인줄 알았는데 아니네요..ㅠㅠ

head of uboot 가 무엇일까요??

분명히 uboot는 다 있는데... (38192~ 39951섹터)


*** 이유를 찾았습니다...

이유는... 없습니다!

오리지날 SD카드(모두 라이팅한)으로 부팅해봐도.. 저런 오류가 뜨네요..ㅠㅠ



참고... 여기있는 Allwinner H3 의 u-boot에서 지원하는 것들!

 sunxi#help

?       - alias for 'help'

advert  - show default advert

aw_fatload- load binary file from a dos filesystem

base    - print or set address offset

boot    - boot default, i.e., run 'bootcmd'

boota   - boota   - boot android bootimg from memory


bootd   - boot default, i.e., run 'bootcmd'

bootelf - Boot from an ELF image in memory

bootm   - boot application image from memory

bootvx  - Boot vxWorks from an ELF image

check_userdata- check user data

cmp     - memory compare

cp      - memory copy

crc32   - checksum calculation

delay_test- do a delay test

efex    - run to efex

efex_test- do a usb efex test

efuse_read- read efuse key

env     - environment handling commands

exit    - exit script

false   - do nothing, unsuccessfully

fastboot_test- do a sprite test

fatdown - download data to a dos filesystem

fatinfo - print information about filesystem

fatload - load binary file from a dos filesystem

fatls   - list files in a directory (default /)

go      - start application at address 'addr'

help    - print command description/usage

huk_test- create a huk as a test

key_test- Test the key value


logo    - show default logo

loop    - infinite loop on address range

mass_test- do a usb mass test

md      - memory display

memcpy_test- do a memcpy test

memtester- start application at address 'addr'

mm      - memory modify (auto-incrementing address)

mmc     - MMC sub system

mmcinfo - display MMC info

mtest   - simple RAM read/write test

mw      - memory write (fill)

nm      - memory modify (constant address)

power_probe- probe the axp output

printenv- print environment variables

pst     - read data from secure storageerase flag in secure storage

recovery- sunxi recovery function

reset   - Perform RESET of the CPU

run     - run commands in an environment variable

save_userdata- save user data

savecfg - save sys_config into flash if you execute command setcfg

saveenv - save environment variables to persistent storage

screen_char- show default screen chars

setcfg  - modify sys_config.fex

setenv  - set environment variables

showvar - print local hushshell variables

shutdown- shutdown the system

sprite_recovery- one key sprite recovery


sprite_test- do a sprite test

standby - run to boot standby

sunxi_bmp_info- manipulate BMP image data

sunxi_bmp_show- manipulate BMP image data

sunxi_boot_signature- sunxi_boot_signature sub-system

sunxi_flash- sunxi_flash sub-system

sunxi_so- sunxi_so sub-system

sys_config- show the sys config value

test    - minimal test like /bin/sh

timer_test- do a timer and int test

timer_test1- do a timer and int test

true    - do nothing, successfully

uburn   - do a burn from boot

version - print monitor, compiler and linker version

 



이제... 커널컴파일만 하면 어찌어찌 OS설치도 될텐데...

반응형

댓글