Skip to content

Commit

Permalink
board: pluto & m2k: change mount points
Browse files Browse the repository at this point in the history
/mnt/msd for the mass storage device
/mnt/jffs2 for the JFFS2 partition

Signed-off-by: Michael Hennerich <[email protected]>
  • Loading branch information
mhennerich authored and commodo committed Jun 21, 2020
1 parent f67bbf9 commit 1bfa9dc
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 41 deletions.
8 changes: 4 additions & 4 deletions board/m2k/S21misc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
source /etc/device_config

handle_calibration_files() {
if [[ -s /mnt_jffs2/${CALIBFILENAME} ]]; then
cp /mnt_jffs2/${CALIBFILENAME} /opt/${CALIBFILENAME}
elif [[ -s /mnt_jffs2/${CALIBFILENAME_FACTORY} ]]; then
cp /mnt_jffs2/${CALIBFILENAME_FACTORY} /opt/${CALIBFILENAME}
if [[ -s /mnt/jffs2/${CALIBFILENAME} ]]; then
cp /mnt/jffs2/${CALIBFILENAME} /opt/${CALIBFILENAME}
elif [[ -s /mnt/jffs2/${CALIBFILENAME_FACTORY} ]]; then
cp /mnt/jffs2/${CALIBFILENAME_FACTORY} /opt/${CALIBFILENAME}
fi
}

Expand Down
2 changes: 1 addition & 1 deletion board/m2k/device_config
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ IFAC=/etc/network/interfaces

#update.sh
TARGET=m2k
FIRMWARE=/mnt/m2k.frm
FIRMWARE=/mnt/msd/m2k.frm
FRM_MAGIC="ITB M2k (ADALM-2000)"
CALIBFILENAME=m2k-calib.ini
CALIBFILENAME_FACTORY=m2k-calib-factory.ini
Expand Down
5 changes: 3 additions & 2 deletions board/m2k/post-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sed -i '/hostname/a\

sed -i -e '/::sysinit:\/bin\/hostname -F \/etc\/hostname/d' ${TARGET_DIR}/etc/inittab

grep -q mtd2 ${TARGET_DIR}/etc/fstab || echo "mtd2 /mnt_jffs2 jffs2 rw,noatime 0 0" >> ${TARGET_DIR}/etc/fstab
grep -q mtd2 ${TARGET_DIR}/etc/fstab || echo "mtd2 /mnt/jffs2 jffs2 rw,noatime 0 0" >> ${TARGET_DIR}/etc/fstab

BOARD_DIR="$(dirname $0)"
BOARD_NAME="$(basename ${BOARD_DIR})"
Expand All @@ -36,7 +36,8 @@ rm -f ${TARGET_DIR}/opt/boot.vfat
rm -f ${TARGET_DIR}/etc/init.d/S99iiod

mkdir -p ${TARGET_DIR}/www/img
mkdir -p ${TARGET_DIR}/mnt_jffs2
mkdir -p ${TARGET_DIR}/mnt/jffs2
mkdir -p ${TARGET_DIR}/mnt/msd
mkdir -p ${TARGET_DIR}/etc/wpa_supplicant/

${INSTALL} -D -m 0755 ${BOARD_DIR}/../pluto/update.sh ${TARGET_DIR}/sbin/
Expand Down
14 changes: 7 additions & 7 deletions board/pluto/S45msd
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ case "$1" in
echo -n "Starting MSD Daemon: "
patch_html_page /www/index.html /www/img/version.js
losetup /dev/loop7 $img -o 512
mount /dev/loop7 /mnt
mount /dev/loop7 /mnt/msd

if [ "$TARGET" == "m2k" ]; then
cp /opt/${CALIBFILENAME} /mnt
md5sum /mnt/${CALIBFILENAME} > /opt/${CALIBFILENAME}.md5
md5sum /mnt/msd/${CALIBFILENAME} > /opt/${CALIBFILENAME}.md5
fi

cp $CONF /mnt
md5sum /mnt/config.txt > /opt/config.md5
cp $CONF /mnt/msd
md5sum /mnt/msd/config.txt > /opt/config.md5

