Commit fa4d56b47c4794697dc042fe59257d95ff0fbcfc
1 parent
554a1cbfb9
Exists in
master
and in
2 other branches
= Script 폴더 내에 Fusing 스크립트 Symbolic 링크로 변경
- 같은 파일을 두개로 관리되는 부분 삭제 - 원본은 실제 위치해야 할 경로에 두고 해당 파일을 script 폴더 내에 심볼릭 링크를 생성하여 관리
Showing
4 changed files
with
2 additions
and
372 deletions
Show diff stats
scripts/mk-emmc-fusing.sh
... | ... | @@ -1,192 +0,0 @@ |
1 | -#!/bin/bash | |
2 | - | |
3 | -C_NC='\033[0m' | |
4 | -C_LRED='\033[1;31m' | |
5 | - | |
6 | - | |
7 | -EMMC_DEV_PATH="/dev/mmcblk3" | |
8 | -SD_DEV_PATH="/dev/mmcblk2" | |
9 | -PART1=p1 | |
10 | -PART2=p2 | |
11 | -PART3=p3 | |
12 | -PART4=p4 | |
13 | - | |
14 | -FNAME_UBOOT="u-boot.imx" | |
15 | -FNAME_LOGO="init.bmp" | |
16 | -FNAME_DTB="imx6s-prime-oven.dtb" | |
17 | -FNAME_KERNEL="uImage" | |
18 | -FNAME_FSCPIO="ramdisk-prime_oven.uboot" | |
19 | -FNAME_RFS="rootfs.tar" | |
20 | -FNAME_APP="application.tar" | |
21 | - | |
22 | -SD_MOUNT_PATH_P1="/tmp/mmcblk2p1" | |
23 | -EMMC_MOUNT_PATH_P1="/tmp/mmcblk3p1" | |
24 | -EMMC_MOUNT_PATH_P2="/tmp/mmcblk3p2" | |
25 | -EMMC_MOUNT_PATH_P3="/tmp/mmcblk3p3" | |
26 | -EMMC_MOUNT_PATH_P4="/tmp/mmcblk3p4" | |
27 | - | |
28 | -function Init_Unmount() | |
29 | -{ | |
30 | - echo "" | |
31 | - echo -e "${C_LRED}### UnMount - Init_Unmount() ### ${C_NC}" | |
32 | - echo "" | |
33 | - umount ${EMMC_DEV_PATH}${PART1} | |
34 | - umount ${EMMC_DEV_PATH}${PART2} | |
35 | - umount ${EMMC_DEV_PATH}${PART3} | |
36 | - umount ${EMMC_DEV_PATH}${PART4} | |
37 | - umount ${SD_DEV_PATH}${PART1} | |
38 | - umount ${SD_DEV_PATH}${PART2} | |
39 | -} | |
40 | - | |
41 | -function create_partition() | |
42 | -{ | |
43 | - echo "" | |
44 | - echo -e "${C_LRED}### Fdisk Create Partition - create_partition() ###${C_NC}" | |
45 | - echo "" | |
46 | -fdisk ${EMMC_DEV_PATH} << EOF | |
47 | -o | |
48 | -n | |
49 | -p | |
50 | -1 | |
51 | -4096 | |
52 | -8191 | |
53 | -n | |
54 | -p | |
55 | -2 | |
56 | -8192 | |
57 | -16383 | |
58 | -n | |
59 | -p | |
60 | -3 | |
61 | -16384 | |
62 | -32767 | |
63 | -n | |
64 | -p | |
65 | -32768 | |
66 | - | |
67 | -p | |
68 | -w | |
69 | -EOF | |
70 | -} | |
71 | - | |
72 | -function run_format() | |
73 | -{ | |
74 | - echo "" | |
75 | - echo -e "${C_LRED}### Format eMMC - run_format() ###${C_NC}" | |
76 | - echo "" | |
77 | - mkfs.ext3 -F ${EMMC_DEV_PATH}${PART1} -L BOOT0 | |
78 | - mkfs.ext4 -j -F ${EMMC_DEV_PATH}${PART2} -L SYSTEM | |
79 | - mkfs.ext4 -j -F ${EMMC_DEV_PATH}${PART3} -L FALINUX | |
80 | - mkfs.ext4 -j -F ${EMMC_DEV_PATH}${PART4} -L PRIME | |
81 | -} | |
82 | - | |
83 | -function run_mount() | |
84 | -{ | |
85 | - echo "" | |
86 | - echo -e "${C_LRED}### Mount SD/eMMC - run_mount() ###${C_NC}" | |
87 | - echo "" | |
88 | - | |
89 | - if [ ! -d ${SD_MOUNT_PATH_P1} ]; then | |
90 | - mkdir ${SD_MOUNT_PATH_P1} | |
91 | - fi | |
92 | - | |
93 | - if [ ! -d ${EMMC_MOUNT_PATH_P1} ]; then | |
94 | - mkdir ${EMMC_MOUNT_PATH_P1} | |
95 | - fi | |
96 | - | |
97 | - if [ ! -d ${EMMC_MOUNT_PATH_P2} ]; then | |
98 | - mkdir ${EMMC_MOUNT_PATH_P2} | |
99 | - fi | |
100 | - | |
101 | - if [ ! -d ${EMMC_MOUNT_PATH_P3} ]; then | |
102 | - mkdir ${EMMC_MOUNT_PATH_P3} | |
103 | - fi | |
104 | - | |
105 | - if [ ! -d ${EMMC_MOUNT_PATH_P4} ]; then | |
106 | - mkdir ${EMMC_MOUNT_PATH_P4} | |
107 | - fi | |
108 | - | |
109 | - mount -t ext4 ${SD_DEV_PATH}${PART1} ${SD_MOUNT_PATH_P1} | |
110 | - mount -t ext3 ${EMMC_DEV_PATH}${PART1} ${EMMC_MOUNT_PATH_P1} | |
111 | - mount -t ext4 ${EMMC_DEV_PATH}${PART2} ${EMMC_MOUNT_PATH_P2} | |
112 | - mount -t ext4 ${EMMC_DEV_PATH}${PART3} ${EMMC_MOUNT_PATH_P3} | |
113 | - mount -t ext4 ${EMMC_DEV_PATH}${PART4} ${EMMC_MOUNT_PATH_P4} | |
114 | -} | |
115 | - | |
116 | -function run_copy_image() | |
117 | -{ | |
118 | - echo "" | |
119 | - echo -e "${C_LRED}### Write SD Boot Image - run_copy_image() ###${C_NC}" | |
120 | - echo "" | |
121 | - | |
122 | - if [ ! -d ${EMMC_MOUNT_PATH_P1}/boot ]; then | |
123 | - mkdir ${EMMC_MOUNT_PATH_P1}/boot | |
124 | - fi | |
125 | - | |
126 | - cp -v ${SD_MOUNT_PATH_P1}/boot/${FNAME_UBOOT} ${EMMC_MOUNT_PATH_P1}/boot/ | |
127 | - cp -v ${SD_MOUNT_PATH_P1}/boot/${FNAME_LOGO} ${EMMC_MOUNT_PATH_P1}/boot/ | |
128 | - cp -v ${SD_MOUNT_PATH_P1}/boot/${FNAME_DTB} ${EMMC_MOUNT_PATH_P1}/boot/ | |
129 | - cp -v ${SD_MOUNT_PATH_P1}/boot/${FNAME_KERNEL} ${EMMC_MOUNT_PATH_P1}/boot/ | |
130 | - cp -v ${SD_MOUNT_PATH_P1}/boot/${FNAME_FSCPIO} ${EMMC_MOUNT_PATH_P1}/boot/ | |
131 | - run_copy_rootfs | |
132 | - sleep 1 | |
133 | - sync | |
134 | -} | |
135 | - | |
136 | -function run_copy_rootfs() | |
137 | -{ | |
138 | - echo "" | |
139 | - echo -e "${C_LRED}### Make MMC Filesystem ###${C_NC}" | |
140 | - echo "" | |
141 | - | |
142 | - tar -xf ${SD_MOUNT_PATH_P1}/boot/${FNAME_RFS} -C ${EMMC_MOUNT_PATH_P2} | |
143 | - | |
144 | - cp /etc/ssh/ssh_host_ed25519_key ${EMMC_MOUNT_PATH_P2}/etc/ssh/ | |
145 | - | |
146 | - tar -xf ${SD_MOUNT_PATH_P1}/boot/${FNAME_APP} -C ${EMMC_MOUNT_PATH_P3} | |
147 | - tar -xf ${SD_MOUNT_PATH_P1}/boot/${FNAME_APP} -C ${EMMC_MOUNT_PATH_P4} | |
148 | -} | |
149 | - | |
150 | -function run_raw_write() | |
151 | -{ | |
152 | - echo "" | |
153 | - echo -e "${C_LRED}### Write SD Boot Image to RAW - run_raw_write() ###${C_NC}" | |
154 | - echo "" | |
155 | - dd if=${SD_MOUNT_PATH_P1}/boot/${FNAME_UBOOT} of=${EMMC_DEV_PATH} bs=512 seek=2 | |
156 | - dd if=${SD_MOUNT_PATH_P1}/boot/${FNAME_LOGO} of=${EMMC_DEV_PATH} bs=512 seek=2048 | |
157 | - dd if=${SD_MOUNT_PATH_P1}/boot/${FNAME_DTB} of=${EMMC_DEV_PATH} bs=512 seek=11264 | |
158 | - dd if=${SD_MOUNT_PATH_P1}/boot/${FNAME_KERNEL} of=${EMMC_DEV_PATH} bs=512 seek=12288 | |
159 | - dd if=${SD_MOUNT_PATH_P1}/boot/${FNAME_FSCPIO} of=${EMMC_DEV_PATH} bs=512 seek=28672 | |
160 | - sleep 1 | |
161 | - sync | |
162 | -} | |
163 | - | |
164 | -function run_umount() | |
165 | -{ | |
166 | - echo "" | |
167 | - echo -e "${C_LRED}### UnMount - run_umount() ###${C_NC}" | |
168 | - echo "" | |
169 | - umount ${SD_MOUNT_PATH_P1} | |
170 | - umount ${EMMC_MOUNT_PATH_P1} | |
171 | - umount ${EMMC_MOUNT_PATH_P2} | |
172 | - umount ${EMMC_MOUNT_PATH_P3} | |
173 | - umount ${EMMC_MOUNT_PATH_P4} | |
174 | -} | |
175 | - | |
176 | - | |
177 | -function main() | |
178 | -{ | |
179 | - echo "" | |
180 | - echo -e "${C_LRED}#### Start - main() ####${C_NC}" | |
181 | - echo "" | |
182 | - | |
183 | - Init_Unmount | |
184 | - create_partition | |
185 | - run_format | |
186 | - run_mount | |
187 | - run_copy_image | |
188 | - run_raw_write | |
189 | - run_umount | |
190 | -} | |
191 | - | |
192 | -main |
scripts/mk-emmc-fusing.sh
scripts/mk-fusingsd.sh
... | ... | @@ -1,180 +0,0 @@ |
1 | -#!/bin/bash | |
2 | - | |
3 | -C_NC='\033[0m' | |
4 | -C_LRED='\033[1;31m' | |
5 | - | |
6 | -#### Partition Number #### | |
7 | -P1_NUM="1" | |
8 | - | |
9 | -DEVNAME="mmcblk0" | |
10 | -DEV_PATH="/dev/mmcblk0" | |
11 | -DEV_PATH_P1="/dev/mmcblk0p1" | |
12 | -INPUT="/tmp/input" | |
13 | - | |
14 | -FNAME_UBOOT="u-boot.imx" | |
15 | -FNAME_LOGO="init.bmp" | |
16 | -FNAME_DTB="imx6s-prime-oven.dtb" | |
17 | -FNAME_KERNEL="uImage" | |
18 | -FNAME_FSCPIO="ramdisk-prime_oven.uboot" | |
19 | -FNAME_RFS="rootfs.tar" | |
20 | -FNAME_APP="application.tar" | |
21 | - | |
22 | -MOUNT_PATH_P1="/tmp/mmcblk0p1" | |
23 | - | |
24 | - | |
25 | -function create_partition() | |
26 | -{ | |
27 | - echo "" | |
28 | - echo -e "${C_LRED}### Fdisk Create Partition - create_partition() ###${C_NC}" | |
29 | - echo "" | |
30 | -fdisk $DEV_PATH << EOF | |
31 | -o | |
32 | -n | |
33 | -p | |
34 | -1 | |
35 | -262144 | |
36 | - | |
37 | -p | |
38 | -w | |
39 | -EOF | |
40 | -} | |
41 | - | |
42 | -function run_format() | |
43 | -{ | |
44 | - echo "" | |
45 | - echo -e "${C_LRED}### Format SDCARD - run_format() ###${C_NC}" | |
46 | - echo "" | |
47 | - echo "y" | mkfs.ext4 ${DEV_PATH}${P1_NUM} -L BOOT0 | |
48 | -} | |
49 | - | |
50 | -function run_mount() | |
51 | -{ | |
52 | - echo "" | |
53 | - echo -e "${C_LRED}### Mount SD - run_mount() ###${C_NC}" | |
54 | - echo "" | |
55 | - if [ ! -d ${MOUNT_PATH_P1} ]; then | |
56 | - mkdir ${MOUNT_PATH_P1} | |
57 | - fi | |
58 | - | |
59 | - mount ${DEV_PATH}${P1_NUM} ${MOUNT_PATH_P1} | |
60 | -} | |
61 | - | |
62 | -function run_umount() | |
63 | -{ | |
64 | - echo "" | |
65 | - echo -e "${C_LRED}### UnMount - run_umount() ###${C_NC}" | |
66 | - echo "" | |
67 | - umount ${MOUNT_PATH_P1} | |
68 | -} | |
69 | - | |
70 | -function run_copy_image() | |
71 | -{ | |
72 | - # SD Boot Image(SD 카드 부팅용 이미지) | |
73 | - echo "" | |
74 | - echo -e "${C_LRED}### Write SD Boot Image - run_copy_image() ###${C_NC}" | |
75 | - echo "" | |
76 | - if [ ! -d ${MOUNT_PATH_P1}/boot ]; then | |
77 | - mkdir ${MOUNT_PATH_P1}/boot | |
78 | - fi | |
79 | - cp -v ./$FNAME_UBOOT ${MOUNT_PATH_P1}/boot/ | |
80 | - cp -v ./$FNAME_LOGO ${MOUNT_PATH_P1}/boot/ | |
81 | - cp -v ./$FNAME_DTB ${MOUNT_PATH_P1}/boot/ | |
82 | - cp -v ./$FNAME_KERNEL ${MOUNT_PATH_P1}/boot/ | |
83 | - cp -v ./$FNAME_FSCPIO ${MOUNT_PATH_P1}/boot/ | |
84 | - cp -v ./$FNAME_RFS ${MOUNT_PATH_P1}/boot/ | |
85 | - cp -v ./$FNAME_APP ${MOUNT_PATH_P1}/boot/ | |
86 | - sleep 1 | |
87 | - sync | |
88 | -} | |
89 | - | |
90 | -function run_raw_write() | |
91 | -{ | |
92 | - echo "" | |
93 | - echo -e "${C_LRED}### Write SD Boot Image to RAW - run_raw_write() ###${C_NC}" | |
94 | - echo "" | |
95 | - dd if=./$FNAME_UBOOT of=$DEV_PATH bs=512 seek=2 | |
96 | - dd if=./$FNAME_LOGO of=$DEV_PATH bs=512 seek=2048 | |
97 | - dd if=./$FNAME_DTB of=$DEV_PATH bs=512 seek=11264 | |
98 | - dd if=./$FNAME_KERNEL of=$DEV_PATH bs=512 seek=12288 | |
99 | - dd if=./$FNAME_FSCPIO of=$DEV_PATH bs=512 seek=28672 | |
100 | - sleep 1 | |
101 | - sync | |
102 | -} | |
103 | - | |
104 | -function Init_Unmount() | |
105 | -{ | |
106 | - echo "" | |
107 | - echo -e "${C_LRED}### Unmount SD - Init_Unmount() ###${C_NC}" | |
108 | - echo "" | |
109 | -# umount $DEV_PATH_P1 | |
110 | - umount $DEV_PATH* | |
111 | -} | |
112 | - | |
113 | -function main() | |
114 | -{ | |
115 | - echo "" | |
116 | - echo -e "${C_LRED}#### Start - main() ####${C_NC}" | |
117 | - echo "" | |
118 | - Init_Unmount | |
119 | - create_partition | |
120 | - | |
121 | - run_format | |
122 | - run_mount | |
123 | - run_raw_write | |
124 | - run_copy_image | |
125 | - run_umount | |
126 | - sync | |
127 | -} | |
128 | - | |
129 | -if [[ "$1" == "sd"* ]]; then | |
130 | - if [ "$1" != "sd" ]; then | |
131 | - P1_NUM="1" | |
132 | - else | |
133 | - echo "Missing Partition Number" | |
134 | - exit | |
135 | - fi | |
136 | - | |
137 | -elif [[ "$1" == "mmcblk"* ]]; then | |
138 | - if [ "$1" != "mmcblk" ]; then | |
139 | - P1_NUM="p1" | |
140 | - else | |
141 | - echo "Missing Partition Number" | |
142 | - exit | |
143 | - fi | |
144 | -else | |
145 | - echo "Wrong Device Name" | |
146 | - exit | |
147 | -fi | |
148 | - | |
149 | - | |
150 | -if [ "$1" != "" ]; then | |
151 | - DEVNAME=$1 | |
152 | -fi | |
153 | - | |
154 | -DEV_PATH="/dev/${DEVNAME}" | |
155 | -DEV_PATH_P1="${DEV_PATH}${P1_NUM}" | |
156 | -MOUNT_PATH_P1="/tmp/${DEVNAME}${P1_NUM}" | |
157 | - | |
158 | -echo "" | |
159 | -echo "================================" | |
160 | -echo "DEV_Name: $DEVNAME" | |
161 | -echo "DEV_Path: $DEV_PATH" | |
162 | -echo "P1 MountPath: $MOUNT_PATH_P1" | |
163 | -echo "================================" | |
164 | -echo "" | |
165 | - | |
166 | -read -p "IS Right? (y/n): " -n 2 -e IS_RIGHT | |
167 | - | |
168 | -if [ "$IS_RIGHT" == "y" ]; then | |
169 | - main | |
170 | -elif [ "$IS_RIGHT" == "Y" ]; then | |
171 | - main | |
172 | -else | |
173 | - echo -e "Exit This Script" | |
174 | - exit | |
175 | -fi | |
176 | - | |
177 | - | |
178 | - | |
179 | - | |
180 | - |
scripts/mk-fusingsd.sh