From c68d4d88a538f364dfd28db155fc3f2d5e6f3cac Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 17 Nov 2021 13:37:14 -0600 Subject: umountfs for flashing MTRV1-0.4 with mLinux --- recipes-core/initscripts/initscripts-1.0/umountfs | 36 ++++++++++++++++++----- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'recipes-core/initscripts/initscripts-1.0/umountfs') diff --git a/recipes-core/initscripts/initscripts-1.0/umountfs b/recipes-core/initscripts/initscripts-1.0/umountfs index d3ac460..14aa441 100644 --- a/recipes-core/initscripts/initscripts-1.0/umountfs +++ b/recipes-core/initscripts/initscripts-1.0/umountfs @@ -245,7 +245,11 @@ flash_upgrade() { cd /var/volatile # rootfs should always be flashed last, so always keep it last here - local files=(${bootstrap_file} ${uboot_file} ${config_file} ${oem_file} ${kernel_file} ${rootfs_file} ${install_file}) + if ((factory_up == 0)) ; then + local files=(${bootstrap_file} ${uboot_file} ${config_file} ${oem_file} ${kernel_file} ${rootfs_file} ${install_file}) + else + local files=(${bootstrap_file} ${uboot_file} ${config_file} ${oem_file} ${kernel_file} ${rootfs_file}) + fi local devs=(${bootstrap_mtd} ${uboot_mtd} ${config_mtd} ${oem_mtd} ${kernel_mtd} ${rootfs_mtd}) if [ -f "${upgrade_file}" ]; then @@ -342,11 +346,14 @@ flash_upgrade() { sed -i -e "\\|${flash_root}| d" /etc/mtab umount_all + mount -o remount,rw /var/volatile + grep volatile /proc/mounts if [ -f "${upgrade_file}" ]; then for (( i = 0; i < ${#files[@]}; i++ )); do local file=${files[i]} local dev=${devs[i]} + echo "Processing file $file" if tar -t -f ${upgrade_file} | grep -F -q "${file}"; then if [ "${file}" == "${bootstrap_file}" ] || [ "${file}" == "${uboot_file}" ]; then file_size=$(get_file_size "${upgrade_file}" "${file}") @@ -368,13 +375,26 @@ flash_upgrade() { flash_erase ${extraopt} -j ${dev} 0 0 tar -xO -f ${upgrade_file} ${file} | ${flash_dir}/nandwrite.static ${extraopt} -p ${dev} if ((factory_up == 1)) ; then - if dd if=${dev} bs=${file_size} count=1 | md5sum -c ${file}.md5; then + if [[ ${file} == rootfs.jffs2 ]] ; then + pwd + rm -f ${upgrade_file} + echo "Block size is $rootbs, count=$rootcount" + dd if=${dev} bs=${rootbs} count=${rootcount} | md5sum -c ${file}.md5 + result=$? + else + dd if=${dev} bs=${file_size} count=1 | md5sum -c ${file}.md5 + result=$? + fi + if ((result == 0)); then echo "SUCCESS: File ${file} was written successfully" else - cat ${file}.md5 - echo ${file_size} - echo dd if=${dev} bs=${file_size} count=1 | md5sum - dd if=${dev} bs=${file_size} count=1 | md5sum + if [[ ${file} == rootfs.jffs2 ]] ; then + echo "dd if=${dev} bs=${rootbs} count=${rootcount} | md5sum" + dd if=${dev} bs=${rootbs} count=${rootcount} | md5sum + else + echo "dd if=${dev} bs=${file_size} count=1 | md5sum -c ${file}.md5" + dd if=${dev} bs=${file_size} count=1 | md5sum -c ${file}.md5 + fi echo "ERROR: File ${file} is bad" fi fi # factory upgrade @@ -441,7 +461,9 @@ if [[ -f ${wipe_fname} ]] ; then fi fi if [[ -f ${upgrade_fname} ]] ; then - if [[ $(cat ${upgrade_fname}) == "1" ]] ; then + read rootbs rootcount < ${upgrade_fname} + echo "Root Block Size is $rootbs, rootcount is $rootcount" + if [[ -n $rootbs ]] ; then factory_up=1 extraopt="-q" else -- cgit v1.2.3