mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
40 lines
1.1 KiB
Bash
40 lines
1.1 KiB
Bash
# check_loop_device <device_node>
|
|
#
|
|
check_loop_device() {
|
|
|
|
local device=$1
|
|
if [[ ! -b $device ]]; then
|
|
if [[ $CONTAINER_COMPAT == yes && -b /tmp/$device ]]; then
|
|
display_alert "Creating device node" "$device"
|
|
mknod -m0660 "${device}" b "0x$(stat -c '%t' "/tmp/$device")" "0x$(stat -c '%T' "/tmp/$device")"
|
|
else
|
|
exit_with_error "Device node $device does not exist"
|
|
fi
|
|
fi
|
|
|
|
}
|
|
|
|
# write_uboot <loopdev>
|
|
#
|
|
write_uboot() {
|
|
|
|
local loop=$1 revision
|
|
display_alert "Writing U-boot bootloader" "$loop" "info"
|
|
TEMP_DIR=$(mktemp -d || exit 1)
|
|
chmod 700 ${TEMP_DIR}
|
|
revision=${REVISION}
|
|
if [[ -n $UPSTREM_VER ]]; then
|
|
revision=${UPSTREM_VER}
|
|
dpkg -x "${DEB_STORAGE}/linux-u-boot-${BOARD}-${BRANCH}_${revision}_${ARCH}.deb" ${TEMP_DIR}/
|
|
else
|
|
dpkg -x "${DEB_STORAGE}/${CHOSEN_UBOOT}_${revision}_${ARCH}.deb" ${TEMP_DIR}/
|
|
fi
|
|
|
|
# source platform install to read $DIR
|
|
source ${TEMP_DIR}/usr/lib/u-boot/platform_install.sh
|
|
write_uboot_platform "${TEMP_DIR}${DIR}" "$loop"
|
|
[[ $? -ne 0 ]] && exit_with_error "U-boot bootloader failed to install" "@host"
|
|
rm -rf ${TEMP_DIR}
|
|
|
|
}
|