Skip to content

Commit 596ea5a

Browse files
authored
Revert "[arm] Refactor installer and build to allow arm builds targeted at grub platforms (#11341)"
This reverts commit 429254c.
1 parent b29dda2 commit 596ea5a

File tree

12 files changed

+564
-236
lines changed

12 files changed

+564
-236
lines changed

Makefile.work

-6
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,6 @@ ifeq ($(PLATFORM_ARCH),)
104104
override PLATFORM_ARCH = $(CONFIGURED_ARCH)
105105
endif
106106

107-
ifeq ($(CONFIGURED_ARCH),amd64)
108-
TARGET_BOOTLOADER = grub
109-
else
110-
TARGET_BOOTLOADER = uboot
111-
endif
112-
113107
ifeq ($(BLDENV), bullseye)
114108
SLAVE_DIR = sonic-slave-bullseye
115109
else ifeq ($(BLDENV), buster)

build_debian.sh

+6-12
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ if [[ -d $FILESYSTEM_ROOT ]]; then
6565
fi
6666
mkdir -p $FILESYSTEM_ROOT
6767
mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR
68-
mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR/grub
68+
mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64-grub
6969
touch $FILESYSTEM_ROOT/$PLATFORM_DIR/firsttime
7070

7171
## ensure proc is mounted
@@ -166,7 +166,7 @@ if [ "$SONIC_ENABLE_SECUREBOOT_SIGNATURE" = "y" ]; then
166166
fi
167167

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

399-
if [[ $TARGET_BOOTLOADER == grub ]]; then
400-
if [[ $CONFIGURED_ARCH == amd64 ]]; then
401-
GRUB_PKG=grub-pc-bin
402-
elif [[ $CONFIGURED_ARCH == arm64 ]]; then
403-
GRUB_PKG=grub-efi-arm64-bin
404-
fi
405-
399+
if [[ $CONFIGURED_ARCH == amd64 ]]; then
406400
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y download \
407-
$GRUB_PKG
401+
grub-pc-bin
408402

409-
sudo mv $FILESYSTEM_ROOT/grub*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/grub
403+
sudo mv $FILESYSTEM_ROOT/grub-pc-bin*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/x86_64-grub
410404
fi
411405

412406
## Disable kexec supported reboot which was installed by default
@@ -582,7 +576,7 @@ fi
582576
## Update initramfs
583577
sudo chroot $FILESYSTEM_ROOT update-initramfs -u
584578
## Convert initrd image to u-boot format
585-
if [[ $TARGET_BOOTLOADER == uboot ]]; then
579+
if [[ $CONFIGURED_ARCH == armhf || $CONFIGURED_ARCH == arm64 ]]; then
586580
INITRD_FILE=initrd.img-${LINUX_KERNEL_VERSION}-${CONFIGURED_ARCH}
587581
if [[ $CONFIGURED_ARCH == armhf ]]; then
588582
INITRD_FILE=initrd.img-${LINUX_KERNEL_VERSION}-armmp

build_image.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ generate_onie_installer_image()
8484

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

114-
generate_device_list "./installer/platforms_asic"
114+
generate_device_list "./installer/$TARGET_PLATFORM/platforms_asic"
115115

116116
generate_onie_installer_image
117117

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

128-
generate_device_list "./installer/platforms_asic"
128+
generate_device_list "./installer/$TARGET_PLATFORM/platforms_asic"
129129

130130
generate_onie_installer_image "$tmp_output_onie_image"
131131

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

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

162-
generate_device_list "./installer/platforms_asic"
162+
generate_device_list "./installer/$TARGET_PLATFORM/platforms_asic"
163163

164164
generate_onie_installer_image
165165
# Generate single asic KVM image

files/build_templates/sonic_debian_extension.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/libnss-radius_*.deb || \
297297
sudo sed -i -e '/^passwd/s/ radius//' $FILESYSTEM_ROOT/etc/nsswitch.conf
298298

299299
# Install a custom version of kdump-tools (and its dependencies via 'apt-get -y install -f')
300-
if [[ $TARGET_BOOTLOADER == grub ]]; then
300+
if [[ $CONFIGURED_ARCH == amd64 ]]; then
301301
sudo DEBIAN_FRONTEND=noninteractive dpkg --root=$FILESYSTEM_ROOT -i $debs_path/kdump-tools_*.deb || \
302302
sudo LANG=C DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true chroot $FILESYSTEM_ROOT apt-get -q --no-install-suggests --no-install-recommends install
303303
cat $IMAGE_CONFIGS/kdump/kdump-tools | sudo tee -a $FILESYSTEM_ROOT/etc/default/kdump-tools > /dev/null

