Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
themeMidnight
root@phycore-emmc-am335x-1:~# mkdir images
root@phycore-emmc-am335x-1:~# tftp -g -r barebox.bin 192.168.1.253
root@phycore-emmc-am335x-1:~# tftp -g -r MLO 192.168.1.253
root@phycore-emmc-am335x-1:~# tftp -g -r zImage-phycore-emmc-am335x-1.bin 192.168.1.253
root@phycore-emmc-am335x-1:~# tftp -g -r zImage-am335x-phycore-emmc-eeprom-rtc-spi.dtb 192.168.1.253
root@phycore-emmc-am335x-1:~# tftp -g -r phytec-qt5demo-image-phycore-emmc-am335x-1.tar.gz 192.168.1.253

烧写eMMC镜像脚本flash_emmc.sh(待更新)

Code Block
languagebash
themeMidnight
#!/bin/sh

if [ `expr 0 + 0${1}` -le 0 ]; then
	echo "usage $0: <sd_size in gb>"
	exit 1;
fi

# base config
export DEST=/dev/mmcblk1
export DESTP=${DEST}p
export MNTPOINT=/mnt/sd
export DEST_SIZE=`expr ${1} \* 900 \* 1024`

# images
export BASE_DIR=/home/root/images											 # 镜像目录
export BARE_IMG=${BASE_DIR}/barebox.bin										 # barebox
export MLO=${BASE_DIR}/MLO													 # MLO
export ZIMAGE=${BASE_DIR}/zImage-phycore-emmc-am335x-1.bin					 # kernel
export OFTREE=${BASE_DIR}/zImage-am335x-phycore-emmc-eeprom-rtc-spi.dtb		 # oftree
export ROOTFS=${BASE_DIR}/phytec-qt5demo-image-phycore-emmc-am335x-1.tar.gz  # 文件系统

# start
rm -rf ${MNTPOINT}
mkdir -p ${MNTPOINT}

echo Wipe emmc device
dd if=/dev/zero of=${DEST} bs=1024 count=0 seek=${DEST_SIZE}
dd if=/dev/zero of=${DEST} bs=512k count=16 conv=fsync

echo Create Partitions
sfdisk -u S ${DEST} << EOF
	1 : start= 8192, size= 16384, Id=c
	2 : start= 24576, Id=83
EOF

echo set part 1 boot on
parted -s ${DEST} set 1 boot on

echo Flash Barebox/MLO and Kernel/Devicetree
yes | mkfs.vfat ${DESTP}1
mount ${DESTP}1 ${MNTPOINT}
cp ${MLO} ${MNTPOINT}/MLO
cp ${BARE_IMG} ${MNTPOINT}/barebox.bin
cp ${ZIMAGE} ${MNTPOINT}/zImage
cp ${OFTREE} ${MNTPOINT}/oftree
umount ${MNTPOINT}

echo Flash Rootfs 
yes | mkfs.ext4 ${DESTP}2 
mount ${DESTP}2 ${MNTPOINT}
tar xf ${ROOTFS} -C ${MNTPOINT}
umount ${MNTPOINT}

...