diff --git a/scripts/mk-emmc-fusing.sh b/scripts/mk-emmc-fusing.sh deleted file mode 100755 index 85fad98..0000000 --- a/scripts/mk-emmc-fusing.sh +++ /dev/null @@ -1,192 +0,0 @@ -#!/bin/bash - -C_NC='\033[0m' -C_LRED='\033[1;31m' - - -EMMC_DEV_PATH="/dev/mmcblk3" -SD_DEV_PATH="/dev/mmcblk2" -PART1=p1 -PART2=p2 -PART3=p3 -PART4=p4 - -FNAME_UBOOT="u-boot.imx" -FNAME_LOGO="init.bmp" -FNAME_DTB="imx6s-prime-oven.dtb" -FNAME_KERNEL="uImage" -FNAME_FSCPIO="ramdisk-prime_oven.uboot" -FNAME_RFS="rootfs.tar" -FNAME_APP="application.tar" - -SD_MOUNT_PATH_P1="/tmp/mmcblk2p1" -EMMC_MOUNT_PATH_P1="/tmp/mmcblk3p1" -EMMC_MOUNT_PATH_P2="/tmp/mmcblk3p2" -EMMC_MOUNT_PATH_P3="/tmp/mmcblk3p3" -EMMC_MOUNT_PATH_P4="/tmp/mmcblk3p4" - -function Init_Unmount() -{ - echo "" - echo -e "${C_LRED}### UnMount - Init_Unmount() ### ${C_NC}" - echo "" - umount ${EMMC_DEV_PATH}${PART1} - umount ${EMMC_DEV_PATH}${PART2} - umount ${EMMC_DEV_PATH}${PART3} - umount ${EMMC_DEV_PATH}${PART4} - umount ${SD_DEV_PATH}${PART1} - umount ${SD_DEV_PATH}${PART2} -} - -function create_partition() -{ - echo "" - echo -e "${C_LRED}### Fdisk Create Partition - create_partition() ###${C_NC}" - echo "" -fdisk ${EMMC_DEV_PATH} << EOF -o -n -p -1 -4096 -8191 -n -p -2 -8192 -16383 -n -p -3 -16384 -32767 -n -p -32768 - -p -w -EOF -} - -function run_format() -{ - echo "" - echo -e "${C_LRED}### Format eMMC - run_format() ###${C_NC}" - echo "" - mkfs.ext3 -F ${EMMC_DEV_PATH}${PART1} -L BOOT0 - mkfs.ext4 -j -F ${EMMC_DEV_PATH}${PART2} -L SYSTEM - mkfs.ext4 -j -F ${EMMC_DEV_PATH}${PART3} -L FALINUX - mkfs.ext4 -j -F ${EMMC_DEV_PATH}${PART4} -L PRIME -} - -function run_mount() -{ - echo "" - echo -e "${C_LRED}### Mount SD/eMMC - run_mount() ###${C_NC}" - echo "" - - if [ ! -d ${SD_MOUNT_PATH_P1} ]; then - mkdir ${SD_MOUNT_PATH_P1} - fi - - if [ ! -d ${EMMC_MOUNT_PATH_P1} ]; then - mkdir ${EMMC_MOUNT_PATH_P1} - fi - - if [ ! -d ${EMMC_MOUNT_PATH_P2} ]; then - mkdir ${EMMC_MOUNT_PATH_P2} - fi - - if [ ! -d ${EMMC_MOUNT_PATH_P3} ]; then - mkdir ${EMMC_MOUNT_PATH_P3} - fi - - if [ ! -d ${EMMC_MOUNT_PATH_P4} ]; then - mkdir ${EMMC_MOUNT_PATH_P4} - fi - - mount -t ext4 ${SD_DEV_PATH}${PART1} ${SD_MOUNT_PATH_P1} - mount -t ext3 ${EMMC_DEV_PATH}${PART1} ${EMMC_MOUNT_PATH_P1} - mount -t ext4 ${EMMC_DEV_PATH}${PART2} ${EMMC_MOUNT_PATH_P2} - mount -t ext4 ${EMMC_DEV_PATH}${PART3} ${EMMC_MOUNT_PATH_P3} - mount -t ext4 ${EMMC_DEV_PATH}${PART4} ${EMMC_MOUNT_PATH_P4} -} - -function run_copy_image() -{ - echo "" - echo -e "${C_LRED}### Write SD Boot Image - run_copy_image() ###${C_NC}" - echo "" - - if [ ! -d ${EMMC_MOUNT_PATH_P1}/boot ]; then - mkdir ${EMMC_MOUNT_PATH_P1}/boot - fi - - cp -v ${SD_MOUNT_PATH_P1}/boot/${FNAME_UBOOT} ${EMMC_MOUNT_PATH_P1}/boot/ - cp -v ${SD_MOUNT_PATH_P1}/boot/${FNAME_LOGO} ${EMMC_MOUNT_PATH_P1}/boot/ - cp -v ${SD_MOUNT_PATH_P1}/boot/${FNAME_DTB} ${EMMC_MOUNT_PATH_P1}/boot/ - cp -v ${SD_MOUNT_PATH_P1}/boot/${FNAME_KERNEL} ${EMMC_MOUNT_PATH_P1}/boot/ - cp -v ${SD_MOUNT_PATH_P1}/boot/${FNAME_FSCPIO} ${EMMC_MOUNT_PATH_P1}/boot/ - run_copy_rootfs - sleep 1 - sync -} - -function run_copy_rootfs() -{ - echo "" - echo -e "${C_LRED}### Make MMC Filesystem ###${C_NC}" - echo "" - - tar -xf ${SD_MOUNT_PATH_P1}/boot/${FNAME_RFS} -C ${EMMC_MOUNT_PATH_P2} - - cp /etc/ssh/ssh_host_ed25519_key ${EMMC_MOUNT_PATH_P2}/etc/ssh/ - - tar -xf ${SD_MOUNT_PATH_P1}/boot/${FNAME_APP} -C ${EMMC_MOUNT_PATH_P3} - tar -xf ${SD_MOUNT_PATH_P1}/boot/${FNAME_APP} -C ${EMMC_MOUNT_PATH_P4} -} - -function run_raw_write() -{ - echo "" - echo -e "${C_LRED}### Write SD Boot Image to RAW - run_raw_write() ###${C_NC}" - echo "" - dd if=${SD_MOUNT_PATH_P1}/boot/${FNAME_UBOOT} of=${EMMC_DEV_PATH} bs=512 seek=2 - dd if=${SD_MOUNT_PATH_P1}/boot/${FNAME_LOGO} of=${EMMC_DEV_PATH} bs=512 seek=2048 - dd if=${SD_MOUNT_PATH_P1}/boot/${FNAME_DTB} of=${EMMC_DEV_PATH} bs=512 seek=11264 - dd if=${SD_MOUNT_PATH_P1}/boot/${FNAME_KERNEL} of=${EMMC_DEV_PATH} bs=512 seek=12288 - dd if=${SD_MOUNT_PATH_P1}/boot/${FNAME_FSCPIO} of=${EMMC_DEV_PATH} bs=512 seek=28672 - sleep 1 - sync -} - -function run_umount() -{ - echo "" - echo -e "${C_LRED}### UnMount - run_umount() ###${C_NC}" - echo "" - umount ${SD_MOUNT_PATH_P1} - umount ${EMMC_MOUNT_PATH_P1} - umount ${EMMC_MOUNT_PATH_P2} - umount ${EMMC_MOUNT_PATH_P3} - umount ${EMMC_MOUNT_PATH_P4} -} - - -function main() -{ - echo "" - echo -e "${C_LRED}#### Start - main() ####${C_NC}" - echo "" - - Init_Unmount - create_partition - run_format - run_mount - run_copy_image - run_raw_write - run_umount -} - -main diff --git a/scripts/mk-emmc-fusing.sh b/scripts/mk-emmc-fusing.sh new file mode 120000 index 0000000..43c1530 --- /dev/null +++ b/scripts/mk-emmc-fusing.sh @@ -0,0 +1 @@ +../buildroot/buildroot-2016.08.1/board/falinux/prime_oven/rootfs_overlay/root/.falinux/mk-emmc-fusing.sh \ No newline at end of file diff --git a/scripts/mk-fusingsd.sh b/scripts/mk-fusingsd.sh deleted file mode 100755 index 223a3f9..0000000 --- a/scripts/mk-fusingsd.sh +++ /dev/null @@ -1,180 +0,0 @@ -#!/bin/bash - -C_NC='\033[0m' -C_LRED='\033[1;31m' - -#### Partition Number #### -P1_NUM="1" - -DEVNAME="mmcblk0" -DEV_PATH="/dev/mmcblk0" -DEV_PATH_P1="/dev/mmcblk0p1" -INPUT="/tmp/input" - -FNAME_UBOOT="u-boot.imx" -FNAME_LOGO="init.bmp" -FNAME_DTB="imx6s-prime-oven.dtb" -FNAME_KERNEL="uImage" -FNAME_FSCPIO="ramdisk-prime_oven.uboot" -FNAME_RFS="rootfs.tar" -FNAME_APP="application.tar" - -MOUNT_PATH_P1="/tmp/mmcblk0p1" - - -function create_partition() -{ - echo "" - echo -e "${C_LRED}### Fdisk Create Partition - create_partition() ###${C_NC}" - echo "" -fdisk $DEV_PATH << EOF -o -n -p -1 -262144 - -p -w -EOF -} - -function run_format() -{ - echo "" - echo -e "${C_LRED}### Format SDCARD - run_format() ###${C_NC}" - echo "" - echo "y" | mkfs.ext4 ${DEV_PATH}${P1_NUM} -L BOOT0 -} - -function run_mount() -{ - echo "" - echo -e "${C_LRED}### Mount SD - run_mount() ###${C_NC}" - echo "" - if [ ! -d ${MOUNT_PATH_P1} ]; then - mkdir ${MOUNT_PATH_P1} - fi - - mount ${DEV_PATH}${P1_NUM} ${MOUNT_PATH_P1} -} - -function run_umount() -{ - echo "" - echo -e "${C_LRED}### UnMount - run_umount() ###${C_NC}" - echo "" - umount ${MOUNT_PATH_P1} -} - -function run_copy_image() -{ - # SD Boot Image(SD 카드 부팅용 이미지) - echo "" - echo -e "${C_LRED}### Write SD Boot Image - run_copy_image() ###${C_NC}" - echo "" - if [ ! -d ${MOUNT_PATH_P1}/boot ]; then - mkdir ${MOUNT_PATH_P1}/boot - fi - cp -v ./$FNAME_UBOOT ${MOUNT_PATH_P1}/boot/ - cp -v ./$FNAME_LOGO ${MOUNT_PATH_P1}/boot/ - cp -v ./$FNAME_DTB ${MOUNT_PATH_P1}/boot/ - cp -v ./$FNAME_KERNEL ${MOUNT_PATH_P1}/boot/ - cp -v ./$FNAME_FSCPIO ${MOUNT_PATH_P1}/boot/ - cp -v ./$FNAME_RFS ${MOUNT_PATH_P1}/boot/ - cp -v ./$FNAME_APP ${MOUNT_PATH_P1}/boot/ - sleep 1 - sync -} - -function run_raw_write() -{ - echo "" - echo -e "${C_LRED}### Write SD Boot Image to RAW - run_raw_write() ###${C_NC}" - echo "" - dd if=./$FNAME_UBOOT of=$DEV_PATH bs=512 seek=2 - dd if=./$FNAME_LOGO of=$DEV_PATH bs=512 seek=2048 - dd if=./$FNAME_DTB of=$DEV_PATH bs=512 seek=11264 - dd if=./$FNAME_KERNEL of=$DEV_PATH bs=512 seek=12288 - dd if=./$FNAME_FSCPIO of=$DEV_PATH bs=512 seek=28672 - sleep 1 - sync -} - -function Init_Unmount() -{ - echo "" - echo -e "${C_LRED}### Unmount SD - Init_Unmount() ###${C_NC}" - echo "" -# umount $DEV_PATH_P1 - umount $DEV_PATH* -} - -function main() -{ - echo "" - echo -e "${C_LRED}#### Start - main() ####${C_NC}" - echo "" - Init_Unmount - create_partition - - run_format - run_mount - run_raw_write - run_copy_image - run_umount - sync -} - -if [[ "$1" == "sd"* ]]; then - if [ "$1" != "sd" ]; then - P1_NUM="1" - else - echo "Missing Partition Number" - exit - fi - -elif [[ "$1" == "mmcblk"* ]]; then - if [ "$1" != "mmcblk" ]; then - P1_NUM="p1" - else - echo "Missing Partition Number" - exit - fi -else - echo "Wrong Device Name" - exit -fi - - -if [ "$1" != "" ]; then - DEVNAME=$1 -fi - -DEV_PATH="/dev/${DEVNAME}" -DEV_PATH_P1="${DEV_PATH}${P1_NUM}" -MOUNT_PATH_P1="/tmp/${DEVNAME}${P1_NUM}" - -echo "" -echo "================================" -echo "DEV_Name: $DEVNAME" -echo "DEV_Path: $DEV_PATH" -echo "P1 MountPath: $MOUNT_PATH_P1" -echo "================================" -echo "" - -read -p "IS Right? (y/n): " -n 2 -e IS_RIGHT - -if [ "$IS_RIGHT" == "y" ]; then - main -elif [ "$IS_RIGHT" == "Y" ]; then - main -else - echo -e "Exit This Script" - exit -fi - - - - - diff --git a/scripts/mk-fusingsd.sh b/scripts/mk-fusingsd.sh new file mode 120000 index 0000000..531ee28 --- /dev/null +++ b/scripts/mk-fusingsd.sh @@ -0,0 +1 @@ +../release/mk-fusingsd.sh \ No newline at end of file