Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "[arm] Refactor installer and build to allow arm builds targeted at grub platforms" #11599

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions Makefile.work
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@ ifeq ($(PLATFORM_ARCH),)
override PLATFORM_ARCH = $(CONFIGURED_ARCH)
endif

ifeq ($(CONFIGURED_ARCH),amd64)
TARGET_BOOTLOADER = grub
else
TARGET_BOOTLOADER = uboot
endif

ifeq ($(BLDENV), bullseye)
SLAVE_DIR = sonic-slave-bullseye
else ifeq ($(BLDENV), buster)
Expand Down
18 changes: 6 additions & 12 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ if [[ -d $FILESYSTEM_ROOT ]]; then
fi
mkdir -p $FILESYSTEM_ROOT
mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR
mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR/grub
mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64-grub
touch $FILESYSTEM_ROOT/$PLATFORM_DIR/firsttime

## ensure proc is mounted
Expand Down Expand Up @@ -166,7 +166,7 @@ if [ "$SONIC_ENABLE_SECUREBOOT_SIGNATURE" = "y" ]; then
fi

echo '[INFO] Signing SONiC linux kernel image'
K=$FILESYSTEM_ROOT/boot/vmlinuz-${LINUX_KERNEL_VERSION}-${CONFIGURED_ARCH}
K=$FILESYSTEM_ROOT/boot/vmlinuz-${LINUX_KERNEL_VERSION}-amd64
sbsign --key $SIGNING_KEY --cert $SIGNING_CERT --output /tmp/${K##*/} ${K}
sudo cp -f /tmp/${K##*/} ${K}
fi
Expand Down Expand Up @@ -396,17 +396,11 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in
systemd-sysv \
ntp

if [[ $TARGET_BOOTLOADER == grub ]]; then
if [[ $CONFIGURED_ARCH == amd64 ]]; then
GRUB_PKG=grub-pc-bin
elif [[ $CONFIGURED_ARCH == arm64 ]]; then
GRUB_PKG=grub-efi-arm64-bin
fi

if [[ $CONFIGURED_ARCH == amd64 ]]; then
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \
$GRUB_PKG
grub-pc-bin

sudo mv $FILESYSTEM_ROOT/grub*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/grub
sudo mv $FILESYSTEM_ROOT/grub-pc-bin*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64-grub
fi

## Disable kexec supported reboot which was installed by default
Expand Down Expand Up @@ -582,7 +576,7 @@ fi
## Update initramfs
sudo chroot $FILESYSTEM_ROOT update-initramfs -u
## Convert initrd image to u-boot format
if [[ $TARGET_BOOTLOADER == uboot ]]; then
if [[ $CONFIGURED_ARCH == armhf || $CONFIGURED_ARCH == arm64 ]]; then
INITRD_FILE=initrd.img-${LINUX_KERNEL_VERSION}-${CONFIGURED_ARCH}
if [[ $CONFIGURED_ARCH == armhf ]]; then
INITRD_FILE=initrd.img-${LINUX_KERNEL_VERSION}-armmp
Expand Down
8 changes: 4 additions & 4 deletions build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ generate_onie_installer_image()

## Generate an ONIE installer image
## Note: Don't leave blank between lines. It is single line command.
./onie-mk-demo.sh $CONFIGURED_ARCH $TARGET_MACHINE $TARGET_PLATFORM-$TARGET_MACHINE-$ONIEIMAGE_VERSION \
./onie-mk-demo.sh $TARGET_PLATFORM $TARGET_MACHINE $TARGET_PLATFORM-$TARGET_MACHINE-$ONIEIMAGE_VERSION \
installer platform/$TARGET_MACHINE/platform.conf $output_file OS $IMAGE_VERSION $ONIE_IMAGE_PART_SIZE \
$ONIE_INSTALLER_PAYLOAD
}
Expand All @@ -111,7 +111,7 @@ if [ "$IMAGE_TYPE" = "onie" ]; then
mkdir -p `dirname $OUTPUT_ONIE_IMAGE`
sudo rm -f $OUTPUT_ONIE_IMAGE

generate_device_list "./installer/platforms_asic"
generate_device_list "./installer/$TARGET_PLATFORM/platforms_asic"

generate_onie_installer_image

Expand All @@ -125,7 +125,7 @@ elif [ "$IMAGE_TYPE" = "raw" ]; then
mkdir -p `dirname $OUTPUT_RAW_IMAGE`
sudo rm -f $OUTPUT_RAW_IMAGE

generate_device_list "./installer/platforms_asic"
generate_device_list "./installer/$TARGET_PLATFORM/platforms_asic"

generate_onie_installer_image "$tmp_output_onie_image"

Expand Down Expand Up @@ -159,7 +159,7 @@ elif [ "$IMAGE_TYPE" = "raw" ]; then

elif [ "$IMAGE_TYPE" = "kvm" ]; then

generate_device_list "./installer/platforms_asic"
generate_device_list "./installer/$TARGET_PLATFORM/platforms_asic"

generate_onie_installer_image
# Generate single asic KVM image
Expand Down
2 changes: 1 addition & 1 deletion files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libnss-radius_*.deb || \
sudo sed -i -e '/^passwd/s/ radius//' $FILESYSTEM_ROOT/etc/nsswitch.conf

# Install a custom version of kdump-tools (and its dependencies via 'apt-get -y install -f')
if [[ $TARGET_BOOTLOADER == grub ]]; then
if [[ $CONFIGURED_ARCH == amd64 ]]; then
sudo DEBIAN_FRONTEND=noninteractive dpkg --root=$FILESYSTEM_ROOT -i $debs_path/kdump-tools_*.deb || \
sudo LANG=C DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true chroot $FILESYSTEM_ROOT apt-get -q --no-install-suggests --no-install-recommends install
cat $IMAGE_CONFIGS/kdump/kdump-tools | sudo tee -a $FILESYSTEM_ROOT/etc/default/kdump-tools > /dev/null
Expand Down
2 changes: 1 addition & 1 deletion files/image_config/platform/rc.local
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ if [ -f $FIRST_BOOT_FILE ]; then
# we now install a grub for SONiC.
if [ -n "$onie_platform" ] && [ -n "$grub_installation_needed" ]; then

grub_bin=$(ls /host/image-$SONIC_VERSION/platform/grub/grub*.deb 2> /dev/null)
grub_bin=$(ls /host/image-$SONIC_VERSION/platform/x86_64-grub/grub-pc-bin*.deb 2> /dev/null)
if [ -z "$grub_bin" ]; then
log_migration "Unable to locate grub package !"
firsttime_exit
Expand Down
67 changes: 7 additions & 60 deletions installer/install.sh → installer/arm64/install.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
#!/bin/sh

# Copyright (C) 2020 Marvell Inc
# Copyright (C) 2014-2015 Curt Brune <curt@cumulusnetworks.com>
# Copyright (C) 2014-2015 david_yang <david_yang@accton.com>
# Copyright (C) Marvell Inc
#
# SPDX-License-Identifier: GPL-2.0

# Appends a command to a trap, which is needed because default trap behavior is to replace
# previous trap for the same signal
# - 1st arg: code to add
# - ref: http://stackoverflow.com/questions/3338030/multiple-bash-traps-for-the-same-signal


_trap_push() {
local next="$1"
Expand All @@ -23,26 +14,6 @@ _trap_push() {
}
_trap_push true

read_conf_file() {
local conf_file=$1
while IFS='=' read -r var value || [ -n "$var" ]
do
# remove newline character
var=$(echo $var | tr -d '\r\n')
value=$(echo $value | tr -d '\r\n')
# remove comment string
var=${var%#*}
value=${value%#*}
# skip blank line
[ -z "$var" ] && continue
# remove double quote in the beginning
tmp_val=${value#\"}
# remove double quote in the end
value=${tmp_val%\"}
eval "$var=\"$value\""
done < "$conf_file"
}

set -e

if [ -d "/etc/sonic" ]; then
Expand All @@ -59,17 +30,11 @@ fi

cd $(dirname $0)
if [ -r ./machine.conf ]; then
read_conf_file "./machine.conf"
. ./machine.conf
fi

# Load generic onie-image.conf
if [ -r ./onie-image.conf ]; then
. ./onie-image.conf
fi

# Load arch-specific onie-image-[arch].conf if exists
if [ -r ./onie-image-*.conf ]; then
. ./onie-image-*.conf
if [ -r ./onie-image-arm64.conf ]; then
. ./onie-image-arm64.conf
fi

echo "ONIE Installer: platform: $platform"
Expand All @@ -80,17 +45,15 @@ if [ $(id -u) -ne 0 ]
exit 1
fi

# get running machine from conf file
if [ -r /etc/machine.conf ]; then
read_conf_file "/etc/machine.conf"
. /etc/machine.conf
elif [ -r /host/machine.conf ]; then
read_conf_file "/host/machine.conf"
. /host/machine.conf
elif [ "$install_env" != "build" ]; then
echo "cannot find machine.conf"
exit 1
fi


echo "onie_platform: $onie_platform"

# Get platform specific linux kernel command line arguments
Expand Down Expand Up @@ -147,12 +110,7 @@ demo_volume_label="SONiC-${demo_type}"
demo_volume_revision_label="SONiC-${demo_type}-${image_version}"


. ./default_platform.conf

if [ -r ./platform.conf ]; then
. ./platform.conf
fi

. ./platform.conf

image_dir="image-$image_version"

Expand Down Expand Up @@ -181,19 +139,8 @@ elif [ "$install_env" = "sonic" ]; then
rm -rf $f
fi
done
else
demo_mnt="build_raw_image_mnt"
demo_dev=$cur_wd/"%%OUTPUT_RAW_IMAGE%%"

mkfs.ext4 -L $demo_volume_label $demo_dev

echo "Mounting $demo_dev on $demo_mnt..."
mkdir $demo_mnt
mount -t auto -o loop $demo_dev $demo_mnt
fi

echo "Installing SONiC to $demo_mnt/$image_dir"

# Create target directory or clean it up if exists
if [ -d $demo_mnt/$image_dir ]; then
echo "Directory $demo_mnt/$image_dir/ already exists. Cleaning up..."
Expand Down
Loading