diff --git a/builds/amd64/installer/legacy/builds/amd64-installer.sh b/builds/amd64/installer/legacy/builds/amd64-installer.sh index dab1a445..86accc8f 100644 --- a/builds/amd64/installer/legacy/builds/amd64-installer.sh +++ b/builds/amd64/installer/legacy/builds/amd64-installer.sh @@ -197,6 +197,25 @@ partition_gpt() start=$1; shift + ############################################################ + # + # ONL Boot Partition. + # + ############################################################ + installer_say "Creating 128MB for ONL Boot partition..." + end=$(( $start + 128 )) + + parted -s $DEV unit mb mkpart "ONL-BOOT" ext4 ${start} ${end} || return 1 + if ! part=$(get_part_number $DEV "ONL-BOOT"); then + return 1 + fi + + parted -s $DEV set $part boot on || return 1 + mkfs.ext4 -L "ONL-BOOT" ${DEV}${part} + start=$(( $end + 1 )) + + + ############################################################ # # ONL Configuration Partition. @@ -216,29 +235,10 @@ partition_gpt() rm -rf $ONL_CONFIG_MOUNTPOINT mkdir -p $ONL_CONFIG_MOUNTPOINT mount $DEV$part $ONL_CONFIG_MOUNTPOINT - tar -C $ONL_CONFIG_MOUNTPOINT -xvzf $SL_DATA_TARBALL + tar -C $ONL_CONFIG_MOUNTPOINT -xvzf $ONL_CONFIG_TARBALL umount $ONL_CONFIG_MOUNTPOINT fi - - ############################################################ - # - # ONL Boot Partition. - # - ############################################################ - installer_say "Creating 128MB for ONL Boot partition..." - end=$(( $start + 128 )) - - parted -s $DEV unit mb mkpart "ONL-BOOT" ext4 ${start} ${end} || return 1 - if ! part=$(get_part_number $DEV "ONL-BOOT"); then - return 1 - fi - - parted -s $DEV set $part boot on || return 1 - mkfs.ext4 -L "ONL-BOOT" ${DEV}${part} - start=$(( $end + 1 )) - - ############################################################ # # ONL Image Partition. diff --git a/builds/amd64/installer/legacy/builds/boot-config b/builds/amd64/installer/legacy/builds/boot-config index dfefb733..40fb0d31 100644 --- a/builds/amd64/installer/legacy/builds/boot-config +++ b/builds/amd64/installer/legacy/builds/boot-config @@ -1,4 +1,4 @@ NETDEV=ma1 NETAUTO=dhcp BOOTMODE=SWI -SWI=flash2::latest +SWI=images::latest diff --git a/builds/any/installer/legacy/fit/builds/boot-config b/builds/any/installer/legacy/fit/builds/boot-config index dfefb733..40fb0d31 100644 --- a/builds/any/installer/legacy/fit/builds/boot-config +++ b/builds/any/installer/legacy/fit/builds/boot-config @@ -1,4 +1,4 @@ NETDEV=ma1 NETAUTO=dhcp BOOTMODE=SWI -SWI=flash2::latest +SWI=images::latest diff --git a/builds/any/installer/legacy/fit/builds/fit-install-lib b/builds/any/installer/legacy/fit/builds/fit-install-lib index 504cc0bc..11c89540 100644 --- a/builds/any/installer/legacy/fit/builds/fit-install-lib +++ b/builds/any/installer/legacy/fit/builds/fit-install-lib @@ -1,3 +1,4 @@ +# -*- sh -*- ###################################################################### # # lib.sh @@ -122,11 +123,12 @@ installer_partition_format() { local blockdev=$1 local partno=$2 local mkfs=$3 + local options=$4 local partition="$1$2" installer_say "Format ${partition}..." installer_create_device_file ${blockdev} ${partno} - "${mkfs}" "${installer_df}" + "${mkfs}" ${options} "${installer_df}" installer_say "Format ${partition} complete." rm "${installer_df}" } @@ -158,26 +160,60 @@ installer_umount_blockdev() { # installer_blockdev_format # # The block device name. -# The size of the first partition. -# The size of the second partition. -# [Optional] The size of the third partition. -# If p3size is unset, the remainder of the device will be used -# for the third partition. +# The size of the boot partition. +# The size of the config partition. +# The size of the image partition. +# [Optional] The size of the data partition. +# If p4size is unset, the remainder of the device will be used +# for the data partition. # ############################################################ +ONL_CONFIG_TARBALL=/tmp/onl_config.tgz +ONL_CONFIG_MOUNTPOINT=/mnt/onl_config_partition installer_blockdev_format() { local blockdev=$1 local partition1size=$2 local partition2size=$3 local partition3size=$4 + local partition4size=$5 + + onl_config_partition=$(blkid | grep ONL-CONFIG | awk '{print $1}' | tr -d ':') + + # + # If an ONL-CONFIG partition exists, we need to save and restore its contents. + # + if [ -n "$onl_config_partition" ]; then + installer_say "Preserving the contents of the existing ONL-CONFIG partition..." + rm -rf $ONL_CONFIG_MOUNTPOINT + mkdir -p $ONL_CONFIG_MOUNTPOINT + echo mount "$onl_config_partition" $ONL_CONFIG_MOUNTPOINT + mount "$onl_config_partition" $ONL_CONFIG_MOUNTPOINT + tar -C $ONL_CONFIG_MOUNTPOINT -cvzf $ONL_CONFIG_TARBALL . + umount $ONL_CONFIG_MOUNTPOINT + fi + + installer_umount_blockdev ${blockdev} - installer_say "Formatting ${blockdev} as ${partition1size}:${partition2size}:${partition3size}." - echo -e "o\nn\np\n1\n\n+${partition1size}\nn\np\n2\n\n+${partition2size}\nn\np\n3\n\n${partition3size}\np\nw\n" | fdisk /dev/${blockdev} - installer_partition_format ${blockdev} 1 mkdosfs - installer_partition_format ${blockdev} 2 mkdosfs - installer_partition_format ${blockdev} 3 mkdosfs + installer_say "Formatting ${blockdev} as ${partition1size}:${partition2size}:${partition3size}:${partition4size}." + echo -e "o\nn\np\n1\n\n+${partition1size}\nn\np\n2\n\n+${partition2size}\nn\np\n3\n\n+${partition3size}\nn\np\n4\n\n${partition4size}\np\nw\n" | fdisk /dev/${blockdev} + installer_partition_format ${blockdev} 1 mkfs.ext2 "-L ONL-BOOT" + installer_partition_format ${blockdev} 2 mkfs.ext2 "-L ONL-CONFIG" + installer_partition_format ${blockdev} 3 mkfs.ext2 "-L ONL-IMAGES" + installer_partition_format ${blockdev} 4 mkfs.ext2 "-L ONL-DATA" + + if [ -f $ONL_CONFIG_TARBALL ]; then + installer_say "Restoring the contents of the existing ONL-CONFIG partition..." + installer_create_device_file ${blockdev} 2 + mkdir -p "${installer_df}.mount" + mount "${installer_df}" "${installer_df}.mount" + tar -C "${installer_df}.mount" -xvzf $ONL_CONFIG_TARBALL + umount "${installer_df}.mount" + rm "${installer_df}" + rmdir "${installer_df}.mount" + rm $ONL_CONFIG_TARBALL + fi } ############################################################ @@ -311,15 +347,16 @@ installer_standard_blockdev_install () { local p1size=$2 local p2size=$3 local p3size=$4 + local p4size=$5 # Standard 3-partition format for loader, /mnt/flash, and /mnt/flash2 - installer_blockdev_format "${blockdev}" "${p1size}" "${p2size}" "${p3size}" + installer_blockdev_format "${blockdev}" "${p1size}" "${p2size}" "${p3size}" "${p4size}" # Copy the platform loader to the first partition. installer_platform_loader "${blockdev}" 1 # Set the boot-config file - installer_platform_bootconfig "${blockdev}" 2 + installer_platform_bootconfig "${blockdev}" 1 # Copy the packaged SWI to the third partition. installer_platform_swi "${blockdev}" 3 diff --git a/builds/any/installer/legacy/fit/builds/fit-installer.sh b/builds/any/installer/legacy/fit/builds/fit-installer.sh index eedf721c..fa1f31c8 100644 --- a/builds/any/installer/legacy/fit/builds/fit-installer.sh +++ b/builds/any/installer/legacy/fit/builds/fit-installer.sh @@ -110,7 +110,7 @@ fw_setenv_f_s "${envf}" installer_say "Install finished. Rebooting to Open Network Linux." sleep 3 reboot -exit +exit 0 # Do not add any additional whitespace after this point. PAYLOAD_FOLLOWS