cp -a /www/* /mnt/
mv /mnt/index.html /mnt/info.html
umount /mnt
cp -a /www/* /mnt/msd
mv /mnt/msd/index.html /mnt/msd/info.html
umount /mnt/msd
echo $img > $file

start-stop-daemon -S -b -q -m -p /var/run/update.pid -x /bin/sh -- /sbin/update.sh
Expand Down
2 changes: 1 addition & 1 deletion board/pluto/device_config
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ IFAC=/etc/network/interfaces

#update.sh
TARGET=plutosdr
FIRMWARE=/mnt/pluto.frm
FIRMWARE=/mnt/msd/pluto.frm
FRM_MAGIC="ITB PlutoSDR (ADALM-PLUTO)"

1 change: 1 addition & 0 deletions board/pluto/post-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ rm -f ${TARGET_DIR}/etc/init.d/S99iiod
mkdir -p ${TARGET_DIR}/www/img
mkdir -p ${TARGET_DIR}/etc/wpa_supplicant/
mkdir -p ${TARGET_DIR}/mnt/jffs2
mkdir -p ${TARGET_DIR}/mnt/msd

${INSTALL} -D -m 0755 ${BOARD_DIR}/update.sh ${TARGET_DIR}/sbin/
${INSTALL} -D -m 0755 ${BOARD_DIR}/update_frm.sh ${TARGET_DIR}/sbin/
Expand Down
62 changes: 36 additions & 26 deletions board/pluto/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
source /etc/device_config

file=/sys/kernel/config/usb_gadget/composite_gadget/functions/mass_storage.0/lun.0/file
bootimage=/mnt/boot.frm
conf=/mnt/config.txt
bootimage=/mnt/msd/boot.frm
conf=/mnt/msd/config.txt
img=/opt/vfat.img

ini_parser() {
Expand Down Expand Up @@ -82,7 +82,7 @@ process_ini() {
ini_parser $FILE "SYSTEM"
ini_parser $FILE "USB_ETHERNET"

rm -f /mnt/SUCCESS_ENV_UPDATE /mnt/FAILED_INVALID_UBOOT_ENV /mnt/CAL_STATUS
rm -f /mnt/msd/SUCCESS_ENV_UPDATE /mnt/msd/FAILED_INVALID_UBOOT_ENV /mnt/msd/CAL_STATUS


fw_printenv qspiboot
Expand All @@ -102,9 +102,9 @@ process_ini() {
fw_setenv -s /opt/fw_set.tmp
rm /opt/fw_set.tmp
flash_indication_off
touch /mnt/SUCCESS_ENV_UPDATE
touch /mnt/msd/SUCCESS_ENV_UPDATE
else
touch /mnt/FAILED_INVALID_UBOOT_ENV
touch /mnt/msd/FAILED_INVALID_UBOOT_ENV
fi

ini_parser $FILE "ACTIONS"
Expand All @@ -121,20 +121,29 @@ process_ini() {

if [ "$diagnostic_report" == "1" ]
then
make_diagnostic_report /mnt/diagnostic_report
make_diagnostic_report /mnt/msd/diagnostic_report
fi

if [ "$calibrate" -gt "70000000" ]
then
calibrate $calibrate > /mnt/CAL_STATUS
calibrate $calibrate > /mnt/msd/CAL_STATUS
fi

echo here_1: > /mnt/msd/status

if [ "$revert_passwd" == "1" ]
then
echo here $revert_passwd >> /mnt/msd/status
rm -f /mnt/jffs2/etc/passwd /mnt/jffs2/etc/group /mnt/jffs2/etc/password.md5 /mnt/jffs2/etc/shadow 2>&1 >> /mnt/msd/status
echo here_2: >> /mnt/msd/status
fi

md5sum $FILE > /opt/config.md5
}

handle_boot_frm () {
FILE="$1"
rm -f /mnt/BOOT_SUCCESS /mnt/BOOT_FAILED /mnt/FAILED_MTD_PARTITION_ERROR /mnt/FAILED_BOOT_CHSUM_ERROR
rm -f /mnt/msd/BOOT_SUCCESS /mnt/msd/BOOT_FAILED /mnt/msd/FAILED_MTD_PARTITION_ERROR /mnt/msd/FAILED_BOOT_CHSUM_ERROR
head -3 /proc/mtd | sed 's/00010000/00001000/g' > /opt/mtd

md5=`tail -c 33 ${FILE}`
Expand All @@ -153,14 +162,14 @@ handle_boot_frm () {
diff -w /opt/mtd /opt/mtd-info.txt
if [ $? -eq 0 ]; then
flash_indication_on
dd if=/opt/boot.bin of=/dev/mtdblock0 bs=64k && dd if=/opt/u-boot-env.bin of=/dev/mtdblock1 bs=64k && do_reset=1 && touch /mnt/BOOT_SUCCESS || touch /mnt/BOOT_FAILED
dd if=/opt/boot.bin of=/dev/mtdblock0 bs=64k && dd if=/opt/u-boot-env.bin of=/dev/mtdblock1 bs=64k && do_reset=1 && touch /mnt/msd/BOOT_SUCCESS || touch /mnt/msd/BOOT_FAILED
flash_indication_off
else
cat /opt/mtd /opt/mtd-info.txt > /mnt/FAILED_MTD_PARTITION_ERROR
cat /opt/mtd /opt/mtd-info.txt > /mnt/msd/FAILED_MTD_PARTITION_ERROR
do_reset=0
fi
else
echo $md5 $frm > /mnt/FAILED_BOOT_CHSUM_ERROR
echo $md5 $frm > /mnt/msd/FAILED_BOOT_CHSUM_ERROR
do_reset=0
fi

Expand All @@ -172,18 +181,18 @@ handle_boot_frm () {
handle_frimware_frm () {
FILE="$1"
MAGIC="$2"
rm -f /mnt/SUCCESS /mnt/FAILED /mnt/FAILED_FIRMWARE_CHSUM_ERROR
rm -f /mnt/msd/SUCCESS /mnt/msd/FAILED /mnt/msd/FAILED_FIRMWARE_CHSUM_ERROR
md5=`tail -c 33 ${FILE}`
head -c -33 ${FILE} > /opt/firmware.frm
FRM_SIZE=`cat /opt/firmware.frm | wc -c | xargs printf "%X\n"`
frm=`md5sum /opt/firmware.frm | cut -d ' ' -f 1`
if [ "$frm" = "$md5" ]
then
flash_indication_on
grep -q "${MAGIC}" /opt/firmware.frm && dd if=/opt/firmware.frm of=/dev/mtdblock3 bs=64k && fw_setenv fit_size ${FRM_SIZE} && do_reset=1 && touch /mnt/SUCCESS || touch /mnt/FAILED
grep -q "${MAGIC}" /opt/firmware.frm && dd if=/opt/firmware.frm of=/dev/mtdblock3 bs=64k && fw_setenv fit_size ${FRM_SIZE} && do_reset=1 && touch /mnt/msd/SUCCESS || touch /mnt/msd/FAILED
flash_indication_off
else
echo $frm $md5 > /mnt/FAILED_FIRMWARE_CHSUM_ERROR
echo $frm $md5 > /mnt/msd/FAILED_FIRMWARE_CHSUM_ERROR
do_reset=0
fi

Expand All @@ -200,12 +209,13 @@ do
then
do_reset=0
losetup /dev/loop7 $img -o 512
mount /dev/loop7 /mnt
mkdir -p /mnt/msd
mount /dev/loop7 /mnt/msd

if [[ -s /mnt/$TARGET-fw-*.zip ]]
if [[ -s /mnt/msd/$TARGET-fw-*.zip ]]
then
mv /mnt/$TARGET-fw-*.zip /opt/
unzip -o /opt/$TARGET-fw-*.zip *.frm -d /mnt
mv /mnt/msd/$TARGET-fw-*.zip /opt/
unzip -o /opt/$TARGET-fw-*.zip *.frm -d /mnt/msd
rm /opt/$TARGET-fw-*.zip
fi

Expand All @@ -222,19 +232,19 @@ do
md5sum -c /opt/config.md5 || process_ini $conf

if [ "$TARGET" == "m2k" ]; then
if [[ -s /mnt/${CALIBFILENAME} ]]; then
if [[ -s /mnt/msd/${CALIBFILENAME} ]]; then
md5sum -c /opt/${CALIBFILENAME}.md5
if [ $? -ne 0 ]; then
cp /mnt/${CALIBFILENAME} /mnt_jffs2/${CALIBFILENAME} && do_reset=1
cp /mnt/msd/${CALIBFILENAME} /mnt/jffs2/${CALIBFILENAME} && do_reset=1
fi

else
rm /mnt_jffs2/${CALIBFILENAME} && do_reset=1
rm /mnt/jffs2/${CALIBFILENAME} && do_reset=1
fi

if [[ -s /mnt/${CALIBFILENAME_FACTORY} ]]; then
if [[ ! -s /mnt_jffs2/${CALIBFILENAME_FACTORY} ]]; then
cp /mnt/${CALIBFILENAME_FACTORY} /mnt_jffs2/${CALIBFILENAME_FACTORY}
if [[ -s /mnt/msd/${CALIBFILENAME_FACTORY} ]]; then
if [[ ! -s /mnt/jffs2/${CALIBFILENAME_FACTORY} ]]; then
cp /mnt/msd/${CALIBFILENAME_FACTORY} /mnt/jffs2/${CALIBFILENAME_FACTORY}
do_reset=1
fi
fi
Expand All @@ -245,9 +255,9 @@ do
reset
fi

cp /opt/ipaddr-* /mnt 2>/dev/null
cp /opt/ipaddr-* /mnt/msd 2>/dev/null

umount /mnt
umount /mnt/msd
#losetup -d /dev/loop7
echo $img > $file
flash_indication_off
Expand Down

0 comments on commit 1bfa9dc

Please sign in to comment.