Skip to content

Commit

Permalink
Scripts:do some optimizations.
Browse files Browse the repository at this point in the history
	-add overlap checking, error reporting, info print functionality in gen_firmware_xml.c.
	-remove some redundant files(gen_spi_flash.c and gen_sg2044r_spi_flash.c,etc).

	If you need to add new board-level firmware, please follow the example to add the corresponding information at the head of gen_firmware_xml.c file. Additionally, add or modify the relevant functions in envsetup.sh (including specifying the release-note path and macros, etc).

Signed-off-by: JianHang Wu <[email protected]>
  • Loading branch information
wu-jian-hang committed Dec 9, 2024
1 parent fe1796a commit 46afd80
Show file tree
Hide file tree
Showing 18 changed files with 529 additions and 775 deletions.
22 changes: 18 additions & 4 deletions scripts/envsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1487,18 +1487,32 @@ function build_rv_firmware_bin()
{
RELEASED_NOTE_PATH=$RV_TOP_DIR/bootloader-riscv/release-note
build_rv_firmware
source $RV_SCRIPTS_DIR/make_pack_tool.sh $CHIP

if [ ! -e "$RELEASED_NOTE_MD" ] || [ ! -s "$RELEASED_NOTE_MD" ];then
gcc $RV_SCRIPTS_DIR/pack_firmware_bin/gen_firmware_xml.c -D${CHIP^^} -o $RV_FIRMWARE_INSTALL_DIR/make_xml
gcc $RV_SCRIPTS_DIR/pack_firmware_bin/pack_firmware_bin.c -o $RV_FIRMWARE_INSTALL_DIR/pack

if [ "$CHIP" = "mango" ];then
RELEASED_NOTE_MD="$RELEASED_NOTE_PATH/sg2042_release_note.md"
cp $RV_FIRMWARE/fip.bin $RV_FIRMWARE_INSTALL_DIR/
elif [ "$CHIP" = "sg2044" ];then
RELEASED_NOTE_MD="$RELEASED_NOTE_PATH/sg2044_release_note.md"
fi

if [ ! -e "$RELEASEDOTE_MD" ] || [ ! -s "$RELEASED_NOTE_MD" ];then
version="1.0.0"
else
else
cp $RELEASED_NOTE_MD $RV_FIRMWARE_INSTALL_DIR/
version=$(awk 'END {split($1, a, "_"); print a[1]}' $RELEASED_NOTE_MD)
fi

pushd $RV_FIRMWARE_INSTALL_DIR

rm -f firmware*.bin *.xml
./make_xml *.dtb
if [ $? -ne 0 ];then
popd
return
fi
mkdir -p $RV_SCRIPTS_DIR/build/ && cp ./*.xml $RV_SCRIPTS_DIR/build/
./pack *.xml
rm -f make_xml pack
Expand All @@ -1508,7 +1522,7 @@ function build_rv_firmware_bin()
cp firmware-$version.bin image-bmc
$RV_SCRIPTS_DIR/gen-tar-for-bmc.sh image-bmc -o obmc-bios.tar.gz -m ast2600-sophgo -v $version -s
fi
rm -f image-bmc *.xml
rm -f image-bmc *.xml *.md

popd
}
Expand Down
191 changes: 0 additions & 191 deletions scripts/gen_sg2044r_spi_flash.c

This file was deleted.

Loading

0 comments on commit 46afd80

Please sign in to comment.