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

[Bug][Build] Fix the symbol links not supported in the onie unzip command issue #10914

Closed
wants to merge 3 commits 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
4 changes: 2 additions & 2 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -647,5 +647,5 @@ fi
pushd $FILESYSTEM_ROOT && sudo tar czf $OLDPWD/$FILESYSTEM_DOCKERFS -C ${DOCKERFS_PATH}var/lib/docker .; popd

## Compress together with /boot, /var/lib/docker and $PLATFORM_DIR as an installer payload zip file
Copy link
Collaborator

@qiluo-msft qiluo-msft May 26, 2022

Choose a reason for hiding this comment

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

Compress

Is anything change from compressed to uncompressed? Did you check the image size changing for all platforms?

pushd $FILESYSTEM_ROOT && sudo zip $OLDPWD/$ONIE_INSTALLER_PAYLOAD -r boot/ $PLATFORM_DIR/; popd
sudo zip -g -n .squashfs:.gz $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS $FILESYSTEM_DOCKERFS
pushd $FILESYSTEM_ROOT && sudo tar cf $OLDPWD/$ONIE_INSTALLER_PAYLOAD boot/ $PLATFORM_DIR/; popd
sudo tar uf $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS $FILESYSTEM_DOCKERFS
5 changes: 4 additions & 1 deletion build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ elif [ "$IMAGE_TYPE" = "aboot" ]; then
sudo rm -f $OUTPUT_ABOOT_IMAGE
sudo rm -f $ABOOT_BOOT_IMAGE
## Add main payload
cp $ONIE_INSTALLER_PAYLOAD $OUTPUT_ABOOT_IMAGE
tmpdir=$(mktemp -d)
tar -xf $ONIE_INSTALLER_PAYLOAD -C $tmpdir
pushd $tmpdir && zip -n .squashfs:.gz $OUTPUT_ABOOT_IMAGE -r .; popd
rm $tmpdir -rf
## Add Aboot boot0 file
j2 -f env files/Aboot/boot0.j2 ./onie-image.conf > files/Aboot/boot0
sed -i -e "s/%%IMAGE_VERSION%%/$IMAGE_VERSION/g" files/Aboot/boot0
Expand Down
4 changes: 3 additions & 1 deletion files/build_templates/sonic_debian_extension.j2
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,9 @@ sudo LANG=C chroot $FILESYSTEM_ROOT depmod -a {{kversion}}
sudo dpkg --root=$FILESYSTEM_ROOT -i {{deb}} || sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f --download-only

sudo mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR/{{dev}}
sudo cp {{ deb }} $FILESYSTEM_ROOT/$PLATFORM_DIR/{{dev}}/
sudo mkdir -p $FILESYSTEM_ROOT/$PLATFORM_DIR/common
sudo cp {{ deb }} $FILESYSTEM_ROOT/$PLATFORM_DIR/common/
sudo ln -sf "../common/{{ debfilename }}" "$FILESYSTEM_ROOT/$PLATFORM_DIR/{{dev}}/{{ debfilename }}"
for f in $(find $FILESYSTEM_ROOT/var/cache/apt/archives -name "*.deb"); do
sudo mv $f $FILESYSTEM_ROOT/$PLATFORM_DIR/{{dev}}/
done
Expand Down
6 changes: 3 additions & 3 deletions installer/arm64/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,17 @@ fi
# Decompress the file for the file system directly to the partition
if [ x"$docker_inram" = x"on" ]; then
# when disk is small, keep dockerfs.tar.gz in disk, expand it into ramfs during initrd
unzip -o $ONIE_INSTALLER_PAYLOAD -d $demo_mnt/$image_dir
tar -xf $ONIE_INSTALLER_PAYLOAD -C $demo_mnt/$image_dir
else
unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" -d $demo_mnt/$image_dir
tar -xf $ONIE_INSTALLER_PAYLOAD --exclude="$FILESYSTEM_DOCKERFS" -C $demo_mnt/$image_dir

