From ab91daa64611d394a83c19b951de986bdd89137d Mon Sep 17 00:00:00 2001
From: larche <larche@falinux.com>
Date: Fri, 7 Jul 2017 17:24:13 +0900
Subject: [PATCH] =?UTF-8?q?=3D=20Fusing=20=EC=8A=A4=ED=81=AC=EB=A6=BD?=
 =?UTF-8?q?=ED=8A=B8=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

= SD Fusing 시 MBR영역 삭제 기능 추가

	- 보드 부팅 시 eMMC 영역의 Application 이 실행되어있으면 UnMount 가 되지 않아 Fusing 불가능
	( ex: Prime 이미지가 이미 Fusing 되어 있는 상태에서 다시 Fusing 하는 경우 Application 영역으로 사용하는
	  eMMC Partition 영역에 있는 Applicaton 이 실행되어 실행에 해당 파티션들이 Unmount 되지 않아
	  필요한 기능이 동작하지 않음)
---
 bootloader/u-boot_2015_04/include/configs/mx6s_prime_oven.h           | 2 +-
 .../falinux/prime_oven/rootfs_overlay/root/.falinux/mk-emmc-fusing.sh | 4 ++--
 scripts/mk-emmc-fusing.sh                                             | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/bootloader/u-boot_2015_04/include/configs/mx6s_prime_oven.h b/bootloader/u-boot_2015_04/include/configs/mx6s_prime_oven.h
index b86249b..9f30978 100755
--- a/bootloader/u-boot_2015_04/include/configs/mx6s_prime_oven.h
+++ b/bootloader/u-boot_2015_04/include/configs/mx6s_prime_oven.h
@@ -240,7 +240,7 @@
 		"echo ; " \
     "fi; " \
     "bootm 0x12000000 - 0x11F00000; \0" \
-    "bootload_fw=mmc dev 1; mmc read 0x11F00000 2C00 100; mmc read 0x12000000 3000 3800; mmc read 0x1E000000 7000 20000; bootm 0x12000000 0x1E000000 0x11F00000; \0" \
+    "bootload_fw=mmc dev 0; mmc erase 0 2; mmc dev 1; mmc read 0x11F00000 2C00 100; mmc read 0x12000000 3000 3800; mmc read 0x1E000000 7000 20000; bootm 0x12000000 0x1E000000 0x11F00000; \0" \
     "fw=env default -a; saveenv; setenv mmcdev 1; setenv bootargs_ram ${bootargs_ram} fusing=1; run bootcmd_fw; \0" \
     "bootcmd_fw=run bootargs_ram bootload_fw \0" \
     "bootcmd=run bootargs_mmc bootload\0"
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 3289c85..85fad98 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
@@ -143,8 +143,8 @@ function run_copy_rootfs()
 
 	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}/
+	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()
diff --git a/scripts/mk-emmc-fusing.sh b/scripts/mk-emmc-fusing.sh
index 3289c85..85fad98 100755
--- a/scripts/mk-emmc-fusing.sh
+++ b/scripts/mk-emmc-fusing.sh
@@ -143,8 +143,8 @@ function run_copy_rootfs()
 
 	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}/
+	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()
-- 
2.1.4