summaryrefslogtreecommitdiff
path: root/recipes-core/initscripts
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2022-07-08 10:31:31 -0500
committerJohn Klug <john.klug@multitech.com>2022-07-08 10:31:31 -0500
commit5b87f709186ee28979e79e1702769c7c6b9a872d (patch)
tree539a4debb29c315da6284f536004108fcf2d97a0 /recipes-core/initscripts
parent67288e84ecaa417d01174bae02ffd6505b5ea263 (diff)
downloadmeta-mlinux-5b87f709186ee28979e79e1702769c7c6b9a872d.tar.gz
meta-mlinux-5b87f709186ee28979e79e1702769c7c6b9a872d.tar.bz2
meta-mlinux-5b87f709186ee28979e79e1702769c7c6b9a872d.zip
Fix umountfs to work with bad blocks on the NAND
Diffstat (limited to 'recipes-core/initscripts')
-rw-r--r--recipes-core/initscripts/initscripts-1.0/umountfs54
-rw-r--r--recipes-core/initscripts/initscripts_1.0.bbappend2
2 files changed, 30 insertions, 26 deletions
diff --git a/recipes-core/initscripts/initscripts-1.0/umountfs b/recipes-core/initscripts/initscripts-1.0/umountfs
index 14aa441..2035ad3 100644
--- a/recipes-core/initscripts/initscripts-1.0/umountfs
+++ b/recipes-core/initscripts/initscripts-1.0/umountfs
@@ -348,55 +348,53 @@ flash_upgrade() {
umount_all
mount -o remount,rw /var/volatile
grep volatile /proc/mounts
-
+ fail=0
+ tardeleted=0
if [ -f "${upgrade_file}" ]; then
for (( i = 0; i < ${#files[@]}; i++ )); do
local file=${files[i]}
local dev=${devs[i]}
- echo "Processing file $file"
+ echo "Processing file $file for flashing"
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}")
- if dd if=${dev} bs=${file_size} count=1 | md5sum -c ${file}.md5; then
- echo "Found ${file} in upgrade but it is the same as current. Continuing..."
+ if [[ ${file} == ${bootstrap_file} ]] || [[ ${file} == ${uboot_file} ]] || [[ ${file} == ${kernel_file} ]]; then
+ file_size=$(get_file_size "${upgrade_file}" "${file}")
+ if nanddump -l ${file_size} ${dev} | md5sum -c ${file}.md5 >/dev/null 2>&1; then
+ echo "Found ${file} in upgrade but it is the same as current. Skipping..."
continue
fi
- elif ((factory_up == 1)) ; then # Not AT91Bootstrap or U-Boot.
- file_size=$(get_file_size "${upgrade_file}" "${file}")
- if [ "${file}" == "${kernel_file}" ]; then
- if dd if=${dev} bs=${file_size} count=1 | md5sum -c ${file}.md5; then
- echo "Found ${file} in upgrade but it is the same as current. Continuing..."
- continue
- fi # Matching md5sum
- fi # kernel_file case
- fi # factory upgrade
+ fi # Test files to see if we skip them
echo "Flashing ${dev} with ${file}..."
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 [[ ${file} == rootfs.jffs2 ]] ; then
- pwd
+ if [[ ${file} == ${rootfs_file} ]] ; then
rm -f ${upgrade_file}
- echo "Block size is $rootbs, count=$rootcount"
- dd if=${dev} bs=${rootbs} count=${rootcount} | md5sum -c ${file}.md5
+ tardeleted=1
+ nanddump -l ${root_sz} ${dev} | md5sum -c ${file}.md5
result=$?
else
- dd if=${dev} bs=${file_size} count=1 | md5sum -c ${file}.md5
+ file_size=$(get_file_size "${upgrade_file}" "${file}")
+ nanddump -l ${file_size} ${dev} | md5sum -c ${file}.md5
result=$?
fi
if ((result == 0)); then
echo "SUCCESS: File ${file} was written successfully"
else
- if [[ ${file} == rootfs.jffs2 ]] ; then
- echo "dd if=${dev} bs=${rootbs} count=${rootcount} | md5sum"
- dd if=${dev} bs=${rootbs} count=${rootcount} | md5sum
+ ((fail++))
+ ((file_size=rootbs*rootcount))
+ if [[ ${file} == ${rootfs_file} ]] ; then
+ echo "nanddump -l ${root_sz} ${dev} | md5sum"
+ nanddump -l ${root_sz} ${dev} | 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
+ echo "nanddump -l ${file_size} ${dev} | md5sum -c ${file}.md5"
+ nanddump -l ${file_size} ${dev} | md5sum -c ${file}.md5
fi
echo "ERROR: File ${file} is bad"
fi
+ if ((tardeleted == 1)) ; then
+ break
+ fi # tar file is removed
fi # factory upgrade
fi # Found a file in the upgrade package
done # Loop through the files in an upgrade package
@@ -438,6 +436,11 @@ flash_upgrade() {
fi
if ((factory_up == 1)) ; then
+ if ((fail == 0)) ; then
+ echo 'SUCCESS: All partitions are correct.'
+ else
+ echo "FAILED: ${fail} failures."
+ fi
echo "Finished upgrade. Halting."
while : ; do : ; done # Wait forever
else
@@ -466,6 +469,7 @@ if [[ -f ${upgrade_fname} ]] ; then
if [[ -n $rootbs ]] ; then
factory_up=1
extraopt="-q"
+ ((root_sz=rootbs*rootcount))
else
factory_up=0
fi
diff --git a/recipes-core/initscripts/initscripts_1.0.bbappend b/recipes-core/initscripts/initscripts_1.0.bbappend
index f4edd90..7265d69 100644
--- a/recipes-core/initscripts/initscripts_1.0.bbappend
+++ b/recipes-core/initscripts/initscripts_1.0.bbappend
@@ -3,4 +3,4 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:"
# flash on reboot/umountfs needs regular umount (not busybox)
RDEPENDS_${PN} += "util-linux-umount util-linux-mount bash"
-PR .= ".49"
+PR .= ".50"