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

Script to create the 8GB blob that can be used in lieu of onie installer #806

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
5 changes: 5 additions & 0 deletions build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ if [ "$IMAGE_TYPE" = "onie" ]; then
./onie-mk-demo.sh $TARGET_PLATFORM $TARGET_MACHINE $TARGET_PLATFORM-$TARGET_MACHINE-$ONIEIMAGE_VERSION \
installer platform/$TARGET_MACHINE/platform.conf $OUTPUT_ONIE_IMAGE OS $IMAGE_VERSION $ONIE_IMAGE_PART_SIZE \
$ONIE_INSTALLER_PAYLOAD

if [[ "$TARGET_MACHINE" == "broadcom" ]] && [[ -n "$DELL_Z9100_PLATFORM_MODULE_VERSION" || -n "$DELL_S6100_PLATFORM_MODULE_VERSION" ]]; then
sudo scripts/dell/build_dd_image.sh
fi

## Use 'aboot' as target machine category which includes Aboot as bootloader
elif [ "$IMAGE_TYPE" = "aboot" ]; then
echo "Build Aboot installer"
Expand Down
34 changes: 34 additions & 0 deletions scripts/dell/build_dd_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
PLATFORM=dell_broadcom
IMAGE=image-HEAD

#remove older image
rm -f target/${PLATFORM}_8GB_dd.img.gz

echo -e "\n# Creating ${PLATFORM}_8GB_dd.img..."
fallocate -l 8G ${PLATFORM}_8GB_dd.img
mkfs.ext4 ${PLATFORM}_8GB_dd.img

echo -e "\n# Mounting ${PLATFORM}_8GB_dd.img on ${PLATFORM}_mount..."
mkdir ${PLATFORM}_mount
mount -t auto -o loop ${PLATFORM}_8GB_dd.img ${PLATFORM}_mount

echo -e "\n# Extracting tarballs into ${PLATFORM}_mount..."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how can this script work? it does not have kernel, squashfs???

mkdir -p ${PLATFORM}_mount/${IMAGE}/docker
unzip -o fs.zip -x dockerfs.tar.gz -d ${PLATFORM}_mount/${IMAGE}
unzip -op fs.zip dockerfs.tar.gz | tar xz --numeric-owner -f - -C ${PLATFORM}_mount/${IMAGE}/docker

echo -e "\n# Creating 4GB logger..."
mkdir -p ${PLATFORM}_mount/disk-img
dd if=/dev/zero of=${PLATFORM}_mount/disk-img/var-log.ext4 count=8388608
mkfs.ext4 -q ${PLATFORM}_mount/disk-img/var-log.ext4 -F

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 16 ~ 24 are in installer/x86_64/install.sh. can you try to embed the logic into install.sh https://github.com/Azure/sonic-buildimage/blob/master/installer/x86_64/install.sh#L411

echo -e "\n# Unmounting and removing ${PLATFORM}_mount..."
umount ${PLATFORM}_mount
rmdir ${PLATFORM}_mount

echo -e "\n# Creating ${PLATFORM}_8GB_dd.img.gz..."
gzip ${PLATFORM}_8GB_dd.img
mv ${PLATFORM}_8GB_dd.img.gz target
echo -e "\n# Done. DD image is under target/${PLATFORM}_8GB_dd.img.gz\n"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to have a grub directory in this sonic partition, so that you can chain the grub in ftos to grub in sonic.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is much easier for later sonic-to-sonic upgrade scenario.