Skip to content

Commit f48734f

Browse files
authored
[Build]: Fix the bin image generated from raw image issue (#10083) (#13672)
#### Why I did it Cherry pick from #10083 It is to fix the issue #10048 When building .raw image, for instance, target/sonic-broadcom.raw, it will generate a .bin image, target/sonic-broadcom.bin, as the intermediate file. The intermediate file is a build target which may contains different dependencies with the raw one. #### How I did it Rename the intermediate file.
1 parent ff5a703 commit f48734f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

build_image.sh

+8-4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ IMAGE_VERSION="${SONIC_IMAGE_VERSION}"
2727

2828
generate_onie_installer_image()
2929
{
30+
output_file=$OUTPUT_ONIE_IMAGE
31+
[ -n "$1" ] && output_file=$1
3032
# Copy platform-specific ONIE installer config files where onie-mk-demo.sh expects them
3133
rm -rf ./installer/${TARGET_PLATFORM}/platforms/
3234
mkdir -p ./installer/${TARGET_PLATFORM}/platforms/
@@ -42,7 +44,7 @@ generate_onie_installer_image()
4244
## Generate an ONIE installer image
4345
## Note: Don't leave blank between lines. It is single line command.
4446
./onie-mk-demo.sh $TARGET_PLATFORM $TARGET_MACHINE $TARGET_PLATFORM-$TARGET_MACHINE-$ONIEIMAGE_VERSION \
45-
installer platform/$TARGET_MACHINE/platform.conf $OUTPUT_ONIE_IMAGE OS $IMAGE_VERSION $ONIE_IMAGE_PART_SIZE \
47+
installer platform/$TARGET_MACHINE/platform.conf $output_file OS $IMAGE_VERSION $ONIE_IMAGE_PART_SIZE \
4648
$ONIE_INSTALLER_PAYLOAD
4749
}
4850

@@ -59,10 +61,11 @@ if [ "$IMAGE_TYPE" = "onie" ]; then
5961
elif [ "$IMAGE_TYPE" = "raw" ]; then
6062

6163
echo "Build RAW image"
64+
tmp_output_onie_image=${OUTPUT_ONIE_IMAGE}.tmp
6265
mkdir -p `dirname $OUTPUT_RAW_IMAGE`
6366
sudo rm -f $OUTPUT_RAW_IMAGE
6467

65-
generate_onie_installer_image
68+
generate_onie_installer_image "$tmp_output_onie_image"
6669

6770
echo "Creating SONiC raw partition : $OUTPUT_RAW_IMAGE of size $RAW_IMAGE_DISK_SIZE MB"
6871
fallocate -l "$RAW_IMAGE_DISK_SIZE"M $OUTPUT_RAW_IMAGE
@@ -73,8 +76,9 @@ elif [ "$IMAGE_TYPE" = "raw" ]; then
7376
## Generate a partition dump that can be used to 'dd' in-lieu of using the onie-nos-installer
7477
## Run the installer
7578
## The 'build' install mode of the installer is used to generate this dump.
76-
sudo chmod a+x $OUTPUT_ONIE_IMAGE
77-
sudo ./$OUTPUT_ONIE_IMAGE
79+
sudo chmod a+x $tmp_output_onie_image
80+
sudo ./$tmp_output_onie_image
81+
rm $tmp_output_onie_image
7882

7983
[ -r $OUTPUT_RAW_IMAGE ] || {
8084
echo "Error : $OUTPUT_RAW_IMAGE not generated!"

0 commit comments

Comments
 (0)