mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-27 21:26:36 +00:00
Merge remote-tracking branch 'thingos/dev' into dev
This commit is contained in:
commit
4b5e40d430
@ -25,6 +25,7 @@ rm -f ${TARGET}/etc/udev/hwdb.d/20-pci-vendor-model.hwdb
|
|||||||
rm -f ${TARGET}/etc/hostname
|
rm -f ${TARGET}/etc/hostname
|
||||||
rm -f ${TARGET}/etc/os-release
|
rm -f ${TARGET}/etc/os-release
|
||||||
rm -f ${TARGET}/etc/hostapd.conf
|
rm -f ${TARGET}/etc/hostapd.conf
|
||||||
|
rm -f ${TARGET}/etc/timezone
|
||||||
|
|
||||||
# /usr/share stuff
|
# /usr/share stuff
|
||||||
rm -rf ${TARGET}/usr/share/bash-completion/
|
rm -rf ${TARGET}/usr/share/bash-completion/
|
||||||
|
@ -15,12 +15,13 @@ function exit_usage() {
|
|||||||
echo ""
|
echo ""
|
||||||
echo "Statuses:"
|
echo "Statuses:"
|
||||||
echo " idle"
|
echo " idle"
|
||||||
echo " downloading <version>"
|
echo " downloading [version]"
|
||||||
echo " downloaded <version>"
|
echo " downloaded [version]"
|
||||||
echo " extracting <version>"
|
echo " extracting [version]"
|
||||||
echo " extracted <version>"
|
echo " extracted [version]"
|
||||||
echo " flashing boot <version>"
|
echo " flashing boot [version]"
|
||||||
echo " boot ready <version>"
|
echo " boot flashed [version]"
|
||||||
|
echo " rebooting [version]"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
@ -51,7 +52,14 @@ VER_FILE=${FW_DIR}/version
|
|||||||
|
|
||||||
BOOT_INFO_FILE=${FW_DIR}/boot_info
|
BOOT_INFO_FILE=${FW_DIR}/boot_info
|
||||||
ROOT_INFO_FILE=${FW_DIR}/root_info
|
ROOT_INFO_FILE=${FW_DIR}/root_info
|
||||||
BOOT_READY_FILE=${FW_DIR}/boot_flash_ready
|
|
||||||
|
DOWNLOAD_STARTED_FILE=${FW_DIR}/download_started
|
||||||
|
DOWNLOAD_DONE_FILE=${FW_DIR}/download_done
|
||||||
|
EXTRACT_STARTED_FILE=${FW_DIR}/extract_started
|
||||||
|
EXTRACT_DONE_FILE=${FW_DIR}/extract_done
|
||||||
|
FLASH_BOOT_STARTED_FILE=${FW_DIR}/flash_boot_started
|
||||||
|
FLASH_BOOT_DONE_FILE=${FW_DIR}/flash_boot_done
|
||||||
|
FLASH_REBOOT_STARTED_FILE=${FW_DIR}/flash_reboot_started
|
||||||
|
|
||||||
TMP_BOOT_DIR=/tmp/fwupdate_boot
|
TMP_BOOT_DIR=/tmp/fwupdate_boot
|
||||||
TMP_ROOT_DIR=/tmp/fwupdate_root
|
TMP_ROOT_DIR=/tmp/fwupdate_root
|
||||||
@ -84,7 +92,7 @@ function cleanup_on_exit() {
|
|||||||
rm -f /sbin/reboot
|
rm -f /sbin/reboot
|
||||||
mv /sbin/reboot.bak /sbin/reboot
|
mv /sbin/reboot.bak /sbin/reboot
|
||||||
fi
|
fi
|
||||||
|
|
||||||
umount ${TMP_BOOT_DIR} 2>/dev/null
|
umount ${TMP_BOOT_DIR} 2>/dev/null
|
||||||
umount ${TMP_ROOT_DIR} 2>/dev/null
|
umount ${TMP_ROOT_DIR} 2>/dev/null
|
||||||
losetup -d ${BOOT_LOOP} 2>/dev/null
|
losetup -d ${BOOT_LOOP} 2>/dev/null
|
||||||
@ -97,9 +105,16 @@ function cleanup_on_exit() {
|
|||||||
#### disk & partition devices ####
|
#### disk & partition devices ####
|
||||||
|
|
||||||
BOOT_DEV=$(mount | grep /boot | cut -d ' ' -f 1)
|
BOOT_DEV=$(mount | grep /boot | cut -d ' ' -f 1)
|
||||||
ROOT_DEV=${BOOT_DEV:0:-1}2
|
if [[ -n "${BOOT_DEV}" ]]; then
|
||||||
DATA_DEV=${BOOT_DEV:0:-1}3
|
ROOT_DEV=${BOOT_DEV:0:-1}2
|
||||||
DISK_DEV=$(mount | grep /boot | cut -d ' ' -f 1)
|
DATA_DEV=${BOOT_DEV:0:-1}3
|
||||||
|
else # boot partition not mounted, trying with data partition
|
||||||
|
DATA_DEV=$(mount | grep /data | cut -d ' ' -f 1)
|
||||||
|
BOOT_DEV=${DATA_DEV:0:-1}1
|
||||||
|
ROOT_DEV=${BOOT_DEV:0:-1}2
|
||||||
|
fi
|
||||||
|
|
||||||
|
DISK_DEV=${BOOT_DEV}
|
||||||
if [[ "${ROOT_DEV}" =~ ^([/a-z0-9]+)(p[0-9])$ ]]; then # e.g. /dev/mmcblk0p2
|
if [[ "${ROOT_DEV}" =~ ^([/a-z0-9]+)(p[0-9])$ ]]; then # e.g. /dev/mmcblk0p2
|
||||||
DISK_DEV=${BASH_REMATCH[1]}
|
DISK_DEV=${BASH_REMATCH[1]}
|
||||||
elif [[ "${ROOT_DEV}" =~ ^([/a-z0-9]+)([0-9])$ ]]; then # e.g. /dev/sdc2
|
elif [[ "${ROOT_DEV}" =~ ^([/a-z0-9]+)([0-9])$ ]]; then # e.g. /dev/sdc2
|
||||||
@ -118,14 +133,14 @@ function reallocate_boot_part() {
|
|||||||
|
|
||||||
boot_info=($(cat ${BOOT_INFO_FILE}))
|
boot_info=($(cat ${BOOT_INFO_FILE}))
|
||||||
|
|
||||||
if [[ ${current_boot_info[1]} == ${boot_info[0]} ]] &&
|
if [[ ${current_boot_info[1]} == ${boot_info[0]} ]] &&
|
||||||
[[ ${current_boot_info[2]} == ${boot_info[1]} ]]; then
|
[[ ${current_boot_info[2]} == ${boot_info[1]} ]]; then
|
||||||
|
|
||||||
return # all good
|
return # all good
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "reallocating boot partition..."
|
echo "reallocating boot partition..."
|
||||||
|
|
||||||
# check overlapping with root partition
|
# check overlapping with root partition
|
||||||
if [[ ${boot_info[1]} -ge ${current_root_info[1]} ]]; then
|
if [[ ${boot_info[1]} -ge ${current_root_info[1]} ]]; then
|
||||||
echo "cannot reallocate boot partition: will overlap with root"
|
echo "cannot reallocate boot partition: will overlap with root"
|
||||||
@ -157,14 +172,14 @@ function reallocate_root_part() {
|
|||||||
|
|
||||||
root_info=($(cat ${ROOT_INFO_FILE}))
|
root_info=($(cat ${ROOT_INFO_FILE}))
|
||||||
|
|
||||||
if [[ ${current_root_info[1]} == ${root_info[0]} ]] &&
|
if [[ ${current_root_info[1]} == ${root_info[0]} ]] &&
|
||||||
[[ ${current_root_info[2]} == ${root_info[1]} ]]; then
|
[[ ${current_root_info[2]} == ${root_info[1]} ]]; then
|
||||||
|
|
||||||
return # all good
|
return # all good
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "reallocating root partition..."
|
echo "reallocating root partition..."
|
||||||
|
|
||||||
# check overlapping with data partition
|
# check overlapping with data partition
|
||||||
if [[ ${root_info[1]} -ge ${current_data_info[1]} ]]; then
|
if [[ ${root_info[1]} -ge ${current_data_info[1]} ]]; then
|
||||||
echo "cannot reallocate root partition: will overlap with data"
|
echo "cannot reallocate root partition: will overlap with data"
|
||||||
@ -193,7 +208,7 @@ END
|
|||||||
function show_versions() {
|
function show_versions() {
|
||||||
board=$(cat ${SYS_BOARD_FILE})
|
board=$(cat ${SYS_BOARD_FILE})
|
||||||
show_json=$1
|
show_json=$1
|
||||||
|
|
||||||
# the /usr/libexec/list-versions-* helpers return a table with the following format:
|
# the /usr/libexec/list-versions-* helpers return a table with the following format:
|
||||||
# <version>|<prerelease>|<board>|<url>|<date>
|
# <version>|<prerelease>|<board>|<url>|<date>
|
||||||
versions=$(FW_USERNAME=${OS_FIRMWARE_USERNAME} FW_PASSWORD=${OS_FIRMWARE_PASSWORD} \
|
versions=$(FW_USERNAME=${OS_FIRMWARE_USERNAME} FW_PASSWORD=${OS_FIRMWARE_PASSWORD} \
|
||||||
@ -231,11 +246,19 @@ function show_current() {
|
|||||||
#### download ####
|
#### download ####
|
||||||
|
|
||||||
function do_download() {
|
function do_download() {
|
||||||
echo "downloading..."
|
|
||||||
|
|
||||||
rm -rf ${FW_DIR}/*
|
rm -rf ${FW_DIR}/*
|
||||||
mkdir -p ${FW_DIR}
|
mkdir -p ${FW_DIR}
|
||||||
|
|
||||||
|
rm -f ${DOWNLOAD_DONE_FILE}
|
||||||
|
rm -f ${EXTRACT_STARTED_FILE}
|
||||||
|
rm -f ${EXTRACT_DONE_FILE}
|
||||||
|
rm -f ${FLASH_BOOT_STARTED_FILE}
|
||||||
|
rm -f ${FLASH_BOOT_DONE_FILE}
|
||||||
|
rm -f ${FLASH_REBOOT_STARTED_FILE}
|
||||||
|
touch ${DOWNLOAD_STARTED_FILE}
|
||||||
|
|
||||||
|
echo "downloading..."
|
||||||
|
|
||||||
# Look for local file first
|
# Look for local file first
|
||||||
if [[ -f "$1" ]]; then
|
if [[ -f "$1" ]]; then
|
||||||
version="custom"
|
version="custom"
|
||||||
@ -253,7 +276,7 @@ function do_download() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
board=$(cat ${SYS_BOARD_FILE})
|
board=$(cat ${SYS_BOARD_FILE})
|
||||||
url=$1
|
url=$1
|
||||||
version=$1
|
version=$1
|
||||||
@ -294,29 +317,16 @@ function do_download() {
|
|||||||
|
|
||||||
set +e # don't exit on error just yet
|
set +e # don't exit on error just yet
|
||||||
wait ${pid}
|
wait ${pid}
|
||||||
|
|
||||||
if [[ "$?" != 0 ]]; then
|
if [[ "$?" != 0 ]]; then
|
||||||
cat ${CURL_LOG_FILE}
|
cat ${CURL_LOG_FILE}
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
touch ${DOWNLOAD_DONE_FILE}
|
||||||
set -e
|
set -e
|
||||||
}
|
}
|
||||||
|
|
||||||
function download_status() {
|
|
||||||
if [[ -f ${CURL_PID_FILE} ]]; then
|
|
||||||
pid=$(cat ${CURL_PID_FILE})
|
|
||||||
if kill -0 ${pid} &>/dev/null; then
|
|
||||||
echo "running"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -f ${FW_FILE_GZ} || -f ${FW_FILE_XZ} ]]; then
|
|
||||||
echo "done"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#### extract ####
|
#### extract ####
|
||||||
|
|
||||||
@ -326,21 +336,21 @@ function run_pre_upgrade() {
|
|||||||
boot_info=($(cat ${BOOT_INFO_FILE}))
|
boot_info=($(cat ${BOOT_INFO_FILE}))
|
||||||
root_info=($(cat ${ROOT_INFO_FILE}))
|
root_info=($(cat ${ROOT_INFO_FILE}))
|
||||||
pre_upgrade="${TMP_ROOT_DIR}/usr/share/pre-upgrade/*"
|
pre_upgrade="${TMP_ROOT_DIR}/usr/share/pre-upgrade/*"
|
||||||
|
|
||||||
mkdir -p ${TMP_BOOT_DIR}
|
mkdir -p ${TMP_BOOT_DIR}
|
||||||
mkdir -p ${TMP_ROOT_DIR}
|
mkdir -p ${TMP_ROOT_DIR}
|
||||||
losetup -o $((boot_info[0] * 512)) ${BOOT_LOOP} ${FW_FILE_EXTR}
|
losetup -o $((boot_info[0] * 512)) ${BOOT_LOOP} ${FW_FILE_EXTR}
|
||||||
losetup -o $((root_info[0] * 512)) ${ROOT_LOOP} ${FW_FILE_EXTR}
|
losetup -o $((root_info[0] * 512)) ${ROOT_LOOP} ${FW_FILE_EXTR}
|
||||||
mount ${BOOT_LOOP} ${TMP_BOOT_DIR}
|
mount ${BOOT_LOOP} ${TMP_BOOT_DIR}
|
||||||
mount ${ROOT_LOOP} ${TMP_ROOT_DIR}
|
mount ${ROOT_LOOP} ${TMP_ROOT_DIR}
|
||||||
|
|
||||||
if [[ -d ${pre_upgrade} ]]; then
|
if [[ -d ${pre_upgrade} ]]; then
|
||||||
for script in ${pre_upgrade}/*.sh; do
|
for script in ${pre_upgrade}/*.sh; do
|
||||||
echo "running pre-upgrade script $(basename ${script})"
|
echo "running pre-upgrade script $(basename ${script})"
|
||||||
if [[ -x ${script} ]] && ! ${script}; then
|
if [[ -x ${script} ]] && ! ${script}; then
|
||||||
# non-zero exit status of pre-upgrade script indicates that
|
# non-zero exit status of pre-upgrade script indicates that
|
||||||
# the upgrade process must not be continued
|
# the upgrade process must not be continued
|
||||||
|
|
||||||
echo "aborted by pre-upgrade script"
|
echo "aborted by pre-upgrade script"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -354,16 +364,20 @@ function run_pre_upgrade() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function do_extract() {
|
function do_extract() {
|
||||||
if ! [[ -f ${FW_FILE_GZ} || -f ${FW_FILE_XZ} ]]; then
|
if ! [[ -f ${FW_FILE_GZ} || -f ${FW_FILE_XZ} ]] || ! [[ -f ${DOWNLOAD_DONE_FILE} ]]; then
|
||||||
echo "firmware file not downloaded" 1>&2
|
echo "firmware file not downloaded" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -f ${EXTRACT_DONE_FILE}
|
||||||
|
rm -f ${FLASH_BOOT_STARTED_FILE}
|
||||||
|
rm -f ${FLASH_BOOT_DONE_FILE}
|
||||||
|
rm -f ${FLASH_REBOOT_STARTED_FILE}
|
||||||
rm -f ${FW_FILE_EXTR}
|
rm -f ${FW_FILE_EXTR}
|
||||||
rm -f ${BOOT_READY_FILE}
|
touch ${EXTRACT_STARTED_FILE}
|
||||||
|
|
||||||
echo "extracting..."
|
echo "extracting..."
|
||||||
|
|
||||||
trap cleanup_on_exit EXIT
|
trap cleanup_on_exit EXIT
|
||||||
|
|
||||||
format="gz"
|
format="gz"
|
||||||
@ -386,7 +400,7 @@ function do_extract() {
|
|||||||
echo "firmware compression format ${format} not supported" 1>&2
|
echo "firmware compression format ${format} not supported" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pid=$!
|
pid=$!
|
||||||
echo ${pid} > ${DECOMPRESS_PID_FILE}
|
echo ${pid} > ${DECOMPRESS_PID_FILE}
|
||||||
wait ${pid}
|
wait ${pid}
|
||||||
@ -395,9 +409,9 @@ function do_extract() {
|
|||||||
cat ${DECOMPRESS_LOG_FILE}
|
cat ${DECOMPRESS_LOG_FILE}
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO verify hash
|
# TODO verify hash
|
||||||
|
|
||||||
boot_info=$(fdisk --bytes -l -o device,start,end,size ${FW_FILE_EXTR} | grep "${FW_FILE_EXTR}1")
|
boot_info=$(fdisk --bytes -l -o device,start,end,size ${FW_FILE_EXTR} | grep "${FW_FILE_EXTR}1")
|
||||||
boot_info=(${boot_info})
|
boot_info=(${boot_info})
|
||||||
boot_start=${boot_info[1]}
|
boot_start=${boot_info[1]}
|
||||||
@ -409,47 +423,31 @@ function do_extract() {
|
|||||||
root_start=${root_info[1]}
|
root_start=${root_info[1]}
|
||||||
root_end=${root_info[2]}
|
root_end=${root_info[2]}
|
||||||
root_size=$((root_info[3] / 512))
|
root_size=$((root_info[3] / 512))
|
||||||
|
|
||||||
echo ${boot_start} ${boot_end} ${boot_size} > ${BOOT_INFO_FILE}
|
echo ${boot_start} ${boot_end} ${boot_size} > ${BOOT_INFO_FILE}
|
||||||
echo ${root_start} ${root_end} ${root_size} > ${ROOT_INFO_FILE}
|
echo ${root_start} ${root_end} ${root_size} > ${ROOT_INFO_FILE}
|
||||||
|
|
||||||
run_pre_upgrade
|
run_pre_upgrade
|
||||||
}
|
|
||||||
|
|
||||||
function extract_status() {
|
touch ${EXTRACT_DONE_FILE}
|
||||||
if [[ -f ${XZCAT_PID_FILE} ]]; then
|
|
||||||
pid=$(cat ${XZCAT_PID_FILE})
|
|
||||||
if kill -0 ${pid} &>/dev/null; then
|
|
||||||
echo "running"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
elif [[ -f ${GUNZIP_PID_FILE} ]]; then
|
|
||||||
pid=$(cat ${GUNZIP_PID_FILE})
|
|
||||||
if kill -0 ${pid} &>/dev/null; then
|
|
||||||
echo "running"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -f ${FW_FILE_EXTR} && -f ${ROOT_INFO_FILE} ]]; then
|
|
||||||
echo "done"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#### flash boot ####
|
#### flash boot ####
|
||||||
|
|
||||||
function do_flash_boot() {
|
function do_flash_boot() {
|
||||||
if [[ ! -f ${FW_FILE_EXTR} ]]; then
|
if ! [[ -f ${FW_FILE_EXTR} ]] || ! [[ -f ${EXTRACT_DONE_FILE} ]]; then
|
||||||
echo "extracted firmware not present"
|
echo "extracted firmware not present"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -f ${FLASH_BOOT_DONE_FILE}
|
||||||
|
rm -f ${FLASH_REBOOT_STARTED_FILE}
|
||||||
|
touch ${FLASH_BOOT_STARTED_FILE}
|
||||||
|
|
||||||
echo "flashing boot..."
|
echo "flashing boot..."
|
||||||
|
|
||||||
trap cleanup_on_exit EXIT
|
trap cleanup_on_exit EXIT
|
||||||
|
|
||||||
rm -f ${BOOT_READY_FILE}
|
|
||||||
|
|
||||||
board=$(cat ${SYS_BOARD_FILE})
|
board=$(cat ${SYS_BOARD_FILE})
|
||||||
boot_info=($(cat ${BOOT_INFO_FILE}))
|
boot_info=($(cat ${BOOT_INFO_FILE}))
|
||||||
@ -461,56 +459,48 @@ function do_flash_boot() {
|
|||||||
mount -o remount,rw /
|
mount -o remount,rw /
|
||||||
mv /sbin/reboot /sbin/reboot.bak
|
mv /sbin/reboot /sbin/reboot.bak
|
||||||
ln -s /bin/true /sbin/reboot
|
ln -s /bin/true /sbin/reboot
|
||||||
|
|
||||||
reallocate_boot_part
|
reallocate_boot_part
|
||||||
|
|
||||||
dd if=${FW_FILE_EXTR} skip=$((boot_info[0] / 2048)) of=${BOOT_DEV} bs=1048576 count=$((boot_info[2] / 2048)) &>${DD_LOG_FILE} &
|
dd if=${FW_FILE_EXTR} \
|
||||||
|
skip=$((boot_info[0] / 2048)) \
|
||||||
|
of=${BOOT_DEV} bs=1048576 \
|
||||||
|
count=$((boot_info[2] / 2048)) &>${DD_LOG_FILE} &
|
||||||
pid=$!
|
pid=$!
|
||||||
echo ${pid} > ${DD_PID_FILE}
|
echo ${pid} > ${DD_PID_FILE}
|
||||||
wait ${pid}
|
wait ${pid}
|
||||||
|
|
||||||
mount -T /etc/fstab.disk -o rw /boot
|
mount -T /etc/fstab.disk -o rw /boot
|
||||||
|
|
||||||
# the /usr/libexec/fw-restore-boot-cfg script, if present, takes the old (backup) boot dir as argument
|
# the /usr/libexec/fw-restore-boot-cfg script, if present, takes the old (backup) boot dir as argument
|
||||||
# and should restore any /boot configuration that needs to be preserved across updates
|
# and should restore any /boot configuration that needs to be preserved across updates
|
||||||
# from the old boot dir to the current (new) /boot dir
|
# from the old boot dir to the current (new) /boot dir
|
||||||
if [[ -x /usr/libexec/fw-restore-boot-cfg ]]; then
|
if [[ -x /usr/libexec/fw-restore-boot-cfg ]]; then
|
||||||
/usr/libexec/fw-restore-boot-cfg ${FW_DIR}/old_boot 2>/dev/null || true
|
/usr/libexec/fw-restore-boot-cfg ${FW_DIR}/old_boot 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
touch ${BOOT_READY_FILE}
|
|
||||||
}
|
|
||||||
|
|
||||||
function flash_boot_status() {
|
touch ${FLASH_BOOT_DONE_FILE}
|
||||||
if [[ -f ${DD_PID_FILE} ]]; then
|
|
||||||
pid=$(cat ${DD_PID_FILE})
|
|
||||||
if kill -0 ${pid} &>/dev/null; then
|
|
||||||
echo "running"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -f ${BOOT_READY_FILE} ]]; then
|
|
||||||
echo "done"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#### flash reboot ####
|
#### flash reboot ####
|
||||||
|
|
||||||
function do_flash_reboot() {
|
function do_flash_reboot() {
|
||||||
if [[ ! -f ${ROOT_INFO_FILE} ]]; then
|
if ! [[ -f ${ROOT_INFO_FILE} ]] || ! [[ -f ${FLASH_BOOT_DONE_FILE} ]]; then
|
||||||
echo "root partition info file not present"
|
echo "root partition info file not present"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
touch ${FLASH_REBOOT_STARTED_FILE}
|
||||||
|
|
||||||
echo "preparing for reboot..."
|
echo "preparing for reboot..."
|
||||||
|
|
||||||
trap cleanup_on_exit EXIT
|
trap cleanup_on_exit EXIT
|
||||||
|
|
||||||
reallocate_root_part
|
reallocate_root_part
|
||||||
|
|
||||||
board=$(cat ${SYS_BOARD_FILE})
|
board=$(cat ${SYS_BOARD_FILE})
|
||||||
|
|
||||||
# the /usr/libexec/fw-prepare-boot script should be present and should
|
# the /usr/libexec/fw-prepare-boot script should be present and should
|
||||||
# make the necessary changes to the current boot configuration so that
|
# make the necessary changes to the current boot configuration so that
|
||||||
# the firmware update initramfs will be used by the next boot
|
# the firmware update initramfs will be used by the next boot
|
||||||
@ -523,46 +513,35 @@ function do_flash_reboot() {
|
|||||||
busybox reboot &
|
busybox reboot &
|
||||||
sleep 10
|
sleep 10
|
||||||
echo b > /proc/sysrq-trigger
|
echo b > /proc/sysrq-trigger
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#### status ####
|
#### status ####
|
||||||
|
|
||||||
function new_version() {
|
|
||||||
cat ${VER_FILE}
|
|
||||||
}
|
|
||||||
|
|
||||||
function show_status() {
|
function show_status() {
|
||||||
status=$(flash_boot_status)
|
if [[ -f ${VER_FILE} ]]; then
|
||||||
if [[ "${status}" == "running" ]]; then
|
new_version=$(cat ${VER_FILE})
|
||||||
echo "flashing boot $(new_version)"
|
|
||||||
return
|
|
||||||
elif [[ "${status}" == "done" ]]; then
|
|
||||||
echo "boot ready $(new_version)"
|
|
||||||
return
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
status=$(extract_status)
|
if [[ -f ${FLASH_REBOOT_STARTED_FILE} ]]; then
|
||||||
if [[ "${status}" == "running" ]]; then
|
echo "rebooting [${new_version}]"
|
||||||
echo "extracting $(new_version)"
|
elif [[ -f ${FLASH_BOOT_DONE_FILE} ]]; then
|
||||||
return
|
echo "boot flashed [${new_version}]"
|
||||||
elif [[ "${status}" == "done" ]]; then
|
elif [[ -f ${FLASH_BOOT_STARTED_FILE} ]]; then
|
||||||
echo "extracted $(new_version)"
|
echo "flashing boot [${new_version}]"
|
||||||
return
|
elif [[ -f ${EXTRACT_DONE_FILE} ]]; then
|
||||||
|
echo "extracted [${new_version}]"
|
||||||
|
elif [[ -f ${EXTRACT_STARTED_FILE} ]]; then
|
||||||
|
echo "extracting [${new_version}]"
|
||||||
|
elif [[ -f ${DOWNLOAD_DONE_FILE} ]]; then
|
||||||
|
echo "downloaded [${new_version}]"
|
||||||
|
elif [[ -f ${DOWNLOAD_STARTED_FILE} ]]; then
|
||||||
|
echo "downloading"
|
||||||
|
else
|
||||||
|
echo "idle"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
status=$(download_status)
|
|
||||||
if [[ "${status}" == "running" ]]; then
|
|
||||||
echo "downloading $(new_version)"
|
|
||||||
return
|
|
||||||
elif [[ -n "${status}" ]]; then
|
|
||||||
echo "downloaded $(new_version)"
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "idle"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -570,16 +549,16 @@ function show_status() {
|
|||||||
|
|
||||||
function do_upgrade() {
|
function do_upgrade() {
|
||||||
echo "upgrading to $1"
|
echo "upgrading to $1"
|
||||||
|
|
||||||
do_download "$1"
|
do_download "$1"
|
||||||
show_status
|
show_status
|
||||||
|
|
||||||
do_extract
|
do_extract
|
||||||
show_status
|
show_status
|
||||||
|
|
||||||
do_flash_boot
|
do_flash_boot
|
||||||
show_status
|
show_status
|
||||||
|
|
||||||
do_flash_reboot
|
do_flash_reboot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
board/odroidxu4/overlay/lib/firmware/s5p-mfc-v8.fw
Normal file
BIN
board/odroidxu4/overlay/lib/firmware/s5p-mfc-v8.fw
Normal file
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
config BR2_PACKAGE_PYTHON_PYHOCON
|
config BR2_PACKAGE_PYTHON_PYHOCON
|
||||||
bool "python-pyhocon"
|
bool "python-pyhocon"
|
||||||
depends on BR2_PACKAGE_PYTHON
|
depends on BR2_PACKAGE_PYTHON || BR2_PACKAGE_PYTHON3
|
||||||
select BR2_PACKAGE_PYTHON_PYPARSING
|
select BR2_PACKAGE_PYTHON_PYPARSING
|
||||||
help
|
help
|
||||||
HOCON parser for Python
|
HOCON parser for Python
|
||||||
|
Loading…
x
Reference in New Issue
Block a user