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

build one aboot image on arista platform #263

Merged
merged 1 commit into from
Feb 6, 2017
Merged
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@
[submodule "platform/broadcom/sonic-platform-modules-s6000"]
path = platform/broadcom/sonic-platform-modules-s6000
url = https://github.com/Azure/sonic-platform-modules-s6000
[submodule "sonic-platform-modules-arista"]
path = platform/broadcom/sonic-platform-modules-arista
url = https://github.com/lguohan/sonic-1
27 changes: 20 additions & 7 deletions build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,38 @@
}
GIT_REVISION=$(git rev-parse --short HEAD)

mkdir -p `dirname $OUTPUT_ONIE_IMAGE`
sudo rm -f $OUTPUT_ONIE_IMAGE
if [ "$IMAGE_TYPE" = "onie" ]; then
echo "Build ONIE installer"
mkdir -p `dirname $OUTPUT_ONIE_IMAGE`
sudo rm -f $OUTPUT_ONIE_IMAGE
## Generate an ONIE installer image
## Note: Don't leave blank between lines. It is single line command.
./onie-mk-demo.sh $TARGET_PLATFORM $TARGET_MACHINE $TARGET_PLATFORM-$TARGET_MACHINE-$ONIEIMAGE_VERSION \
installer platform/$TARGET_MACHINE/platform.conf $OUTPUT_ONIE_IMAGE OS $GIT_REVISION $ONIE_IMAGE_PART_SIZE \
$ONIE_INSTALLER_PAYLOAD
## Use 'aboot' as target machine category which includes Aboot as bootloader
elif [ "$IMAGE_TYPE" = "aboot" ]; then
## Add Aboot boot0 file into the image
cp $ONIE_INSTALLER_PAYLOAD $OUTPUT_ONIE_IMAGE
pushd files/Aboot && sudo zip -g $OLDPWD/$OUTPUT_ONIE_IMAGE boot0; popd
echo "Build Aboot installer"
mkdir -p `dirname $OUTPUT_ABOOT_IMAGE`
sudo rm -f $OUTPUT_ABOOT_IMAGE
sudo rm -f $ABOOT_BOOT_IMAGE
## Add main payload
cp $ONIE_INSTALLER_PAYLOAD $OUTPUT_ABOOT_IMAGE
## Add Aboot boot0 file
j2 -f env files/Aboot/boot0.j2 ./onie-image.conf > files/Aboot/boot0
pushd files/Aboot && zip -g $OLDPWD/$OUTPUT_ABOOT_IMAGE boot0; popd
pushd files/Aboot && zip -g $OLDPWD/$ABOOT_BOOT_IMAGE boot0; popd
echo "$GIT_REVISION" >> .imagehash
zip -g $OUTPUT_ONIE_IMAGE .imagehash
zip -g $OUTPUT_ABOOT_IMAGE .imagehash
zip -g $ABOOT_BOOT_IMAGE .imagehash
rm .imagehash
echo "SWI_VERSION=42.0.0" > version
zip -g $OUTPUT_ONIE_IMAGE version
zip -g $OUTPUT_ABOOT_IMAGE version
zip -g $ABOOT_BOOT_IMAGE version
rm version

zip -g $OUTPUT_ABOOT_IMAGE $ABOOT_BOOT_IMAGE
rm $ABOOT_BOOT_IMAGE
else
echo "Error: Non supported target platform: $TARGET_PLATFORM"
exit 1
Expand Down
16 changes: 11 additions & 5 deletions files/Aboot/boot0 → files/Aboot/boot0.j2
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,23 @@ extract_image() {
## Clean old directory for read-write layer
rm -rf "$target_path/rw"

## Clean docker directory
rm -rf "$target_path/var"

## Unzip the image
unzip -oq "$swipath" -x boot0 -d "$target_path"

## Clean old directory for docker
rm -rf "$target_path/var/lib/docker"
## Remove installer swi as it has lots of redundunt contents
rm -f $swipath

## Further extract docker archive
tar xf "$target_path/dockerfs.tar.gz" -C "$target_path"
## Further extract docker archive
tar xf "$target_path/{{ FILESYSTEM_DOCKERFS }}" -C "$target_path"

## clean up docker archive
rm -f "$target_path/dockerfs.tar.gz"
rm -f "$target_path/{{ FILESYSTEM_DOCKERFS }}"

## replace with boot swi
mv "$target_path/{{ ABOOT_BOOT_IMAGE }}" "$swipath"
}

