Chinaunix首页 | 论坛 | 博客
  • 博客访问: 700845
  • 博文数量: 109
  • 博客积分: 1751
  • 博客等级: 上尉
  • 技术积分: 1816
  • 用 户 组: 普通用户
  • 注册时间: 2011-05-31 22:37
文章分类

全部博文(109)

文章存档

2014年(9)

2013年(21)

2012年(48)

2011年(31)

分类: LINUX

2011-08-30 10:07:05

Samsung s5pc1xx 平台 boot squence
Samsung s5pc1xx 平台會有一個internal ROM(iROM)存放BL0

BL0 的booting sequence 如下所示:

1. Initialize the PLL & Clock setting with fixed value
2. Initialize the stack and heap region.
3. Initialize the Instruction Cache controller.
4. Load BL1 (Max 8KB) from the booting device (ex: NAND, SD/MMC,and OneNAND) to iRAM.
5. If secure booting is enabled, execute integrity check
6. If integrity check passes, then jump to BL1 in iRAM (0xD0034000, D0020000+14000)
7. If integrity check fails, then it stops.

BL1 指的是 u-boot.bin 前 8192 bytes (8k bytes)。

若用SD/MMC為boot devices則須用下面的指令將BL1寫到SD card (4G) offset=7897070:

sudo dd if=./my100/u-boot.bin of=/dev/sdb seek=7897070 count=16 bs=512


但實際上BL1指的是以下codes的內容:

cpu/s5pc1xx/start.S (0x75c+0x4=0x760 bytes)
cpu/s5pc1xx/s5pc100/cpu_init.S (0x284+0x4=0x288 bytes)
board/samsung/smdkc100/lowlevel_init.S (0x238+0x4=0x23c bytes)
cpu/s5pc1xx/onenand_cp.c (0x6c+0x4=0x70 bytes) 
cpu/s5pc1xx/nand_cp.c (0x418+0x4=0x41c) 
cpu/s5pc1xx/movi.c (0xac+0x4=0xb0 bytes)

所以BL1的大小為0x1160(4448) bytes,但因為寫到SD是以block (512 bytes)為單位, 所以我們取
0x1200 (4608) bytes為BL1的寫入大小。寫 u-boot.bin 前 0x1200 bytes=9 blocks 到SD offset=15658990,也是可以boot的:

sudo dd if=./my100/u-boot.bin of=BL1.bin count=9 bs=512
sudo dd if=./BL1.bin of=/dev/sdb seek=7897070 bs=512


我們必須將u-boot.bin 寫SD card offset=7896014, BL1會將u-boot.bin copy從SD card 到DRAM (relocation) (copy address為0x2fe00000(0x20000000+0xfe00000)),當BL1搬完u-boot.bin,在jump 到 start_armboot() (0xc7e01ea0) (先enable MMU for virtual address) :

sudo dd if=./my100/u-boot.bin of=/dev/sdb seek=7896014 bs=512


/usr/local/arm/4.2.2-eabi/usr/bin/arm-unknown-linux-gnueabi-objdump -S ./cpu/s5pc1xx/start.o | tail
...
75c: e1a00000 .word 0xe1a00000

/usr/local/arm/4.2.2-eabi/usr/bin/arm-unknown-linux-gnueabi-objdump -S ./cpu/s5pc1xx/s5pc100/cpu_init.o | tail
...
284: ff002030 .word 0xff00203

/usr/local/arm/4.2.2-eabi/usr/bin/arm-unknown-linux-gnueabi-objdump -S ./board/samsung/smdkc100/lowlevel_init.o | tail
...
238: e2900000 .word 0xe2900000

/usr/local/arm/4.2.2-eabi/usr/bin/arm-unknown-linux-gnueabi-objdump -S ./cpu/s5pc1xx/onenand_cp.o | tail
...
6c: 0c004000 .word 0x0c00400

/usr/local/arm/4.2.2-eabi/usr/bin/arm-unknown-linux-gnueabi-objdump -S ./cpu/s5pc1xx/nand_cp.o | tail
...
418: 00009c40 .word 0x00009c40


/usr/local/arm/4.2.2-eabi/usr/bin/arm-unknown-linux-gnueabi-objdump -S ./cpu/s5pc1xx/movi.o | tail
...
ac: 00000000 .word 0x00000000


/usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-ld -Bstatic -T /home/qustion/Samsung/C110/100/u-boot-samsung-090928-c110/board/samsung/smdkc100/u-boot.lds -Ttext 0xc7e00000 $UNDEF_SYM cpu/s5pc1xx/start.o \
--start-group lib_generic/libgeneric.a cpu/s5pc1xx/libs5pc1xx.a cpu/s5pc1xx/s5pc100/libs5pc100.a lib_arm/libarm.a fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a net/libnet.a disk/libdisk.a drivers/bios_emulator/libatibiosemu.a drivers/block/libblock.a drivers/dma/libdma.a drivers/hwmon/libhwmon.a drivers/i2c/libi2c.a drivers/input/libinput.a drivers/misc/libmisc.a drivers/mmc/libmmc.a drivers/mtd/libmtd.a drivers/mtd/nand/libnand.a drivers/mtd/nand_legacy/libnand_legacy.a drivers/mtd/onenand/libonenand.a drivers/mtd/spi/libspi_flash.a drivers/net/libnet.a drivers/net/sk98lin/libsk98lin.a drivers/pci/libpci.a drivers/pcmcia/libpcmcia.a drivers/spi/libspi.a drivers/rtc/librtc.a drivers/serial/libserial.a drivers/usb/libusb.a drivers/video/libvideo.a common/libcommon.a libfdt/libfdt.a api/libapi.a post/libpost.a board/samsung/smdkc100/libsmdkc100.a --end-group -L /usr/local/arm/4.2.2-eabi/usr/bin-ccache/../lib/gcc/arm-unknown-linux-gnueabi/4.2.2 -lgcc \
-Map u-boot.map -o u-boot



/usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-objcopy --gap-fill=0xff -O srec u-boot u-boot.srec
/usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-objcopy --gap-fill=0xff -O binary u-boot u-boot.bin
/usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-objdump -d u-boot > u-boot.dis

ls -al u-boot
-rwxr-xr-x 1 qustion qustion 844925 2009-10-09 09:47 u-boot

ls -al u-boot.bin 
-rwxr-xr-x 1 qustion qustion 262144 2009-10-09 09:47 u-boot.bin


查看所有symbols
/usr/local/arm/4.2.2-eabi/usr/bin/arm-unknown-linux-gnueabi-nm -v ./my100/u-boot | less

Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
[ 0] NULL 00000000 000000 000000 00 0 0 0
[ 1] .text PROGBITS c7e00000 008000 028524 00 AX 0 0 32
[ 2] .rodata PROGBITS c7e28524 030524 0009dc 00 A 0 0 4
[ 3] .rodata.str1.4 PROGBITS c7e28f00 030f00 007cec 01 AMS 0 0 4
[ 4] .data PROGBITS c7e30bec 038bec 006fdc 00 WA 0 0 4
[ 5] .u_boot_cmd PROGBITS c7e37bc8 03fbc8 0005e8 00 WA 0 0 4
[ 6] .mmudata PROGBITS c7e3c000 044000 004000 00 A 0 0 16384
[ 7] .bss NOBITS c7e40000 048000 014e44 00 WA 0 0 256
阅读(1675) | 评论(0) | 转发(0) |
0

上一篇:ABI & EABI

下一篇:[转载]APCS过程调用标准

给主人留下些什么吧!~~
评论热议
请登录后评论。

登录 注册