version 1.2, 2011/10/18 09:02:05
|
version 1.7.6.2, 2014/09/12 00:29:27
|
Line 29 DEV=""
|
Line 29 DEV=""
|
mkdevice() |
mkdevice() |
{ |
{ |
echo "+++ Make prepare file image ... " |
echo "+++ Make prepare file image ... " |
rm -f $IMG | rm -f $1 |
dd if=/dev/zero of=${IMG} bs=1024 count=${IMG_SIZE} | dd if=/dev/zero of=$1 bs=1024 count=$2 |
|
|
echo -n "+++ Assign memory device to image ... " | echo -n "+++ Assign memory device to image $1 ... " |
DEV=`mdconfig -a -tvnode -f ${IMG}` | DEV=`mdconfig -a -tvnode -f $1` |
echo $DEV |
echo $DEV |
|
|
if [ -z "$DEV" ]; then |
if [ -z "$DEV" ]; then |
rm -f $IMG | rm -f $1 |
exit 3 |
exit 3 |
fi |
fi |
} |
} |
Line 52 initdev()
|
Line 52 initdev()
|
exit 3 |
exit 3 |
fi |
fi |
|
|
|
disklabel $1 2>&- | awk -vcfgsize=${CFG_NAND_SIZE:-65536} '($1 == "a:") { |
|
cfgsize /= 512; |
|
for (i = 1; i <= NF; i++) { |
|
if (i == 2) |
|
printf("%s ", $i - cfgsize); |
|
else if (i == 3) { |
|
offset = $i; |
|
printf("%s ", cfgsize + offset); |
|
} else |
|
printf("%s ", $i); |
|
} |
|
printf("\n"); |
|
printf("g: %d %d cfg 0 0 0\n", cfgsize, offset); |
|
next; |
|
} |
|
{ printf("%s\n", $0); }' >/tmp/disklabel.tmp |
|
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 95 enablejfs()
|
Line 119 enablejfs()
|
boot2dev() |
boot2dev() |
{ |
{ |
echo -n "+++ Installboot to device $1 ... " |
echo -n "+++ Installboot to device $1 ... " |
if disklabel -B -b ${WORLD}/boot/boot -m ${TARGET} ${1}; then | if disklabel -B -b ${WORLD}/boot/boot -m ${TARGET} $1; then |
echo "OK" |
echo "OK" |
else |
else |
echo "Failed!" |
echo "Failed!" |
Line 122 cleandev()
|
Line 146 cleandev()
|
gencksum() |
gencksum() |
{ |
{ |
echo -n "+++ Generate check sums ... " |
echo -n "+++ Generate check sums ... " |
md5 ${IMG} >${MD5CHK} | md5 $1 >$2 |
sha1 ${IMG} >${SHA1CHK} | sha1 $1 >$3 |
echo "OK" |
echo "OK" |
} |
} |
|
|
### main() |
### main() |
|
|
if [ ! -r ${1:-"${REL}/${OS}"} ]; 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 |
echo |
exit 2 |
exit 2 |
|
else |
|
IMGNAME=$(basename $1 | sed -e "s/.tar.gz//") |
|
MD5CHK="${REL}/${IMGNAME}.md5" |
|
SHA1CHK="${REL}/${IMGNAME}.sha1" |
|
IMG="${REL}/${IMGNAME}.img" |
fi |
fi |
|
|
mkdevice | mkdevice $IMG ${2:-"${IMG_SIZE}"} |
| |
initdev $DEV |
initdev $DEV |
|
|
mountdev $DEV |
mountdev $DEV |
install2 ${1:-"$REL/$OS"} | install2 $1 |
umountdev |
umountdev |
|
|
#enablejfs $DEV |
#enablejfs $DEV |
boot2dev $DEV |
boot2dev $DEV |
|
|
cleandev $DEV |
cleandev $DEV |
|
gencksum $IMG $MD5CHK $SHA1CHK |
|
|
gencksum | echo "ELWIX OS image $IMGNAME complete." |
echo "ELWIX OS image complete." | |