files/image_config/platform/rc.local

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ if [ -f $FIRST_BOOT_FILE ]; then
293293
# we now install a grub for SONiC.
294294
if [ -n "$onie_platform" ] && [ -n "$grub_installation_needed" ]; then
295295

296-
grub_bin=$(ls /host/image-$SONIC_VERSION/platform/grub/grub*.deb 2> /dev/null)
296+
grub_bin=$(ls /host/image-$SONIC_VERSION/platform/x86_64-grub/grub-pc-bin*.deb 2> /dev/null)
297297
if [ -z "$grub_bin" ]; then
298298
log_migration "Unable to locate grub package !"
299299
firsttime_exit

installer/install.sh renamed to installer/arm64/install.sh

+7-60
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
#!/bin/sh
22

3-
# Copyright (C) 2020 Marvell Inc
4-
# Copyright (C) 2014-2015 Curt Brune <[email protected]>
5-
# Copyright (C) 2014-2015 david_yang <[email protected]>
3+
# Copyright (C) Marvell Inc
64
#
7-
# SPDX-License-Identifier: GPL-2.0
8-
9-
# Appends a command to a trap, which is needed because default trap behavior is to replace
10-
# previous trap for the same signal
11-
# - 1st arg: code to add
12-
# - ref: http://stackoverflow.com/questions/3338030/multiple-bash-traps-for-the-same-signal
13-
145

156
_trap_push() {
167
local next="$1"
@@ -23,26 +14,6 @@ _trap_push() {
2314
}
2415
_trap_push true
2516

26-
read_conf_file() {
27-
local conf_file=$1
28-
while IFS='=' read -r var value || [ -n "$var" ]
29-
do
30-
# remove newline character
31-
var=$(echo $var | tr -d '\r\n')
32-
value=$(echo $value | tr -d '\r\n')
33-
# remove comment string
34-
var=${var%#*}
35-
value=${value%#*}
36-
# skip blank line
37-
[ -z "$var" ] && continue
38-
# remove double quote in the beginning
39-
tmp_val=${value#\"}
40-
# remove double quote in the end
41-
value=${tmp_val%\"}
42-
eval "$var=\"$value\""
43-
done < "$conf_file"
44-
}
45-
4617
set -e
4718

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

6031
cd $(dirname $0)
6132
if [ -r ./machine.conf ]; then
62-
read_conf_file "./machine.conf"
33+
. ./machine.conf
6334
fi
6435

65-
# Load generic onie-image.conf
66-
if [ -r ./onie-image.conf ]; then
67-
. ./onie-image.conf
68-
fi
69-
70-
# Load arch-specific onie-image-[arch].conf if exists
71-
if [ -r ./onie-image-*.conf ]; then
72-
. ./onie-image-*.conf
36+
if [ -r ./onie-image-arm64.conf ]; then
37+
. ./onie-image-arm64.conf
7338
fi
7439

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

83-
# get running machine from conf file
8448
if [ -r /etc/machine.conf ]; then
85-
read_conf_file "/etc/machine.conf"
49+
. /etc/machine.conf
8650
elif [ -r /host/machine.conf ]; then
87-
read_conf_file "/host/machine.conf"
51+
. /host/machine.conf
8852
elif [ "$install_env" != "build" ]; then
8953
echo "cannot find machine.conf"
9054
exit 1
9155
fi
9256

93-
9457
echo "onie_platform: $onie_platform"
9558

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

149112

150-
. ./default_platform.conf
151-
152-
if [ -r ./platform.conf ]; then
153-
. ./platform.conf
154-
fi
155-
113+
. ./platform.conf
156114

157115
image_dir="image-$image_version"
158116

@@ -181,19 +139,8 @@ elif [ "$install_env" = "sonic" ]; then
181139
rm -rf $f
182140
fi
183141
done
184-
else
185-
demo_mnt="build_raw_image_mnt"
186-
demo_dev=$cur_wd/"%%OUTPUT_RAW_IMAGE%%"
187-
188-
mkfs.ext4 -L $demo_volume_label $demo_dev
189-
190-
echo "Mounting $demo_dev on $demo_mnt..."
191-
mkdir $demo_mnt
192-
mount -t auto -o loop $demo_dev $demo_mnt
193142
fi
194143

195-
echo "Installing SONiC to $demo_mnt/$image_dir"
196-
197144
# Create target directory or clean it up if exists
198145
if [ -d $demo_mnt/$image_dir ]; then
199146
echo "Directory $demo_mnt/$image_dir/ already exists. Cleaning up..."

0 commit comments

Comments
 (0)