From 5749fe1914dfe1d2b3b7b6a68d88a6a61fe66625 Mon Sep 17 00:00:00 2001
From: Minsoo Kim <leios@falinux.com>
Date: Fri, 7 Jul 2017 14:54:22 +0900
Subject: [PATCH] =?UTF-8?q?=EC=83=9D=EC=82=B0=20=EC=8A=A4=ED=81=AC?=
 =?UTF-8?q?=EB=A6=BD=ED=8A=B8=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../rootfs_overlay/root/.falinux/mk-emmc-fusing.sh     | 18 ++++++++++++++++++
 release/mk-fusingsd.sh                                 | 11 ++---------
 scripts/mk-emmc-fusing.sh                              | 18 ++++++++++++++++++
 scripts/mk-fusingsd.sh                                 | 11 ++---------
 4 files changed, 40 insertions(+), 18 deletions(-)

diff --git a/buildroot/buildroot-2016.08.1/board/falinux/prime_oven/rootfs_overlay/root/.falinux/mk-emmc-fusing.sh b/buildroot/buildroot-2016.08.1/board/falinux/prime_oven/rootfs_overlay/root/.falinux/mk-emmc-fusing.sh
index 760e4c8..3289c85 100755
--- a/buildroot/buildroot-2016.08.1/board/falinux/prime_oven/rootfs_overlay/root/.falinux/mk-emmc-fusing.sh
+++ b/buildroot/buildroot-2016.08.1/board/falinux/prime_oven/rootfs_overlay/root/.falinux/mk-emmc-fusing.sh
@@ -17,10 +17,13 @@ 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()
 {
@@ -95,9 +98,19 @@ function run_mount()
 		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()
@@ -129,6 +142,9 @@ function run_copy_rootfs()
 	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} ${EMMC_MOUNT_PATH_P3}/
+	tar -xf ${SD_MOUNT_PATH_P1}/boot/${FNAME_APP} ${EMMC_MOUNT_PATH_P4}/
 }
 
 function run_raw_write()
@@ -153,6 +169,8 @@ function run_umount()
 	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}
 }
 
 
diff --git a/release/mk-fusingsd.sh b/release/mk-fusingsd.sh
index df5df9a..223a3f9 100755
--- a/release/mk-fusingsd.sh
+++ b/release/mk-fusingsd.sh
@@ -5,7 +5,6 @@ C_LRED='\033[1;31m'
 
 #### Partition Number ####
 P1_NUM="1"
-P2_NUM="2"
 
 DEVNAME="mmcblk0"
 DEV_PATH="/dev/mmcblk0"
@@ -18,6 +17,7 @@ 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"
 
@@ -33,11 +33,6 @@ n
 p
 1
 262144
-1310719
-n
-p
-2
-1310720
 
 p
 w
@@ -50,7 +45,6 @@ function run_format()
 	echo -e "${C_LRED}### Format SDCARD - run_format() ###${C_NC}"
 	echo ""
 	echo "y" | mkfs.ext4 ${DEV_PATH}${P1_NUM} -L BOOT0
-	echo "y" | mkfs.ext4 ${DEV_PATH}${P2_NUM} -L DATA
 }
 
 function run_mount()
@@ -88,6 +82,7 @@ function run_copy_image()
 	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
 }
@@ -134,7 +129,6 @@ function main()
 if [[ "$1" == "sd"* ]]; then
 	if [ "$1" != "sd" ]; then
 		P1_NUM="1"
-		P2_NUM="2"
 	else
 		echo "Missing Partition Number"
 		exit
@@ -143,7 +137,6 @@ if [[ "$1" == "sd"* ]]; then
 elif [[ "$1" == "mmcblk"* ]]; then
 	if [ "$1" != "mmcblk" ]; then
 		P1_NUM="p1"
-		P2_NUM="p2"
 	else
 		echo "Missing Partition Number"
 		exit
diff --git a/scripts/mk-emmc-fusing.sh b/scripts/mk-emmc-fusing.sh
index 760e4c8..3289c85 100755
--- a/scripts/mk-emmc-fusing.sh
+++ b/scripts/mk-emmc-fusing.sh
@@ -17,10 +17,13 @@ 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()
 {
@@ -95,9 +98,19 @@ function run_mount()
 		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()
@@ -129,6 +142,9 @@ function run_copy_rootfs()
 	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} ${EMMC_MOUNT_PATH_P3}/
+	tar -xf ${SD_MOUNT_PATH_P1}/boot/${FNAME_APP} ${EMMC_MOUNT_PATH_P4}/
 }
 
 function run_raw_write()
@@ -153,6 +169,8 @@ function run_umount()
 	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}
 }
 
 
diff --git a/scripts/mk-fusingsd.sh b/scripts/mk-fusingsd.sh
index df5df9a..223a3f9 100755
--- a/scripts/mk-fusingsd.sh
+++ b/scripts/mk-fusingsd.sh
@@ -5,7 +5,6 @@ C_LRED='\033[1;31m'
 
 #### Partition Number ####
 P1_NUM="1"
-P2_NUM="2"
 
 DEVNAME="mmcblk0"
 DEV_PATH="/dev/mmcblk0"
@@ -18,6 +17,7 @@ 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"
 
@@ -33,11 +33,6 @@ n
 p
 1
 262144
-1310719
-n
-p
-2
-1310720
 
 p
 w
@@ -50,7 +45,6 @@ function run_format()
 	echo -e "${C_LRED}### Format SDCARD - run_format() ###${C_NC}"
 	echo ""
 	echo "y" | mkfs.ext4 ${DEV_PATH}${P1_NUM} -L BOOT0
-	echo "y" | mkfs.ext4 ${DEV_PATH}${P2_NUM} -L DATA
 }
 
 function run_mount()
@@ -88,6 +82,7 @@ function run_copy_image()
 	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
 }
@@ -134,7 +129,6 @@ function main()
 if [[ "$1" == "sd"* ]]; then
 	if [ "$1" != "sd" ]; then
 		P1_NUM="1"
-		P2_NUM="2"
 	else
 		echo "Missing Partition Number"
 		exit
@@ -143,7 +137,6 @@ if [[ "$1" == "sd"* ]]; then
 elif [[ "$1" == "mmcblk"* ]]; then
 	if [ "$1" != "mmcblk" ]; then
 		P1_NUM="p1"
-		P2_NUM="p2"
 	else
 		echo "Missing Partition Number"
 		exit
-- 
2.1.4