| 
 | 
 
 本帖最后由 kshaojun 于 2017-9-3 16:59 编辑  
 
你好,TQ工程师: 
         我是按照提供教材烧写失败,如下uboot log,请帮忙分析下,谢谢! 
U-Boot 2015.04 (Aug 19 2016 - 14:21:13) 
 
CPU:   Freescale i.MX6Q rev1.5 at 792 MHz 
CPU:   Temperature 34 C 
Reset cause: POR 
Board: MX6-SabreSD 
I2C:   ready 
DRAM:  2 GiB 
MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2 
*** Warning - bad CRC, using default environment 
 
Display: CLAA-WVGA (800x480) 
In:    serial 
Out:   serial 
Err:   serial 
switch to partitions #0, OK 
mmc0 is current device 
Net:   FEC [PRIME] 
Normal Boot 
Hit any key to stop autoboot:  0  
reading download.img 
Error reading cluster 
** Unable to read file download.img ** 
** Can't read partition table on 0:0 ** 
** Invalid partition 2 ** 
Kernel image @ 0x12000000 [ 0x000000 - 0x1ffb960 ] 
ERROR: Did not find a cmdline Flattened Device Tree 
Could not find a valid device tree 
 
 
================================================================= 
create_sdcard.sh 
 
 
#!/bin/bash 
 
# partition size in MB 
BOOTLOAD_RESERVE=8 
BOOT_ROM_SIZE=50 
SYSTEM_ROM_SIZE=512 
CACHE_SIZE=512 
RECOVERY_ROM_SIZE=8 
VENDER_SIZE=8 
MISC_SIZE=8 
 
boot_partition=2 
images_partition=1 
 
help() { 
 
bn=`basename $0` 
cat << EOF 
usage $bn <option> device_node 
 
options: 
  -h        displays this help message 
  -s        only get partition size 
  -np         not partition. 
  -f        flash android image. 
EOF 
 
} 
 
# check the if root? 
userid=`id -u` 
if [ $userid -ne "0" ]; then 
  echo "you're not root?" 
  exit 
fi 
 
 
# parse command line 
moreoptions=1 
node="na" 
cal_only=0 
flash_images=0 
not_partition=0 
cp_images=0 
not_format_fs=0 
while [ "$moreoptions" = 1 -a $# -gt 0 ]; do 
  case $1 in 
      -h) help; exit ;; 
      -s) cal_only=1 ;; 
      -f) flash_images=1 ;; 
      -c) cp_images=1 ;; 
      -np) not_partition=1 ;; 
      -nf) not_format_fs=1 ;; 
      *)  moreoptions=0; node=$1 ;; 
  esac 
  [ "$moreoptions" = 0 ] && [ $# -gt 1 ] && help && exit 
  [ "$moreoptions" = 1 ] && shift 
done 
 
if [ ! -e ${node} ]; then 
  help 
  exit 
fi 
 
 
# call sfdisk to create partition table 
# get total card size 
seprate=40 
total_size=`sfdisk -s ${node}` 
total_size=`expr ${total_size} / 1024` 
image_rom_sizeb=`expr ${total_size} - ${BOOT_ROM_SIZE} - ${BOOTLOAD_RESERVE}` 
 
# create partitions 
if [ "${cal_only}" -eq "1" ]; then 
cat << EOF 
total :          ${total_size}MB 
image_rom_sizeb: ${image_rom_sizeb}MB 
EOF 
exit 
fi 
 
function format_android 
{ 
    echo "formating android images" 
    umount ${node}${images_partition} 
    umount ${node}${boot_partition} 
    mkfs.vfat ${node}${images_partition}  
    mkfs.vfat ${node}${boot_partition} 
} 
function copy_images 
{ 
    echo "cp images..." 
    mkdir mountpoint 
#    dd if=/dev/zero of=${node}${boot_partition} bs=512 count=2 
#    sync 
    mount -t vfat ${node}${boot_partition} mountpoint 
    rm -rf mountpoint/* 
    sync 
    cp imx6q-sabresd.dtb mountpoint/. 
    cp download.img mountpoint/.  
#    cp u-boot.bin mountpoint/. 
#    cp boot.img mountpoint/. 
#    cp system.img mountpoint/. 
#    cp recovery.img mountpoint/. 
    sync 
    umount mountpoint 
    rm -rf mountpoint 
} 
 
function flash_android 
{ 
if [ "${flash_images}" -eq "1" ]; then 
    echo "flashing android images..."     
    #dd if=/dev/zero of=${node} bs=512 seek=1536 count=16 
    dd if=/dev/zero of=${node} bs=512 seek=1024 count=16 
    dd if=u-boot_for_download.bin of=${node} bs=512 seek=2 
#    dd if=imx6q-sabresd.dtb of=${node}${boot_partition} bs=512 seek=2 
#    dd if=download.img of=${node}${boot_partition} bs=512 seek=2048 
#    dd if=download.img of=${node}${boot_partition} 
    sync 
fi 
} 
 
if [ "${cp_images}" -eq "1" ]; then 
    umount ${node}${images_partition} 
    umount ${node}${boot_partition} 
    copy_images 
    exit 
fi 
 
if [[ "${not_partition}" -eq "1" && "${flash_images}" -eq "1" ]] ; then 
    flash_android 
    exit 
fi 
 
 
# destroy the partition table 
dd if=/dev/zero of=${node} bs=512 count=2 
sync 
partprobe 
fdisk ${node} << EOF 
n 
p 
1 
 
+${image_rom_sizeb}M 
n 
p 
2 
 
 
w 
EOF 
 
 
# adjust the partition reserve for bootloader. 
# if you don't put the uboot on same device, you can remove the BOOTLOADER_ERSERVE 
# to have 8M space. 
# the minimal sylinder for some card is 4M, maybe some was 8M 
# just 8M for some big eMMC 's sylinder 
 
# format the SDCARD/DATA/CACHE partition 
part="" 
echo ${node} | grep mmcblk > /dev/null 
if [ "$?" -eq "0" ]; then 
  part="p" 
fi 
 
format_android 
copy_images 
flash_android 
 
 
# For MFGTool Notes: 
# MFGTool use mksdcard-android.tar store this script 
# if you want change it. 
# do following: 
#   tar xf mksdcard-android.sh.tar 
#   vi mksdcard-android.sh  
#   [ edit want you want to change ] 
#   rm mksdcard-android.sh.tar; tar cf mksdcard-android.sh.tar mksdcard-android.sh 
 
 
 |   
 
 
 
 |