write_machine_config() {
Expand Down
6 changes: 6 additions & 0 deletions onie-image.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ FILESYSTEM_DOCKERFS=dockerfs.tar.gz

## Output file name for onie installer
OUTPUT_ONIE_IMAGE=target/sonic-$TARGET_MACHINE.bin

## Output file name for aboot installer
OUTPUT_ABOOT_IMAGE=target/sonic-aboot-$TARGET_MACHINE.swi

## Aboot boot image name
ABOOT_BOOT_IMAGE=.sonic-boot.swi
8 changes: 8 additions & 0 deletions platform/broadcom/one-aboot.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# sonic broadcom one image installer

SONIC_ONE_ABOOT_IMAGE = sonic-aboot-broadcom.swi
$(SONIC_ONE_ABOOT_IMAGE)_MACHINE = broadcom
$(SONIC_ONE_ABOOT_IMAGE)_IMAGE_TYPE = aboot
$(SONIC_ONE_ABOOT_IMAGE)_DEPENDS += $(BRCM_OPENNSL_KERNEL) $(ARISTA_PLATFORM_MODULE)
$(SONIC_ONE_ABOOT_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES)
SONIC_INSTALLERS += $(SONIC_ONE_ABOOT_IMAGE)
10 changes: 10 additions & 0 deletions platform/broadcom/platform-modules-arista.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Arista Platform modules

ARISTA_PLATFORM_MODULE_VERSION = 1.0

export ARISTA_PLATFORM_MODULE_VERSION

ARISTA_PLATFORM_MODULE = sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_amd64.deb
$(ARISTA_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-arista
$(ARISTA_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
SONIC_DPKG_DEBS += $(ARISTA_PLATFORM_MODULE)
4 changes: 3 additions & 1 deletion platform/broadcom/rules.mk
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
include $(PLATFORM_PATH)/sdk.mk
include $(PLATFORM_PATH)/sai.mk
include $(PLATFORM_PATH)/platform-modules-s6000.mk
include $(PLATFORM_PATH)/platform-modules-arista.mk
include $(PLATFORM_PATH)/docker-orchagent-brcm.mk
include $(PLATFORM_PATH)/docker-syncd-brcm.mk
include $(PLATFORM_PATH)/one-image.mk
include $(PLATFORM_PATH)/one-aboot.mk

BCMCMD = bcmcmd
$(BCMCMD)_URL = "https://sonicstorage.blob.core.windows.net/packages/bcmcmd?sv=2015-04-05&sr=b&sig=X3bFApmsNFmcnWM9mSGRxBugPcg%2FgJCHh5hhSuV1M2c%3D&se=2030-08-23T14%3A41%3A56Z&sp=r"
Expand All @@ -13,7 +15,7 @@ $(DSSERVE)_URL = "https://sonicstorage.blob.core.windows.net/packages/dsserve?sv

SONIC_ONLINE_FILES += $(BCMCMD) $(DSSERVE)

SONIC_ALL += $(SONIC_ONE_IMAGE)
SONIC_ALL += $(SONIC_ONE_IMAGE) $(SONIC_ONE_ABOOT_IMAGE)

# Inject brcm sai into sairedis
$(LIBSAIREDIS)_DEPENDS += $(BRCM_OPENNSL) $(BRCM_SAI) $(BRCM_SAI_DEV)
Expand Down
1 change: 1 addition & 0 deletions platform/broadcom/sonic-platform-modules-arista
4 changes: 2 additions & 2 deletions platform/generic/aboot-image.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# sonic aboot installer

SONIC_GENERIC_ABOOT_IMAGE = sonic-aboot.bin
$(SONIC_GENERIC_ABOOT_IMAGE)_MACHINE = aboot
SONIC_GENERIC_ABOOT_IMAGE = sonic-aboot-generic.swi
$(SONIC_GENERIC_ABOOT_IMAGE)_MACHINE = generic
$(SONIC_GENERIC_ABOOT_IMAGE)_IMAGE_TYPE = aboot
$(SONIC_GENERIC_ABOOT_IMAGE)_DEPENDS =
$(SONIC_GENERIC_ABOOT_IMAGE)_DOCKERS =
Expand Down