diff --git a/builds/powerpc/installer/legacy/builds/.gitignore b/builds/powerpc/installer/legacy/builds/.gitignore index fbd18542..2f1850fe 100644 --- a/builds/powerpc/installer/legacy/builds/.gitignore +++ b/builds/powerpc/installer/legacy/builds/.gitignore @@ -1 +1,2 @@ *INSTALLER +fit-install* diff --git a/builds/powerpc/installer/legacy/builds/Makefile b/builds/powerpc/installer/legacy/builds/Makefile index 6c0f9f92..2302ee8a 100644 --- a/builds/powerpc/installer/legacy/builds/Makefile +++ b/builds/powerpc/installer/legacy/builds/Makefile @@ -1,37 +1,2 @@ include $(ONL)/make/config.powerpc.mk - -# Hardcoded to match ONL File naming conventions. -include $(ONL)/make/version-onl.mk -INSTALLER_NAME=$(FNAME_PRODUCT_VERSION)_ONL-OS_$(FNAME_BUILD_ID)_$(UARCH)_INSTALLER - -FIT_IMAGE_ALL := $(shell $(ONLPM) --find-file onl-loader-fit:powerpc onl-loader-fit.itb) - -# Fixme -- should come from the FIT manifest, not the initrd manifest -PLATFORMS := $(shell $(ONLPM) --platform-manifest onl-loader-initrd:powerpc) - -MKSHAR = $(ONL)/tools/mkshar -MKSHAR_OPTS = --lazy --unzip-pad -MKSHAR_PERMS = autoperms.sh - -__installer: - $(ONL_V_at)rm -rf *INSTALLER* *.md5sum - $(ONL_V_at)cp $(FIT_IMAGE_ALL) . - $(foreach p,$(PLATFORMS), $(ONLPM) --extract-dir onl-platform-config-$(p):powerpc .;) - # Fixme -ifndef NO_SWI - $(ONLPM) --extract-dir onl-swi:powerpc . - mv ./usr/share/onl/packages/powerpc/onl-swi/*.swi . -endif - rm -rf ./usr - $(ONL_V_at)cp /dev/null $(MKSHAR_PERMS) - $(ONL_V_at) cp $(ONL)/make/version-onl.sh . - $(ONL_V_at)echo "#!/bin/sh" >> $(MKSHAR_PERMS) - $(ONL_V_at)echo "set -e" >> $(MKSHAR_PERMS) - $(ONL_V_at)echo "set -x" >> $(MKSHAR_PERMS) - $(MKSHAR) $(MKSHAR_OPTS) "$(INSTALLER_NAME)" $(ONL)/tools/scripts/sfx.sh.in ppc-installer.sh ppc-install-lib *.itb lib *.swi version-onl.sh boot-config - $(ONL_V_at)rm -rf ./lib *.swi version-onl.sh autoperms.sh *.itb - md5sum "$(INSTALLER_NAME)" | awk '{ print $$1 }' > "$(INSTALLER_NAME).md5sum" - - -shar installer: __installer - +include $(ONL)/builds/any/installer/legacy/fit/builds/Makefile diff --git a/builds/powerpc/installer/legacy/builds/ppc-install-lib b/builds/powerpc/installer/legacy/builds/ppc-install-lib deleted file mode 100644 index 504cc0bc..00000000 --- a/builds/powerpc/installer/legacy/builds/ppc-install-lib +++ /dev/null @@ -1,357 +0,0 @@ -###################################################################### -# -# lib.sh -# -# Common files for install/recovery -# -###################################################################### - -############################################################ -# -# Installation Utility Functions -# -############################################################ - -case "`/usr/sbin/fw_setenv --help 2>&1`" in - *"-f"*"Force update"*) - fw_setenv_dash_f="-f" - ;; -esac - -fw_setenv_f_s() { - local f - f=$1; shift - - /usr/sbin/fw_setenv ${fw_setenv_dash_f} -s "$f" -} - -############################################################ -# -# installer_create_device_file -# The block device name -# The partition number. -# -# Set the global variable 'installer_df' with the name of -# the created device file. -# -# We can't always rely on the existance of a partition's -# device file after the device has been formatted. -# -# This function creates the appropriate device file -# for a given block partition to avoid this problem. -# -# - -installer_create_device_file() { - local blockdev=$1 - local partno=$2 - - # Determine the device major number for the given block device: - local major=`ls -l /dev/${blockdev} | tr "," " " | awk '{print $5}'` - - # Create a new device file matching the given partition - installer_df=$(mktemp) - rm ${installer_df} - mknod "${installer_df}" b "${major}" "${partno}" -} - -############################################################ -# -# installer_partition_cp -# -# The block device name -# The partition number -# The local source filename -# The destination filename -# -# Copy the source file to the given partition. -# The partition must be formatted/mountable. -# -############################################################ - -installer_partition_cp() { - local blockdev=$1 - local partno=$2 - local src=$3 - local dst=$4 - - installer_create_device_file ${blockdev} ${partno} - mkdir -p "${installer_df}.mount" - mount "${installer_df}" "${installer_df}.mount" - cp "${src}" "${installer_df}.mount/${dst}" - umount "${installer_df}.mount" - rm "${installer_df}" - rmdir "${installer_df}.mount" -} - - -############################################################ -# -# installer_partition_dd -# -# The block device name -# The partition number. -# The source file. -# -# 'dd' the contents of the src file directly to the given partition. -# -############################################################ - -installer_partition_dd() { - local blockdev=$1 - local partno=$2 - local src=$3 - - # installer_partition_dd - installer_create_device_file ${blockdev} ${partno} - dd if=${src} of="${installer_df}" bs=1024 - rm "${installer_df}" -} - -############################################################ -# -# installer_partition_format -# -# The block device name. -# The partition number. -# The formatting tool. -# -############################################################ - -installer_partition_format() { - local blockdev=$1 - local partno=$2 - local mkfs=$3 - local partition="$1$2" - - installer_say "Format ${partition}..." - installer_create_device_file ${blockdev} ${partno} - "${mkfs}" "${installer_df}" - installer_say "Format ${partition} complete." - rm "${installer_df}" -} - -############################################################ -# -# installer_umount_blockdev -# -# The block device name. -# -# Unmount all partitions of the given blockdevice. -# -# Required to avoid errors when repartitioning block -# devices that are currently mounted. -# -############################################################ - -installer_umount_blockdev() { - local blockdev=$1 - local mounts=`cat /proc/mounts | grep ${blockdev} | awk '{print $2}'` - if [ "$mounts" ]; then - umount $mounts || : - fi -} - - -############################################################ -# -# 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. -# -############################################################ - -installer_blockdev_format() { - local blockdev=$1 - local partition1size=$2 - local partition2size=$3 - local partition3size=$4 - - 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_platform_loader -# -# The block device name. -# The partition number. -# -# Install the platform loader to the given partition. -# -# The default is to copy the loader to the partition's filesystem. -# If 'platform_loader_raw' is specified by the platform, the -# loader will be written directly to the partition instead. -# -############################################################ -installer_platform_loader() { - local blockdev=$1 - local partno=$2 - - - if [ -f "${installer_dir}/${installer_platform}.itb" ]; then - # - # Platform-specfic FIT Image already provided. - # - local loader="${installer_dir}/${installer_platform}.itb" - - elif [ -f "${installer_dir}/onl-loader-fit.itb" ]; then - # - # Common FIT image. - # - local loader="${installer_dir}/onl-loader-fit.itb"; - else - installer_say "There is not FIT image available in the installer. This is a bug." - exit 1 - fi - - # - # Cannonical name for all ITB files for each platform - # is .itb. - # - # This allows you to use the ONL platform configuration settings - # with your own initrd with constant and consistent naming. - # - loaderdst="${installer_platform}.itb" - - installer_say "Installing the Open Network Linux Loader..." - - if [ "${platform_loader_raw}" ]; then - installer_partition_dd ${blockdev} ${partno} ${loader} - else - installer_partition_cp ${blockdev} ${partno} ${loader} ${loaderdst} - fi -} - -############################################################ -# -# installer_platform_bootconfig -# -# The block device name. -# The partition number. -# -# Generate and write the platform boot-config file -# into the given partition. -# -############################################################ - -installer_platform_bootconfig() { - local blockdev=$1 - local partno=$2 - - # - # Is there a static boot-config in the installer package? - # - if [ -f "${installer_dir}/boot-config" ]; then - installer_say "Writing boot-config." - installer_partition_cp ${blockdev} ${partno} "${installer_dir}/boot-config" - fi - - # - # Unless the installer contains a boot-config - # file it will have to be generated by the first-boot - # script in the Loader. - # - -} - -############################################################ -# -# installer_platform_swi -# -# The block device name. -# The partition number. -# -# Install the SWI to the given partition. -# -############################################################ - -installer_platform_swi() { - local blockdev=$1 - local partno=$2 - - SWISRC=`ls ${installer_dir}/*.swi` - - if [ -f "${SWISRC}" ]; then - if [ ! ${SWIDST} ]; then - SWIDST="$(basename ${SWISRC})" - fi - installer_say "Installing Open Network Linux Software Image (${SWIDST})..." - installer_partition_cp ${blockdev} ${partno} ${SWISRC} ${SWIDST} - else - installer_say "No Open Network Linux Software Image available for installation. Post-install ZTN installation will be required." - fi -} - -############################################################ -# -# installer_standard_blockdev_install -# -# The block device name. -# The size of the loader partition. -# The size of the /mnt/flash partition. -# The size of the /mnt/flash2 partition. -# -# Performs a standard installation for the platform. -# Most platform installers will just call this function with the appropriate arguments. -# -############################################################ -installer_standard_blockdev_install () { - local blockdev=$1 - local p1size=$2 - local p2size=$3 - local p3size=$4 - - # Standard 3-partition format for loader, /mnt/flash, and /mnt/flash2 - installer_blockdev_format "${blockdev}" "${p1size}" "${p2size}" "${p3size}" - - # Copy the platform loader to the first partition. - installer_platform_loader "${blockdev}" 1 - - # Set the boot-config file - installer_platform_bootconfig "${blockdev}" 2 - - # Copy the packaged SWI to the third partition. - installer_platform_swi "${blockdev}" 3 - - sync - installer_umount_blockdev "${blockdev}" -} - -############################################################ -# -# installer_standard_blockdev_install -# -# The block device name. -# -# Performs a standard recovery for the platform. -# -############################################################ -installer_standard_blockdev_recovery() { - local blockdev=$1 - - # Standard 3-partition format for loader, /mnt/flash, and /mnt/flash2 - installer_umount_blockdev ${blockdev} - installer_say "Re-formatting ${blockdev}." - installer_partition_format ${blockdev} 2 mkdosfs - installer_partition_format ${blockdev} 3 mkdosfs - - sync - installer_umount_blockdev "${blockdev}" -} - -############################## -# -# End of lib.sh -# -############################## diff --git a/builds/powerpc/installer/legacy/builds/ppc-installer.sh b/builds/powerpc/installer/legacy/builds/ppc-installer.sh deleted file mode 100644 index 2407b0fa..00000000 --- a/builds/powerpc/installer/legacy/builds/ppc-installer.sh +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/sh - -IARCH="ppc" -ARCH=`uname -m` -if [ "$ARCH" != "$IARCH" ]; then - echo - echo "------------------------------------" - echo "Installer Architecture: $IARCH" - echo "Target Architecture: $ARCH" - echo - echo "This installer cannot be used on this" - echo "target." - echo - echo "------------------------------------" - sleep 5 - exit 1 -fi - -set -e -cd $(dirname $0) - - -installer_script=${0##*/} -installer_zip=$1 - -if [ -f /etc/machine.conf ]; then - . /etc/machine.conf - - # Running under ONIE, most likely in the background in installer mode. - # Our messages have to be sent to the console directly, not to stdout. - installer_say() { - echo "$@" > /dev/console - } - # Installation failure message. - trap 'installer_say "Install failed.; cat /var/log/onie.log > /dev/console; installer_say "Install failed. See log messages above for details"; sleep 3; reboot' EXIT - - if [ -z "${installer_platform}" ]; then - # Our platform identifiers are equal to the ONIE platform identifiers without underscores: - installer_platform=`echo ${onie_platform} | tr "_" "-"` - installer_arch=${onie_arch} - fi -fi - -# -# Remount tmpfs larger if possible. -# We will be doing all of our work out of /tmp -# -mount -o remount,size=1024M /tmp || true - - -# Unpack our distribution -installer_say "Unpacking Open Network Linux installer files..." -installer_dir=`pwd` -if test "$SFX_PAD"; then - # ha ha, busybox cannot exclude multiple files - unzip $installer_zip -x $SFX_PAD -elif test "$SFX_UNZIP"; then - unzip $installer_zip -x $installer_script -else - dd if=$installer_zip bs=$SFX_BLOCKSIZE skip=$SFX_BLOCKS \ - | unzip - -x $installer_script -fi - - -if [ -f "${installer_dir}/versions.sh" ]; then - . "${installer_dir}/versions.sh" - installer_say "${VERSION_STRING} Installer" -fi - -installer_say "Detected platform: ${installer_platform}" - -. "${installer_dir}/ppc-install-lib" - -# Look for the platform installer directory. -installer_platform_dir="${installer_dir}/lib/platform-config/${installer_platform}" -if [ -d "${installer_platform_dir}" ]; then - # Source the installer scriptlet - ONL_PLATFORM=${installer_platform} - . "${installer_platform_dir}/onl/install/${installer_platform}.sh" -else - installer_say "This installer does not support the ${installer_platform} platform." - installer_say "Available platforms are:" - list=`ls ${installer_dir}/lib/platform-config` - installer_say "${list}" - installer_say "Installation cannot continue." - exit 1 -fi - -# The platform script must provide this function. This performs the actual install for the platform. -platform_installer - -installer_say "Configuring system to boot Open Network Linux..." -envf=/tmp/.env -cp /dev/null "${envf}" -echo "nos_bootcmd ${platform_bootcmd}" >> "${envf}" -fw_setenv_f_s "${envf}" -installer_say "Install finished. Rebooting to Open Network Linux." -sleep 3 -reboot -exit - -# Do not add any additional whitespace after this point. -PAYLOAD_FOLLOWS