if [ "$install_env" = "onie" ]; then
TAR_EXTRA_OPTION="--numeric-owner"
else
TAR_EXTRA_OPTION="--numeric-owner --warning=no-timestamp"
fi
mkdir -p $demo_mnt/$image_dir/$DOCKERFS_DIR
unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR
tar -xf $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" -O | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR
fi


Expand Down
6 changes: 3 additions & 3 deletions installer/armhf/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,17 @@ fi
# Decompress the file for the file system directly to the partition
if [ x"$docker_inram" = x"on" ]; then
# when disk is small, keep dockerfs.tar.gz in disk, expand it into ramfs during initrd
unzip -o $ONIE_INSTALLER_PAYLOAD -d $demo_mnt/$image_dir
tar -xf $ONIE_INSTALLER_PAYLOAD -C $demo_mnt/$image_dir
else
unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" -d $demo_mnt/$image_dir
tar -xf $ONIE_INSTALLER_PAYLOAD --exclude="$FILESYSTEM_DOCKERFS" -C $demo_mnt/$image_dir

if [ "$install_env" = "onie" ]; then
TAR_EXTRA_OPTION="--numeric-owner"
else
TAR_EXTRA_OPTION="--numeric-owner --warning=no-timestamp"
fi
mkdir -p $demo_mnt/$image_dir/$DOCKERFS_DIR
unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR
tar -xf $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" -O | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR
fi


Expand Down
6 changes: 3 additions & 3 deletions installer/x86_64/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -536,17 +536,17 @@ fi
# Decompress the file for the file system directly to the partition
if [ x"$docker_inram" = x"on" ]; then
# when disk is small, keep dockerfs.tar.gz in disk, expand it into ramfs during initrd
unzip -o $ONIE_INSTALLER_PAYLOAD -d $demo_mnt/$image_dir
tar xvf $ONIE_INSTALLER_PAYLOAD -C $demo_mnt/$image_dir
else
unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" -d $demo_mnt/$image_dir
tar xvf $ONIE_INSTALLER_PAYLOAD --exclude="$FILESYSTEM_DOCKERFS" -C $demo_mnt/$image_dir
if [ "$install_env" = "onie" ]; then
TAR_EXTRA_OPTION="--numeric-owner"
else
TAR_EXTRA_OPTION="--numeric-owner --warning=no-timestamp"
fi
mkdir -p $demo_mnt/$image_dir/$DOCKERFS_DIR
unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR
tar -xf $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" -O | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR
fi
if [ "$install_env" = "onie" ]; then
Expand Down
2 changes: 1 addition & 1 deletion onie-image-arm64.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ FILESYSTEM_ROOT=./fsroot-${TARGET_MACHINE}
FILESYSTEM_SQUASHFS=fs.squashfs

## Filename for onie installer payload, will be the main part of onie installer
ONIE_INSTALLER_PAYLOAD=fs.zip
ONIE_INSTALLER_PAYLOAD=fs.tar

## Filename for docker file system
FILESYSTEM_DOCKERFS=dockerfs.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion onie-image-armhf.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ FILESYSTEM_ROOT=./fsroot-${TARGET_MACHINE}
FILESYSTEM_SQUASHFS=fs.squashfs

## Filename for onie installer payload, will be the main part of onie installer
ONIE_INSTALLER_PAYLOAD=fs.zip
ONIE_INSTALLER_PAYLOAD=fs.tar

## Filename for docker file system
FILESYSTEM_DOCKERFS=dockerfs.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion onie-image.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ FILESYSTEM_ROOT=./fsroot-${TARGET_MACHINE}
FILESYSTEM_SQUASHFS=fs.squashfs

## Filename for onie installer payload, will be the main part of onie installer
ONIE_INSTALLER_PAYLOAD=fs.zip
ONIE_INSTALLER_PAYLOAD=fs.tar

## Filename for docker file system
FILESYSTEM_DOCKERFS=dockerfs.tar.gz
Expand Down