mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-28 13:46:32 +00:00
Merge remote-tracking branch 'thingos/dev' into dev
This commit is contained in:
commit
8236e43ab8
Binary file not shown.
@ -1,18 +1,20 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
||||||
DISK_TIMEOUT="10"
|
DISK_TIMEOUT=10
|
||||||
|
|
||||||
msg() {
|
msg() {
|
||||||
echo " * $1"
|
echo " * $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sh
|
||||||
|
|
||||||
msg "Mounting pseudo filesystems"
|
msg "Mounting pseudo filesystems"
|
||||||
mount -t devtmpfs devtmpfs /dev
|
mount -t devtmpfs devtmpfs /dev
|
||||||
mount -t proc proc /proc
|
mount -t proc proc /proc
|
||||||
|
|
||||||
ROOT_DEV=$(cat /proc/cmdline | grep -oE 'root=[/a-z0-9]+' | cut -d '=' -f 2)
|
ROOT_DEV=$(cat /proc/cmdline | grep -oE 'root=[/a-z0-9]+' | cut -d '=' -f 2)
|
||||||
if echo ${ROOT_DEV: -2} | grep -E 'p[0-9]' &>/dev/null; then # e.g. /dev/mmcblk0p2
|
if echo ${ROOT_DEV:-2} | grep -E 'p[0-9]' &>/dev/null; then # e.g. /dev/mmcblk0p2
|
||||||
DISK_DEV=${ROOT_DEV:0:$((${#ROOT_DEV}-2))}
|
DISK_DEV=${ROOT_DEV:0:$((${#ROOT_DEV}-2))}
|
||||||
BOOT_DEV=${DISK_DEV}p1
|
BOOT_DEV=${DISK_DEV}p1
|
||||||
DATA_DEV=${DISK_DEV}p3
|
DATA_DEV=${DISK_DEV}p3
|
||||||
@ -28,10 +30,10 @@ while true; do
|
|||||||
if [ ${count} -ge ${DISK_TIMEOUT} ]; then
|
if [ ${count} -ge ${DISK_TIMEOUT} ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
if [ -b ${ROOT_DEV} ]; then
|
if [[ -b ${ROOT_DEV} ]]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
count=$((${count} + 1))
|
count=$((count + 1))
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -41,15 +43,12 @@ msg "Root device is ${ROOT_DEV}"
|
|||||||
msg "Data device is ${DATA_DEV}"
|
msg "Data device is ${DATA_DEV}"
|
||||||
|
|
||||||
FW_DIR=/data/.fwupdate
|
FW_DIR=/data/.fwupdate
|
||||||
FW_FILE=firmware.img.gz
|
FW_FILE=${FW_DIR}/firmware.img.gz
|
||||||
FW_FILE_EXTR=firmware.img
|
FW_FILE_EXTR=${FW_DIR}/firmware.img
|
||||||
|
|
||||||
LEGACY_FW_DIR=/data/.firmware_update
|
ROOT_INFO_FILE=${FW_DIR}/root_info
|
||||||
LEGACY_FW_FILE_EXTR=firmware
|
|
||||||
|
|
||||||
ROOT_INFO_FILE=root_info
|
cleanup_on_exit() {
|
||||||
|
|
||||||
on_exit() {
|
|
||||||
msg "Switching to normal boot"
|
msg "Switching to normal boot"
|
||||||
/remove_initramfs
|
/remove_initramfs
|
||||||
|
|
||||||
@ -66,7 +65,7 @@ on_exit() {
|
|||||||
echo 'b' > /proc/sysrq-trigger
|
echo 'b' > /proc/sysrq-trigger
|
||||||
}
|
}
|
||||||
|
|
||||||
trap on_exit EXIT
|
trap cleanup_on_exit EXIT
|
||||||
|
|
||||||
if [ -x /prepare_initramfs ]; then
|
if [ -x /prepare_initramfs ]; then
|
||||||
msg "Preparing initramfs"
|
msg "Preparing initramfs"
|
||||||
@ -79,35 +78,39 @@ mount ${BOOT_DEV} /boot
|
|||||||
msg "Mounting data partition"
|
msg "Mounting data partition"
|
||||||
mount ${DATA_DEV} /data
|
mount ${DATA_DEV} /data
|
||||||
|
|
||||||
if ! [ -r ${FW_DIR}/${FW_FILE_EXTR} ]; then
|
if ! [[ -r ${FW_FILE_EXTR} ]]; then
|
||||||
if [ -r ${LEGACY_FW_DIR}/${LEGACY_FW_FILE_EXTR} ]; then
|
msg "No firmware found, aborting"
|
||||||
msg "Detected legacy firmware path"
|
exit 1
|
||||||
mkdir -p ${FW_DIR}
|
|
||||||
mv ${LEGACY_FW_DIR}/${LEGACY_FW_FILE_EXTR} ${FW_DIR}/${FW_FILE_EXTR}
|
|
||||||
|
|
||||||
msg "Computing root partition info"
|
|
||||||
root_start=$(fdisk -l ${FW_DIR}/${FW_FILE_EXTR} | grep ${FW_FILE_EXTR}2 | tr -s ' ' | cut -d ' ' -f 4)
|
|
||||||
root_start=$((${root_start} / 2048))
|
|
||||||
root_size=$(fdisk -l ${FW_DIR}/${FW_FILE_EXTR} | grep ${FW_FILE_EXTR}2 | tr -s ' ' | cut -d ' ' -f 6)
|
|
||||||
root_size=$((${root_size} / 2048))
|
|
||||||
|
|
||||||
echo ${root_start} ${root_size} > ${FW_DIR}/${ROOT_INFO_FILE}
|
|
||||||
else
|
|
||||||
msg "No firmware found, aborting"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -r ${FW_DIR}/${ROOT_INFO_FILE} ]; then
|
if ! [[ -r ${ROOT_INFO_FILE} ]]; then
|
||||||
msg "No root partition info, aborting"
|
msg "No root partition info, aborting"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg "Copying root image"
|
msg "Copying root image"
|
||||||
root_start=$(cat ${FW_DIR}/${ROOT_INFO_FILE} | cut -d ' ' -f 1)
|
root_info=$(cat ${ROOT_INFO_FILE})
|
||||||
root_size=$(cat ${FW_DIR}/${ROOT_INFO_FILE} | cut -d ' ' -f 2)
|
count=0
|
||||||
|
|
||||||
dd if=${FW_DIR}/${FW_FILE_EXTR} skip=${root_start} of=${ROOT_DEV} bs=1048576 count=${root_size} || exit 1
|
for i in ${root_info}; do count=$((count + 1)); done
|
||||||
|
|
||||||
|
if [[ ${count} == 3 ]]; then
|
||||||
|
root_start=$(echo ${root_info} | cut -d ' ' -f 1)
|
||||||
|
root_size=$(echo ${root_info} | cut -d ' ' -f 3)
|
||||||
|
root_start=$((root_start / 2048))
|
||||||
|
root_size=$((root_size / 2048))
|
||||||
|
|
||||||
|
elif [[ ${count} == 2 ]]; then
|
||||||
|
# compatibility with old info file format
|
||||||
|
root_start=$(echo ${root_info} | cut -d ' ' -f 1)
|
||||||
|
root_size=$(echo ${root_info} | cut -d ' ' -f 2)
|
||||||
|
|
||||||
|
else
|
||||||
|
msg "Unrecognized root partition info file format"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
dd if=${FW_FILE_EXTR} skip=${root_start} of=${ROOT_DEV} bs=1048576 count=${root_size} || exit 1
|
||||||
|
|
||||||
msg "Cleaning up"
|
msg "Cleaning up"
|
||||||
rm -rf ${FW_DIR}
|
rm -rf ${FW_DIR}
|
||||||
|
@ -35,7 +35,7 @@ start() {
|
|||||||
run_pg_ctl initdb -s -D ${DB_DIR} &>> ${LOG}
|
run_pg_ctl initdb -s -D ${DB_DIR} &>> ${LOG}
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
|
|
||||||
echo "include_if_exists = '/data/etc/postgresql.conf'" >> ${DB_DIR}/postgresql.conf
|
echo "include_if_exists = '${CONF}'" >> ${DB_DIR}/postgresql.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg_begin "Starting postgresql"
|
msg_begin "Starting postgresql"
|
||||||
|
1
board/common/overlay/etc/modprobe.d/boot-modprobe.conf
Symbolic link
1
board/common/overlay/etc/modprobe.d/boot-modprobe.conf
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
/boot/etc/modprobe.conf
|
@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
function exit_usage() {
|
function exit_usage() {
|
||||||
echo "Usage: fwupdate versions [-j] (lists available versions, optionally outputting json)"
|
echo "Usage: fwupdate versions [-j] (lists available versions, optionally outputting json)"
|
||||||
echo " fwupdate current (shows the current version"
|
echo " fwupdate current (shows the current version)"
|
||||||
echo " fwupdate download <version|url|file> (downloads a firmware version)"
|
echo " fwupdate download <version|url|file> (downloads a firmware OS image)"
|
||||||
echo " fwupdate extract (extracts the downloaded firmware archive)"
|
echo " fwupdate extract (extracts the downloaded firmware archive)"
|
||||||
echo " fwupdate flashboot (flashes the boot partition from extracted image)"
|
echo " fwupdate flashboot (flashes the boot partition from extracted image)"
|
||||||
echo " fwupdate flashreboot (prepares for reboot + root partititon flash)"
|
echo " fwupdate flashreboot (prepares for reboot + root partititon flash)"
|
||||||
@ -26,7 +26,7 @@ function exit_usage() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [[ -z "$1" ]]; then
|
||||||
exit_usage
|
exit_usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -40,32 +40,60 @@ SYS_VERSION_FILE=/etc/version
|
|||||||
SYS_BOARD_FILE=/etc/board
|
SYS_BOARD_FILE=/etc/board
|
||||||
OS_CONF_FILE=/etc/init.d/os_conf
|
OS_CONF_FILE=/etc/init.d/os_conf
|
||||||
|
|
||||||
MIN_FREE_DISK=$((500*1024)) # 500 MB
|
MIN_FREE_DISK=500 # MB
|
||||||
VER_FILE=version
|
|
||||||
ROOT_INFO_FILE=root_info
|
|
||||||
BOOT_READY_FILE=boot_flash_ready
|
|
||||||
|
|
||||||
FW_DIR=/data/.fwupdate
|
FW_DIR=/data/.fwupdate
|
||||||
FW_FILE_GZ=firmware.img.gz
|
|
||||||
FW_FILE_XZ=firmware.img.xz
|
|
||||||
FW_FILE_EXTR=firmware.img
|
|
||||||
|
|
||||||
CURL_LOG_FILE=curl.log
|
FW_FILE_GZ=${FW_DIR}/firmware.img.gz
|
||||||
CURL_PID_FILE=curl.pid
|
FW_FILE_XZ=${FW_DIR}/firmware.img.xz
|
||||||
|
FW_FILE_EXTR=${FW_DIR}/firmware.img
|
||||||
|
|
||||||
GUNZIP_LOG_FILE=gunzip.log
|
VER_FILE=${FW_DIR}/version
|
||||||
GUNZIP_PID_FILE=gunzip.pid
|
|
||||||
|
|
||||||
XZCAT_LOG_FILE=xzcat.log
|
BOOT_INFO_FILE=${FW_DIR}/boot_info
|
||||||
XZCAT_PID_FILE=xzcat.pid
|
ROOT_INFO_FILE=${FW_DIR}/root_info
|
||||||
|
BOOT_READY_FILE=${FW_DIR}/boot_flash_ready
|
||||||
|
|
||||||
DD_LOG_FILE=dd.log
|
TMP_BOOT_DIR=/tmp/fwupdate_boot
|
||||||
DD_PID_FILE=dd.pid
|
TMP_ROOT_DIR=/tmp/fwupdate_root
|
||||||
|
|
||||||
|
CURL_LOG_FILE=${FW_DIR}/curl.log
|
||||||
|
CURL_PID_FILE=${FW_DIR}/curl.pid
|
||||||
|
|
||||||
|
GUNZIP_LOG_FILE=${FW_DIR}/gunzip.log
|
||||||
|
GUNZIP_PID_FILE=${FW_DIR}/gunzip.pid
|
||||||
|
|
||||||
|
XZCAT_LOG_FILE=${FW_DIR}/xzcat.log
|
||||||
|
XZCAT_PID_FILE=${FW_DIR}/xzcat.pid
|
||||||
|
|
||||||
|
DD_LOG_FILE=${FW_DIR}/dd.log
|
||||||
|
DD_PID_FILE=${FW_DIR}/dd.pid
|
||||||
|
|
||||||
|
BOOT_LOOP="/dev/loop3"
|
||||||
|
ROOT_LOOP="/dev/loop4"
|
||||||
|
|
||||||
source ${OS_CONF_FILE}
|
source ${OS_CONF_FILE}
|
||||||
source ${SYS_VERSION_FILE}
|
source ${SYS_VERSION_FILE}
|
||||||
|
|
||||||
|
|
||||||
|
#### cleanup on exit ####
|
||||||
|
|
||||||
|
function cleanup_on_exit() {
|
||||||
|
set +e
|
||||||
|
|
||||||
|
if [[ -f /sbin/reboot.bak ]]; then
|
||||||
|
rm -f /sbin/reboot
|
||||||
|
mv /sbin/reboot.bak /sbin/reboot
|
||||||
|
fi
|
||||||
|
|
||||||
|
umount ${TMP_BOOT_DIR} 2>/dev/null
|
||||||
|
umount ${TMP_ROOT_DIR} 2>/dev/null
|
||||||
|
losetup -d ${BOOT_LOOP} 2>/dev/null
|
||||||
|
losetup -d ${ROOT_LOOP} 2>/dev/null
|
||||||
|
|
||||||
|
mount -T /etc/fstab.disk -o ro /boot 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#### disk & partition devices ####
|
#### disk & partition devices ####
|
||||||
|
|
||||||
BOOT_DEV=$(mount | grep /boot | cut -d ' ' -f 1)
|
BOOT_DEV=$(mount | grep /boot | cut -d ' ' -f 1)
|
||||||
@ -81,6 +109,84 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
function reallocate_boot_part() {
|
||||||
|
current_boot_info=$(fdisk --bytes -l -o device,start,end,size ${DISK_DEV} | grep "${BOOT_DEV}")
|
||||||
|
current_boot_info=(${current_boot_info})
|
||||||
|
|
||||||
|
current_root_info=$(fdisk --bytes -l -o device,start,end,size ${DISK_DEV} | grep "${ROOT_DEV}")
|
||||||
|
current_root_info=(${current_root_info})
|
||||||
|
|
||||||
|
boot_info=($(cat ${BOOT_INFO_FILE}))
|
||||||
|
|
||||||
|
if [[ ${current_boot_info[1]} == ${boot_info[0]} ]] &&
|
||||||
|
[[ ${current_boot_info[2]} == ${boot_info[1]} ]]; then
|
||||||
|
|
||||||
|
return # all good
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "reallocating boot partition..."
|
||||||
|
|
||||||
|
# check overlapping with root partition
|
||||||
|
if [[ ${boot_info[1]} -ge ${current_root_info[1]} ]]; then
|
||||||
|
echo "cannot reallocate boot partition: will overlap with root"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
fdisk -w auto ${DISK_DEV} >/dev/null <<END
|
||||||
|
d
|
||||||
|
1
|
||||||
|
n
|
||||||
|
p
|
||||||
|
1
|
||||||
|
${boot_info[0]}
|
||||||
|
${boot_info[1]}
|
||||||
|
t
|
||||||
|
1
|
||||||
|
c
|
||||||
|
w
|
||||||
|
END
|
||||||
|
sync
|
||||||
|
}
|
||||||
|
|
||||||
|
function reallocate_root_part() {
|
||||||
|
current_root_info=$(fdisk --bytes -l -o device,start,end,size ${DISK_DEV} | grep "${ROOT_DEV}")
|
||||||
|
current_root_info=(${current_root_info})
|
||||||
|
|
||||||
|
current_data_info=$(fdisk --bytes -l -o device,start,end,size ${DISK_DEV} | grep "${DATA_DEV}")
|
||||||
|
current_data_info=(${current_data_info})
|
||||||
|
|
||||||
|
root_info=($(cat ${ROOT_INFO_FILE}))
|
||||||
|
|
||||||
|
if [[ ${current_root_info[1]} == ${root_info[0]} ]] &&
|
||||||
|
[[ ${current_root_info[2]} == ${root_info[1]} ]]; then
|
||||||
|
|
||||||
|
return # all good
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "reallocating root partition..."
|
||||||
|
|
||||||
|
# check overlapping with data partition
|
||||||
|
if [[ ${root_info[1]} -ge ${current_data_info[1]} ]]; then
|
||||||
|
echo "cannot reallocate root partition: will overlap with data"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
fdisk -w auto ${DISK_DEV} >/dev/null <<END
|
||||||
|
d
|
||||||
|
2
|
||||||
|
n
|
||||||
|
p
|
||||||
|
2
|
||||||
|
${root_info[0]}
|
||||||
|
${root_info[1]}
|
||||||
|
t
|
||||||
|
2
|
||||||
|
83
|
||||||
|
w
|
||||||
|
END
|
||||||
|
sync
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#### versions ####
|
#### versions ####
|
||||||
|
|
||||||
@ -98,14 +204,14 @@ function show_versions() {
|
|||||||
IFS="|"
|
IFS="|"
|
||||||
varr=(${version})
|
varr=(${version})
|
||||||
IFS=${OIFS}
|
IFS=${OIFS}
|
||||||
if [ "${OS_PRERELEASES}" == "false" ] && [ "${varr[1]}" == "true" ]; then
|
if [[ "${OS_PRERELEASES}" == "false" && "${varr[1]}" == "true" ]]; then
|
||||||
continue # skip prereleases
|
continue # skip prereleases
|
||||||
fi
|
fi
|
||||||
if [ "${board}" != "${varr[2]}" ]; then
|
if [[ "${board}" != "${varr[2]}" ]]; then
|
||||||
continue # skip other boards
|
continue # skip other boards
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${show_json}" == "true" ]; then
|
if [[ "${show_json}" == "true" ]]; then
|
||||||
echo "{\"version\": \"${varr[0]}\"," \
|
echo "{\"version\": \"${varr[0]}\"," \
|
||||||
"\"url\": \"${varr[3]}\"," \
|
"\"url\": \"${varr[3]}\"," \
|
||||||
"\"board\": \"${varr[2]}\"," \
|
"\"board\": \"${varr[2]}\"," \
|
||||||
@ -131,23 +237,23 @@ function do_download() {
|
|||||||
mkdir -p ${FW_DIR}
|
mkdir -p ${FW_DIR}
|
||||||
|
|
||||||
# Look for local file first
|
# Look for local file first
|
||||||
if [ -f "$1" ]; then
|
if [[ -f "$1" ]]; then
|
||||||
version="custom"
|
version="custom"
|
||||||
FNAME=`basename $1`
|
FNAME=`basename $1`
|
||||||
FILEEXT=${FNAME##*.}
|
FILEEXT=${FNAME##*.}
|
||||||
DST_FNAME=""
|
DST_FNAME=""
|
||||||
if [ "${FILEEXT}" == "xz" ]; then
|
if [[ "${FILEEXT}" == "xz" ]]; then
|
||||||
DST_FNAME="${FW_DIR}/${FW_FILE_XZ}"
|
DST_FNAME=${FW_FILE_XZ}
|
||||||
elif [ "${FILEEXT}" == "gz" ]; then
|
elif [[ "${FILEEXT}" == "gz" ]]; then
|
||||||
DST_FNAME="${FW_DIR}/${FW_FILE_GZ}"
|
DST_FNAME=${FW_FILE_GZ}
|
||||||
fi
|
fi
|
||||||
if [ -n "${DST_FNAME}" ]; then
|
if [[ -n "${DST_FNAME}" ]]; then
|
||||||
cp -f $1 ${DST_FNAME}
|
cp -f $1 ${DST_FNAME}
|
||||||
echo ${version} > ${FW_DIR}/${VER_FILE}
|
echo ${version} > ${VER_FILE}
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
board=$(cat ${SYS_BOARD_FILE})
|
board=$(cat ${SYS_BOARD_FILE})
|
||||||
url=$1
|
url=$1
|
||||||
version=$1
|
version=$1
|
||||||
@ -158,51 +264,51 @@ function do_download() {
|
|||||||
version="custom"
|
version="custom"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${url}" ]; then
|
if [[ -z "${url}" ]]; then
|
||||||
echo "no such version" 1>&2
|
echo "no such version" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
free_disk=$(df /data | tail -n 1 | tr -s ' ' | cut -d ' ' -f 4)
|
free_disk=$(df /data | tail -n 1 | tr -s ' ' | cut -d ' ' -f 4)
|
||||||
if [ "${free_disk}" -lt ${MIN_FREE_DISK} ]; then
|
if [[ "${free_disk}" -lt $((MIN_FREE_DISK * 1024)) ]]; then
|
||||||
echo "not enough disk space" 1>&2
|
echo "not enough disk space" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
outfile=${FW_DIR}/${FW_FILE_GZ}
|
outfile=${FW_FILE_GZ}
|
||||||
format=$(echo ${url} | sed -rn 's/.*\.img\.([a-z]+)$/\1/ p')
|
format=$(echo ${url} | sed -rn 's/.*\.img\.([a-z]+)$/\1/ p')
|
||||||
if [ "${format}" == "xz" ]; then
|
if [[ "${format}" == "xz" ]]; then
|
||||||
outfile=${FW_DIR}/${FW_FILE_XZ}
|
outfile=${FW_FILE_XZ}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ${version} > ${FW_DIR}/${VER_FILE}
|
echo ${version} > ${VER_FILE}
|
||||||
|
|
||||||
curl_opts="-S -f -L"
|
curl_opts="-S -f -L"
|
||||||
if [ -n "${OS_FIRMWARE_USERNAME}" ]; then
|
if [[ -n "${OS_FIRMWARE_USERNAME}" ]]; then
|
||||||
curl_opts+=" --user ${OS_FIRMWARE_USERNAME}:${OS_FIRMWARE_PASSWORD}"
|
curl_opts+=" --user ${OS_FIRMWARE_USERNAME}:${OS_FIRMWARE_PASSWORD}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl ${curl_opts} -o ${outfile} "${url}" &> ${FW_DIR}/${CURL_LOG_FILE} &
|
curl ${curl_opts} -o ${outfile} "${url}" &> ${CURL_LOG_FILE} &
|
||||||
pid=$!
|
pid=$!
|
||||||
echo ${pid} > ${FW_DIR}/${CURL_PID_FILE}
|
echo ${pid} > ${CURL_PID_FILE}
|
||||||
wait ${pid}
|
wait ${pid}
|
||||||
|
|
||||||
if [ "$?" != 0 ]; then
|
if [[ "$?" != 0 ]]; then
|
||||||
cat ${FW_DIR}/${CURL_LOG_FILE}
|
cat ${CURL_LOG_FILE}
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function download_status() {
|
function download_status() {
|
||||||
if [ -f ${FW_DIR}/${CURL_PID_FILE} ]; then
|
if [[ -f ${CURL_PID_FILE} ]]; then
|
||||||
pid=$(cat ${FW_DIR}/${CURL_PID_FILE})
|
pid=$(cat ${CURL_PID_FILE})
|
||||||
if kill -0 ${pid} &>/dev/null; then
|
if kill -0 ${pid} &>/dev/null; then
|
||||||
echo "running"
|
echo "running"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f ${FW_DIR}/${FW_FILE_GZ} -o -f ${FW_DIR}/${FW_FILE_XZ} ]; then
|
if [[ -f ${FW_FILE_GZ} || -f ${FW_FILE_XZ} ]]; then
|
||||||
echo "done"
|
echo "done"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -213,14 +319,17 @@ function download_status() {
|
|||||||
function run_pre_upgrade() {
|
function run_pre_upgrade() {
|
||||||
which losetup &>/dev/null || return 0
|
which losetup &>/dev/null || return 0
|
||||||
|
|
||||||
root_start=$(cat ${FW_DIR}/${ROOT_INFO_FILE} | cut -d ' ' -f 1)
|
boot_info=($(cat ${BOOT_INFO_FILE}))
|
||||||
tmp_mnt="/tmp/fwupdate_root"
|
root_info=($(cat ${ROOT_INFO_FILE}))
|
||||||
loop="/dev/loop4"
|
pre_upgrade="${TMP_ROOT_DIR}/usr/share/pre-upgrade/*"
|
||||||
pre_upgrade="${tmp_mnt}/usr/share/pre-upgrade/*"
|
|
||||||
|
mkdir -p ${TMP_BOOT_DIR}
|
||||||
|
mkdir -p ${TMP_ROOT_DIR}
|
||||||
|
losetup -o $((boot_info[0] * 512)) ${BOOT_LOOP} ${FW_FILE_EXTR}
|
||||||
|
losetup -o $((root_info[0] * 512)) ${ROOT_LOOP} ${FW_FILE_EXTR}
|
||||||
|
mount ${BOOT_LOOP} ${TMP_BOOT_DIR}
|
||||||
|
mount ${ROOT_LOOP} ${TMP_ROOT_DIR}
|
||||||
|
|
||||||
mkdir -p ${tmp_mnt}
|
|
||||||
losetup -o $((root_start * 1024 * 1024)) ${loop} ${FW_DIR}/${FW_FILE_EXTR}
|
|
||||||
mount ${loop} ${tmp_mnt}
|
|
||||||
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})"
|
||||||
@ -234,37 +343,41 @@ function run_pre_upgrade() {
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
umount ${tmp_mnt}
|
umount ${TMP_BOOT_DIR}
|
||||||
losetup -d ${loop}
|
umount ${TMP_ROOT_DIR}
|
||||||
|
losetup -d ${BOOT_LOOP}
|
||||||
|
losetup -d ${ROOT_LOOP}
|
||||||
}
|
}
|
||||||
|
|
||||||
function do_extract() {
|
function do_extract() {
|
||||||
echo "extracting..."
|
if ! [[ -f ${FW_FILE_GZ} || -f ${FW_FILE_XZ} ]]; then
|
||||||
|
|
||||||
rm -f ${FW_DIR}/${FW_FILE_EXTR}
|
|
||||||
rm -f ${FW_DIR}/${BOOT_READY_FILE}
|
|
||||||
|
|
||||||
if ! [ -f ${FW_DIR}/${FW_FILE_GZ} -o -f ${FW_DIR}/${FW_FILE_XZ} ]; then
|
|
||||||
echo "firmware file not downloaded" 1>&2
|
echo "firmware file not downloaded" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -f ${FW_FILE_EXTR}
|
||||||
|
rm -f ${BOOT_READY_FILE}
|
||||||
|
|
||||||
|
echo "extracting..."
|
||||||
|
|
||||||
|
trap cleanup_on_exit EXIT
|
||||||
|
|
||||||
format="gz"
|
format="gz"
|
||||||
if [ -f ${FW_DIR}/${FW_FILE_XZ} ]; then
|
if [[ -f ${FW_FILE_XZ} ]]; then
|
||||||
format="xz"
|
format="xz"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f ${FW_DIR}/${FW_FILE_EXTR}
|
rm -f ${FW_FILE_EXTR}
|
||||||
rm -f ${FW_DIR}/${GUNZIP_PID_FILE} ${FW_DIR}/${XZCAT_PID_FILE}
|
rm -f ${GUNZIP_PID_FILE} ${XZCAT_PID_FILE}
|
||||||
|
|
||||||
if [ "${format}" == "xz" ]; then
|
if [[ "${format}" == "xz" ]]; then
|
||||||
DECOMPRESS_LOG_FILE=${FW_DIR}/${XZCAT_LOG_FILE}
|
DECOMPRESS_LOG_FILE=${XZCAT_LOG_FILE}
|
||||||
DECOMPRESS_PID_FILE=${FW_DIR}/${XZCAT_PID_FILE}
|
DECOMPRESS_PID_FILE=${XZCAT_PID_FILE}
|
||||||
xzcat ${FW_DIR}/${FW_FILE_XZ} > ${FW_DIR}/${FW_FILE_EXTR} 2>${FW_DIR}/${XZCAT_LOG_FILE} &
|
xzcat ${FW_FILE_XZ} > ${FW_FILE_EXTR} 2>${XZCAT_LOG_FILE} &
|
||||||
elif [ "${format}" == "gz" ]; then
|
elif [[ "${format}" == "gz" ]]; then
|
||||||
DECOMPRESS_LOG_FILE=${FW_DIR}/${GUNZIP_LOG_FILE}
|
DECOMPRESS_LOG_FILE=${GUNZIP_LOG_FILE}
|
||||||
DECOMPRESS_PID_FILE=${FW_DIR}/${GUNZIP_PID_FILE}
|
DECOMPRESS_PID_FILE=${GUNZIP_PID_FILE}
|
||||||
gunzip -k -c ${FW_DIR}/${FW_FILE_GZ} > ${FW_DIR}/${FW_FILE_EXTR} 2>${FW_DIR}/${GUNZIP_LOG_FILE} &
|
gunzip -k -c ${FW_FILE_GZ} > ${FW_FILE_EXTR} 2>${GUNZIP_LOG_FILE} &
|
||||||
else
|
else
|
||||||
echo "firmware compression format ${format} not supported" 1>&2
|
echo "firmware compression format ${format} not supported" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
@ -274,32 +387,47 @@ function do_extract() {
|
|||||||
echo ${pid} > ${DECOMPRESS_PID_FILE}
|
echo ${pid} > ${DECOMPRESS_PID_FILE}
|
||||||
wait ${pid}
|
wait ${pid}
|
||||||
|
|
||||||
if [ "$?" != 0 ]; then
|
if [[ "$?" != 0 ]]; then
|
||||||
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=(${boot_info})
|
||||||
|
boot_start=${boot_info[1]}
|
||||||
|
boot_end=${boot_info[2]}
|
||||||
|
boot_size=$((boot_info[3] / 512))
|
||||||
|
|
||||||
|
root_info=$(fdisk --bytes -l -o device,start,end,size ${FW_FILE_EXTR} | grep "${FW_FILE_EXTR}2")
|
||||||
|
root_info=(${root_info})
|
||||||
|
root_start=${root_info[1]}
|
||||||
|
root_end=${root_info[2]}
|
||||||
|
root_size=$((root_info[3] / 512))
|
||||||
|
|
||||||
|
echo ${boot_start} ${boot_end} ${boot_size} > ${BOOT_INFO_FILE}
|
||||||
|
echo ${root_start} ${root_end} ${root_size} > ${ROOT_INFO_FILE}
|
||||||
|
|
||||||
run_pre_upgrade
|
run_pre_upgrade
|
||||||
}
|
}
|
||||||
|
|
||||||
function extract_status() {
|
function extract_status() {
|
||||||
if [ -f ${FW_DIR}/${XZCAT_PID_FILE} ]; then
|
if [[ -f ${XZCAT_PID_FILE} ]]; then
|
||||||
pid=$(cat ${FW_DIR}/${XZCAT_PID_FILE})
|
pid=$(cat ${XZCAT_PID_FILE})
|
||||||
if kill -0 ${pid} &>/dev/null; then
|
if kill -0 ${pid} &>/dev/null; then
|
||||||
echo "running"
|
echo "running"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
elif [ -f ${FW_DIR}/${GUNZIP_PID_FILE} ]; then
|
elif [[ -f ${GUNZIP_PID_FILE} ]]; then
|
||||||
pid=$(cat ${FW_DIR}/${GUNZIP_PID_FILE})
|
pid=$(cat ${GUNZIP_PID_FILE})
|
||||||
if kill -0 ${pid} &>/dev/null; then
|
if kill -0 ${pid} &>/dev/null; then
|
||||||
echo "running"
|
echo "running"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f ${FW_DIR}/${FW_FILE_EXTR} ]; then
|
if [[ -f ${FW_FILE_EXTR} && -f ${ROOT_INFO_FILE} ]]; then
|
||||||
echo "done"
|
echo "done"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -307,76 +435,34 @@ function extract_status() {
|
|||||||
|
|
||||||
#### flash boot ####
|
#### flash boot ####
|
||||||
|
|
||||||
function reallocate_boot_part() {
|
function do_flash_boot() {
|
||||||
boot_info=$(fdisk --bytes -l -o device,start,end,size ${DISK_DEV} | grep "${BOOT_DEV}")
|
if [[ ! -f ${FW_FILE_EXTR} ]]; then
|
||||||
boot_info=(${boot_info})
|
echo "extracted firmware not present"
|
||||||
|
|
||||||
root_info=$(fdisk --bytes -l -o device,start,end,size ${DISK_DEV} | grep "${ROOT_DEV}")
|
|
||||||
root_info=(${root_info})
|
|
||||||
|
|
||||||
fw_boot_info=$(fdisk --bytes -l -o device,start,end,size ${FW_DIR}/${FW_FILE_EXTR} | grep "${FW_FILE_EXTR}1")
|
|
||||||
fw_boot_info=(${fw_boot_info})
|
|
||||||
|
|
||||||
if [[ ${boot_info[1]} == ${fw_boot_info[1]} ]] &&
|
|
||||||
[[ ${boot_info[2]} == ${fw_boot_info[2]} ]]; then
|
|
||||||
|
|
||||||
return # all good
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "reallocating boot partition..."
|
|
||||||
|
|
||||||
# check overlapping with root partition
|
|
||||||
if [[ ${fw_boot_info[2]} -ge ${root_info[1]} ]]; then
|
|
||||||
echo "cannot reallocate boot partition: will overlap with root"
|
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fdisk -w auto ${DISK_DEV} >/dev/null <<END
|
|
||||||
d
|
|
||||||
1
|
|
||||||
n
|
|
||||||
p
|
|
||||||
1
|
|
||||||
${fw_boot_info[1]}
|
|
||||||
${fw_boot_info[2]}
|
|
||||||
w
|
|
||||||
END
|
|
||||||
sync
|
|
||||||
}
|
|
||||||
|
|
||||||
function do_flash_boot() {
|
|
||||||
echo "flashing boot..."
|
echo "flashing boot..."
|
||||||
|
|
||||||
rm -f ${FW_DIR}/${BOOT_READY_FILE}
|
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}))
|
||||||
|
|
||||||
cp -r /boot ${FW_DIR}/old_boot
|
cp -r /boot ${FW_DIR}/old_boot
|
||||||
umount /boot
|
umount /boot
|
||||||
trap flash_cleanup EXIT
|
|
||||||
|
|
||||||
# prevent unwanted reboots during upgrade
|
# prevent unwanted reboots during upgrade
|
||||||
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
|
||||||
|
|
||||||
boot_info=$(fdisk --bytes -l -o device,start,end,size ${FW_DIR}/${FW_FILE_EXTR} | grep "${FW_FILE_EXTR}1")
|
|
||||||
boot_info=(${boot_info})
|
|
||||||
boot_start=$((${boot_info[1]} / 2048)) # in MB
|
|
||||||
boot_size=$((${boot_info[3]} / 1048576)) # in MB
|
|
||||||
|
|
||||||
root_info=$(fdisk --bytes -l -o device,start,end,size ${FW_DIR}/${FW_FILE_EXTR} | grep "${FW_FILE_EXTR}2")
|
|
||||||
root_info=(${root_info})
|
|
||||||
root_start=$((${root_info[1]} / 2048)) # in MB
|
|
||||||
root_size=$((${root_info[3]} / 1048576)) # in MB
|
|
||||||
|
|
||||||
echo ${root_start} ${root_size} > ${FW_DIR}/${ROOT_INFO_FILE}
|
|
||||||
|
|
||||||
reallocate_boot_part
|
reallocate_boot_part
|
||||||
|
|
||||||
dd if=${FW_DIR}/${FW_FILE_EXTR} skip=${boot_start} of=${BOOT_DEV} bs=1048576 count=${boot_size} &>${FW_DIR}/${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} > ${FW_DIR}/${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
|
||||||
@ -384,92 +470,48 @@ function do_flash_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 ${FW_DIR}/${BOOT_READY_FILE}
|
touch ${BOOT_READY_FILE}
|
||||||
}
|
}
|
||||||
|
|
||||||
function flash_boot_status() {
|
function flash_boot_status() {
|
||||||
if [ -f ${FW_DIR}/${DD_PID_FILE} ]; then
|
if [[ -f ${DD_PID_FILE} ]]; then
|
||||||
pid=$(cat ${FW_DIR}/${DD_PID_FILE})
|
pid=$(cat ${DD_PID_FILE})
|
||||||
if kill -0 ${pid} &>/dev/null; then
|
if kill -0 ${pid} &>/dev/null; then
|
||||||
echo "running"
|
echo "running"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f ${FW_DIR}/${BOOT_READY_FILE} ]; then
|
if [[ -f ${BOOT_READY_FILE} ]]; then
|
||||||
echo "done"
|
echo "done"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function flash_cleanup() {
|
|
||||||
if [ -f /sbin/reboot.bak ]; then
|
|
||||||
rm -f /sbin/reboot
|
|
||||||
mv /sbin/reboot.bak /sbin/reboot
|
|
||||||
fi
|
|
||||||
|
|
||||||
mount /boot 2>/dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#### flash reboot ####
|
#### flash reboot ####
|
||||||
|
|
||||||
function reallocate_root_part() {
|
|
||||||
root_info=$(fdisk --bytes -l -o device,start,end,size ${DISK_DEV} | grep "${ROOT_DEV}")
|
|
||||||
root_info=(${root_info})
|
|
||||||
|
|
||||||
data_info=$(fdisk --bytes -l -o device,start,end,size ${DISK_DEV} | grep "${DATA_DEV}")
|
|
||||||
data_info=(${data_info})
|
|
||||||
|
|
||||||
fw_root_info=$(fdisk --bytes -l -o device,start,end,size ${FW_DIR}/${FW_FILE_EXTR} | grep "${FW_FILE_EXTR}2")
|
|
||||||
fw_root_info=(${fw_root_info})
|
|
||||||
|
|
||||||
if [[ ${root_info[1]} == ${fw_root_info[1]} ]] &&
|
|
||||||
[[ ${root_info[2]} == ${fw_root_info[2]} ]]; then
|
|
||||||
|
|
||||||
return # all good
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "reallocating root partition..."
|
|
||||||
|
|
||||||
# check overlapping with data partition
|
|
||||||
if [[ ${fw_root_info[2]} -ge ${data_info[1]} ]]; then
|
|
||||||
echo "cannot reallocate root partition: will overlap with data"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
fdisk -w auto ${DISK_DEV} >/dev/null <<END
|
|
||||||
d
|
|
||||||
2
|
|
||||||
n
|
|
||||||
p
|
|
||||||
2
|
|
||||||
${fw_root_info[1]}
|
|
||||||
${fw_root_info[2]}
|
|
||||||
w
|
|
||||||
END
|
|
||||||
sync
|
|
||||||
}
|
|
||||||
|
|
||||||
function do_flash_reboot() {
|
function do_flash_reboot() {
|
||||||
if [[ ! -f ${FW_DIR}/${ROOT_INFO_FILE} ]]; then
|
if [[ ! -f ${ROOT_INFO_FILE} ]]; then
|
||||||
echo "extracted firmware not present"
|
echo "root partition info file not present"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "preparing for reboot..."
|
||||||
|
|
||||||
|
trap cleanup_on_exit EXIT
|
||||||
|
|
||||||
reallocate_root_part
|
reallocate_root_part
|
||||||
|
|
||||||
echo "preparing for reboot..."
|
|
||||||
|
|
||||||
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
|
||||||
mount -o remount,rw /boot
|
mount -o remount,rw /boot
|
||||||
if [ -x /usr/libexec/fw-prepare-boot ]; then
|
if [[ -x /usr/libexec/fw-prepare-boot ]]; then
|
||||||
/usr/libexec/fw-prepare-boot
|
/usr/libexec/fw-prepare-boot
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -485,7 +527,7 @@ function do_flash_reboot() {
|
|||||||
#### status ####
|
#### status ####
|
||||||
|
|
||||||
function new_version() {
|
function new_version() {
|
||||||
cat ${FW_DIR}/${VER_FILE}
|
cat ${VER_FILE}
|
||||||
}
|
}
|
||||||
|
|
||||||
function backup_conf() {
|
function backup_conf() {
|
||||||
@ -495,28 +537,28 @@ function backup_conf() {
|
|||||||
|
|
||||||
function show_status() {
|
function show_status() {
|
||||||
status=$(flash_boot_status)
|
status=$(flash_boot_status)
|
||||||
if [ "${status}" == "running" ]; then
|
if [[ "${status}" == "running" ]]; then
|
||||||
echo "flashing boot $(new_version)"
|
echo "flashing boot $(new_version)"
|
||||||
return
|
return
|
||||||
elif [ "${status}" == "done" ]; then
|
elif [[ "${status}" == "done" ]]; then
|
||||||
echo "boot ready $(new_version)"
|
echo "boot ready $(new_version)"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
status=$(extract_status)
|
status=$(extract_status)
|
||||||
if [ "${status}" == "running" ]; then
|
if [[ "${status}" == "running" ]]; then
|
||||||
echo "extracting $(new_version)"
|
echo "extracting $(new_version)"
|
||||||
return
|
return
|
||||||
elif [ "${status}" == "done" ]; then
|
elif [[ "${status}" == "done" ]]; then
|
||||||
echo "extracted $(new_version)"
|
echo "extracted $(new_version)"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
status=$(download_status)
|
status=$(download_status)
|
||||||
if [ "${status}" == "running" ]; then
|
if [[ "${status}" == "running" ]]; then
|
||||||
echo "downloading $(new_version)"
|
echo "downloading $(new_version)"
|
||||||
return
|
return
|
||||||
elif [ -n "${status}" ]; then
|
elif [[ -n "${status}" ]]; then
|
||||||
echo "downloaded $(new_version)"
|
echo "downloaded $(new_version)"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -557,7 +599,7 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
download)
|
download)
|
||||||
if [ -z "$2" ]; then
|
if [[ -z "$2" ]]; then
|
||||||
exit_usage
|
exit_usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -584,7 +626,7 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
upgrade)
|
upgrade)
|
||||||
if [ -z "$2" ]; then
|
if [[ -z "$2" ]]; then
|
||||||
exit_usage
|
exit_usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cp ${IMG_DIR}/rootfs.cpio.gz ${BOARD_DIR}/fwupdater.gz
|
cp ${IMG_DIR}/rootfs.cpio.gz ${BOARD_DIR}/initrd.gz
|
||||||
|
cp ${IMG_DIR}/rootfs.cpio.gz ${BOARD_DIR}/fwupdater.gz # for compatibility
|
||||||
|
|
||||||
|
Binary file not shown.
BIN
board/raspberrypi/initrd.gz
Normal file
BIN
board/raspberrypi/initrd.gz
Normal file
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo >> /boot/config.txt
|
echo >> /boot/config.txt
|
||||||
echo "initramfs fwupdater.gz" >> /boot/config.txt
|
echo "initramfs initrd.gz" >> /boot/config.txt
|
||||||
|
|
||||||
|
Binary file not shown.
BIN
board/raspberrypi2/initrd.gz
Normal file
BIN
board/raspberrypi2/initrd.gz
Normal file
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo >> /boot/config.txt
|
echo >> /boot/config.txt
|
||||||
echo "initramfs fwupdater.gz" >> /boot/config.txt
|
echo "initramfs initrd.gz" >> /boot/config.txt
|
||||||
|
|
||||||
|
Binary file not shown.
BIN
board/raspberrypi3/initrd.gz
Normal file
BIN
board/raspberrypi3/initrd.gz
Normal file
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo >> /boot/config.txt
|
echo >> /boot/config.txt
|
||||||
echo "initramfs fwupdater.gz" >> /boot/config.txt
|
echo "initramfs initrd.gz" >> /boot/config.txt
|
||||||
|
|
||||||
|
Binary file not shown.
@ -1,14 +1,10 @@
|
|||||||
BR2_arm=y
|
BR2_arm=y
|
||||||
BR2_arm1176jzf_s=y
|
BR2_cortex_a7=y
|
||||||
|
BR2_ARM_FPU_NEON_VFPV4=y
|
||||||
BR2_CCACHE=y
|
BR2_CCACHE=y
|
||||||
BR2_CCACHE_DIR="$(TOPDIR)/.buildroot-ccache-raspberrypi-initramfs"
|
BR2_CCACHE_DIR="$(TOPDIR)/.buildroot-ccache-raspberrypi2-initramfs"
|
||||||
BR2_OPTIMIZE_2=y
|
BR2_OPTIMIZE_2=y
|
||||||
BR2_STATIC_LIBS=y
|
BR2_TOOLCHAIN_EXTERNAL=y
|
||||||
BR2_KERNEL_HEADERS_4_4=y
|
|
||||||
# BR2_UCLIBC_INSTALL_UTILS is not set
|
|
||||||
BR2_BINUTILS_VERSION_2_31_X=y
|
|
||||||
BR2_GCC_VERSION_5_X=y
|
|
||||||
BR2_TOOLCHAIN_BUILDROOT_CXX=y
|
|
||||||
BR2_TARGET_OPTIMIZATION="-pipe"
|
BR2_TARGET_OPTIMIZATION="-pipe"
|
||||||
BR2_TARGET_GENERIC_HOSTNAME=""
|
BR2_TARGET_GENERIC_HOSTNAME=""
|
||||||
BR2_TARGET_GENERIC_ISSUE=""
|
BR2_TARGET_GENERIC_ISSUE=""
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
BR2_arm=y
|
BR2_arm=y
|
||||||
BR2_arm1176jzf_s=y
|
BR2_cortex_a7=y
|
||||||
|
BR2_ARM_FPU_NEON_VFPV4=y
|
||||||
BR2_CCACHE=y
|
BR2_CCACHE=y
|
||||||
BR2_CCACHE_DIR="$(TOPDIR)/.buildroot-ccache-raspberrypi-initramfs"
|
BR2_CCACHE_DIR="$(TOPDIR)/.buildroot-ccache-raspberrypi3-initramfs"
|
||||||
BR2_OPTIMIZE_2=y
|
BR2_OPTIMIZE_2=y
|
||||||
BR2_STATIC_LIBS=y
|
BR2_TOOLCHAIN_EXTERNAL=y
|
||||||
BR2_KERNEL_HEADERS_4_4=y
|
|
||||||
# BR2_UCLIBC_INSTALL_UTILS is not set
|
|
||||||
BR2_BINUTILS_VERSION_2_31_X=y
|
|
||||||
BR2_GCC_VERSION_5_X=y
|
|
||||||
BR2_TOOLCHAIN_BUILDROOT_CXX=y
|
|
||||||
BR2_TARGET_OPTIMIZATION="-pipe"
|
BR2_TARGET_OPTIMIZATION="-pipe"
|
||||||
BR2_TARGET_GENERIC_HOSTNAME=""
|
BR2_TARGET_GENERIC_HOSTNAME=""
|
||||||
BR2_TARGET_GENERIC_ISSUE=""
|
BR2_TARGET_GENERIC_ISSUE=""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user