SD卡烧写uboot

SD卡烧写uboot


要求SD卡的mbr和第一个分区之间有1M以上的空闲的空间, 否则会破坏分区的数据

#!/bin/bash
bl1_position=1
uboot_position=49

if [ -z $1 ]
then
    echo "usage: ./sd_fusing.sh <SD Reader's device file>"
    exit 0
fi

echo "burning to SD card.............."

echo "BL1 fusing"
echo "of="$1 "seek="$bl1_position
#./mkbl1 ../uboot_inand.bin SD-bl1-8k.bin 8192 //从uboot中分离出bl1
./sd_fusing/mkbl1 ./u-boot.bin SD-bl1-8k.bin 8192 <span style="font-family: Arial, Helvetica, sans-serif;">//从uboot中分离出bl1</span>
dd iflag=dsync oflag=dsync if=SD-bl1-8k.bin of=$1 seek=$bl1_position //将分离出来的bl1写入mbr(512字节)后面的空间
#rm SD-bl1-8k.bin

#sudo dd iflag=dsync oflag=dsync if=webee210-uboot.bin of=/dev/mmcblk0 seek=1
#dd iflag=dsync oflag=dsync if=u-boot.bin of=/dev/sdb seek=9
#<u-boot fusing>
echo "u-boot fusing"
echo "of="$1 "seek="$uboot_position
#dd iflag=dsync oflag=dsync if=../uboot_inand.bin of=$1 seek=$uboot_position
dd iflag=dsync oflag=dsync if=./u-boot.bin of=$1 seek=$uboot_position // 将uboot49*512字节之后的空间
sync
echo "sync........."
sync
echo  "DONE OK!"


##Build U-boot for MMC boot

*Decompress u-boot
tar -jxvf qt210_ics_uboot.bz2
*Enter u-boot folder
cd qt210_ics_uboot
*Config and Build
make smdkv210single_config
make -j8
*Result image
u-boot.bin

*Build Android Kernel 
*Decompress Android Kernel
tar -jxvf qt210_ics_kernel3.0.8_adk.tar.bz2
*Enter Kernel folder
cd qt210_ics_kernel3.0.8_adk
*Config and Build
cp config_for_ADK .config
make -j8 uImage
*Result image
arch/arm/boot/uImage


*Build Android file system
*Decompress Android 4.0 source code
tar -jxvf android_4.0.3_ADK.tar.bz2
*Enter Android folder
cd android_4.0.3_ADK
*Set up envirunment
source build/envsetup.sh
*Config build target
lunch
full_smdkv210-eng
*Build
make -j8
*Result
out/target/product/smdkv210/ramdisk-uboot.img
out/target/product/smdkv210/system.img
*Build Bootable SD Card


*Step 1 - Use sd_fusing to create bootable SD card
cd qt210_ics_uboot/sd_fusing
sudo ./sd_fusing_uboot.sh /dev/sdX


*Step 2 - Boot from SD card and create partition (In u-boot stage)
fdisk -c 0


*Update Android to QT210


*Step 1 - Enter fastboot mode [Target]
fastboot


*Step 2 - Update u-boot [PC]
fastboot flash bootloader u-boot.bin


*Step 3 - Reboot target board and load new bootloader [Target]
reboot
fastboot


*Step 4 - Update Android Kernel [PC]
fastboot flash kernel uImage


*Step 5 - Update Android RAMDISK [PC]
fastboot flash ramdisk ramdisk-uboot.img


*Step 6 - Update Android System.img [PC]
fastboot flash system system.img


*Step 7 - Finish and reboot [Target]
ctrl+c to interrtup fastboot mode
reboot
*Step 8 - Format data partition [PC]
sudo mkfs.ext4 /dev/sdX3   where X is your usb sd card reader number (Try dmesg)


*Step 8 - Set stay awake mode on Android
setting->development->stay awake (checked)






在SD卡的第一个分区前保留部分空间不用(用于uboot)
进入sd_fusing目录并执行脚本烧录SD卡映像:
cd uboot/sd_fusing/
sudo bash ./sd_fusing.sh /dev/sdb
这时,uboot就烧到SD卡中了。
注意,脚本文件sd_fusing.sh做了如下修改:
echo "BL1 fusing"
./mkbl1 ../uboot_sd.bin SD-bl1-8k.bin 8192 #分离出SD-bl1-8k.bin
dd iflag=dsync oflag=dsync if=SD-bl1-8k.bin of=$1 seek=$bl1_position #将SD-bl1-8k.bin写入SD卡

rm SD-bl1-8k.bin #删除SD-bl1-8k.bin


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值