version 1.2.4.1, 2012/10/11 13:31:33
|
version 1.9, 2021/03/11 13:59:50
|
Line 52 initdev()
|
Line 52 initdev()
|
exit 3 |
exit 3 |
fi |
fi |
|
|
|
if [ X"$2" != X"no" ]; then |
|
disklabel $1 2>&- | awk -vcfgsize=${CFG_NAND_SIZE:-65536} '($1 == "a:") { |
|
cfgsize /= 512; |
|
bootoff = $3; |
|
freesize = $2 - cfgsize; |
|
imgsize = freesize / 2; |
|
|
|
printf(" a: %d %d unused 0 0 0\n", imgsize, cfgsize + bootoff); |
|
printf(" f: %d %d unused 0 0 0\n", imgsize, imgsize + cfgsize + bootoff); |
|
printf(" g: %d %d cfg 0 0 0\n", cfgsize, bootoff); |
|
next; |
|
} |
|
{ printf("%s\n", $0); }' >/tmp/disklabel.tmp |
|
else |
|
disklabel $1 2>&- | awk -vcfgsize=${CFG_NAND_SIZE:-65536} '($1 == "a:") { |
|
cfgsize /= 512; |
|
bootoff = $3; |
|
freesize = $2 - cfgsize; |
|
imgsize = freesize; |
|
|
|
printf(" a: %d %d unused 0 0 0\n", imgsize, cfgsize + bootoff); |
|
printf(" g: %d %d cfg 0 0 0\n", cfgsize, bootoff); |
|
next; |
|
} |
|
{ printf("%s\n", $0); }' >/tmp/disklabel.tmp |
|
fi |
|
|
|
if disklabel -R -m ${TARGET} $1 /tmp/disklabel.tmp; then |
|
rm -f /tmp/disklabel.tmp |
|
echo "OK" |
|
else |
|
echo "Failed!" |
|
exit 3 |
|
fi |
|
|
if newfs -b8192 -f1024 -m0 -Lelwix ${1}a; then |
if newfs -b8192 -f1024 -m0 -Lelwix ${1}a; then |
echo "+++ Formatting ... OK" |
echo "+++ Formatting ... OK" |
else |
else |
Line 114 install2()
|
Line 149 install2()
|
fi |
fi |
} |
} |
|
|
|
mkbak2() |
|
{ |
|
if [ X"$2" != X"no" ]; then |
|
echo "+++ Syncing ELWIX OS image as backup OS image into ${1}f ..." |
|
if dd if=/dev/${1}a of=/dev/${1}f; then |
|
tunefs -L elwix2 /dev/${1}f |
|
echo "OK" |
|
else |
|
echo "Failed!" |
|
exit 8 |
|
fi |
|
else |
|
echo "+++ Make ELWIX OS system image partion for upgrade into ${REL}/sys4up_${IMGNAME}.bin ..." |
|
if dd if=/dev/${1}a of=${REL}/sys4up_${IMGNAME}.bin; then |
|
echo "OK" |
|
else |
|
echo "Failed!" |
|
exit 9 |
|
fi |
|
fi |
|
|
|
if [ ! -f ${REL}/sys4up_${IMGNAME}.bin ]; then |
|
echo "+++ Make ELWIX OS system image partion for upgrade into ${REL}/sys4up_${IMGNAME}.bin ..." |
|
if dd if=/dev/${1}a of=${REL}/sys4up_${IMGNAME}.bin; then |
|
echo "OK" |
|
else |
|
echo "Failed!" |
|
exit 9 |
|
fi |
|
fi |
|
} |
|
|
cleandev() |
cleandev() |
{ |
{ |
mdconfig -d -u $1 |
mdconfig -d -u $1 |
Line 129 gencksum()
|
Line 196 gencksum()
|
|
|
### main() |
### main() |
|
|
if [ ! -r ${REL}/${OS} -a -r ${REL}/${OS_LITE} ]; then | if [ -z "$1" -o ! -r "$1" ]; then |
echo |
echo |
echo "Error:: ELWIX OS file not found!" | echo "Error:: ELWIX OS tar file '$1' not found!" |
| echo "Syntax:: ./install2img.sh <ELWIX.tar.gz> [CF size] [yes == make secondary backup image]" |
echo |
echo |
exit 2 |
exit 2 |
|
else |
|
IMGNAME=$(basename $1 | sed -e "s/.tar.gz//") |
|
MD5CHK="${REL}/${IMGNAME}${3:+"_2nd"}.md5" |
|
SHA1CHK="${REL}/${IMGNAME}${3:+"_2nd"}.sha1" |
|
IMG="${REL}/${IMGNAME}${3:+"_2nd"}.img" |
fi |
fi |
|
|
mkdevice $IMG ${1:-"${IMG_SIZE}"} | mkdevice $IMG ${2:-"${IMG_SIZE}"} |
initdev $DEV | initdev $DEV ${3:-"no"} |
mountdev $DEV |
mountdev $DEV |
install2 ${REL}/${OS} | install2 $1 |
umountdev |
umountdev |
#enablejfs $DEV |
#enablejfs $DEV |
boot2dev $DEV |
boot2dev $DEV |
|
mkbak2 $DEV ${3:-"no"} |
cleandev $DEV |
cleandev $DEV |
gencksum $IMG $MD5CHK $SHA1CHK |
gencksum $IMG $MD5CHK $SHA1CHK |
|
gencksum ${REL}/sys4up_${IMGNAME}.bin ${REL}/sys4up_${IMGNAME}.md5 ${REL}/sys4up_${IMGNAME}.sha1 |
|
|
| echo "ELWIX OS image ${IMGNAME}${3:+"_2nd"} complete." |
mkdevice $IMG_LITE ${1:-"${IMG_SIZE}"} | |
initdev $DEV | |
mountdev $DEV | |
install2 ${REL}/${OS_LITE} | |
umountdev | |
#enablejfs $DEV | |
boot2dev $DEV | |
cleandev $DEV | |
gencksum $IMG_LITE $MD5CHK_LITE $SHA1CHK_LITE | |
| |
echo "ELWIX OS image complete." | |