Skip to content

Commit

Permalink
[ General ] Move bootscript update to nand-sata-install
Browse files Browse the repository at this point in the history
  • Loading branch information
g-provost committed Jan 20, 2019
1 parent 9116aa2 commit c386e19
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
12 changes: 1 addition & 11 deletions lib/makeboarddeb.sh
Expand Up @@ -214,17 +214,7 @@ create_board_package()
echo "Updating bootscript"
# copy new bootscript
cp /usr/share/armbian/$bootscript_dst /boot >/dev/null 2>&1
# build new bootscript
if [ -f /boot/boot.cmd ]; then
mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr >/dev/null 2>&1
elif [ -f /boot/boot.ini ]; then
rootdev=\$(sed -e 's/^.*root=//' -e 's/ .*\$//' < /proc/cmdline)
rootfstype=\$(sed -e 's/^.*rootfstype=//' -e 's/ .*$//' < /proc/cmdline)
sed -i "s/setenv rootfstype.*/setenv rootfstype \\"\$rootfstype\\"/" /boot/boot.ini
sed -i "s/setenv rootdev.*/setenv rootdev \\"\$rootdev\\"/" /boot/boot.ini
fi
cp -f /usr/share/armbian/$bootscript_dst /boot/${$bootscript_dst}.new >/dev/null 2>&1
# cleanup old bootscript backup
[ -f /usr/share/armbian/boot.cmd ] && ls /usr/share/armbian/boot.cmd-* | head -n -5 | xargs rm -f --
Expand Down
17 changes: 17 additions & 0 deletions packages/bsp/common/usr/sbin/nand-sata-install
Expand Up @@ -521,6 +521,21 @@ check_nvme_target()
DISK_ROOT_PART=${NVMeOptions[(2*$NVMeChoices)-1]}
}

# build and update new bootscript
update_bootscript()
{
if [ -f /boot/boot.cmd.new ]; then
mv -f /boot/boot.cmd.new /boot/boot.cmd >/dev/null 2>&1
mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr >/dev/null 2>&1
elif [ -f /boot/boot.ini.new ]; then
mv -f /boot/boot.ini.new /boot/boot.ini >/dev/null 2>&1
rootdev=\$(sed -e 's/^.*root=//' -e 's/ .*\$//' < /proc/cmdline)
rootfstype=\$(sed -e 's/^.*rootfstype=//' -e 's/ .*$//' < /proc/cmdline)
sed -i "s/setenv rootfstype.*/setenv rootfstype \\"\$rootfstype\\"/" /boot/boot.ini
sed -i "s/setenv rootdev.*/setenv rootdev \\"\$rootdev\\"/" /boot/boot.ini
fi
}

# show warning [TEXT]
show_warning()
{
Expand Down Expand Up @@ -646,6 +661,7 @@ main()
5)
show_warning "This script will update the bootloader on SD/eMMC. Continue?"
write_uboot_platform $DIR ${root_partition_device}
update_bootscript
dialog --backtitle "$backtitle" --title "Writing bootloader" --msgbox "\n Done." 7 30
return
;;
Expand All @@ -664,6 +680,7 @@ main()
MTD_BLK="/dev/${spicheck}"
show_warning "This script will update the bootloader on SPI Flash $MTD_BLK. Continue?"
write_uboot_platform_mtd $DIR $MTD_BLK
update_bootscript
echo "Done"
return
;;
Expand Down

0 comments on commit c386e19

Please sign in to comment.