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

scripts: refine mango and sg2044 build scripts #153

Merged
merged 1 commit into from
Dec 3, 2024
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
21 changes: 10 additions & 11 deletions scripts/envsetup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,16 @@ EOT
RPMBUILD_DIR=$RV_KERNEL_SRC_DIR/rpmbuild
fi

make -j$(nproc) ARCH=riscv CROSS_COMPILE=$RISCV64_LINUX_CROSS_COMPILE LOCALVERSION="" rpm-pkg dtbs
make -j$(nproc) ARCH=riscv CROSS_COMPILE=$RISCV64_LINUX_CROSS_COMPILE LOCALVERSION="" dtbs
if [ ! -d $RV_FIRMWARE_INSTALL_DIR ]; then
mkdir -p $RV_FIRMWARE_INSTALL_DIR
else
rm -f $RV_FIRMWARE_INSTALL_DIR/${CHIP}-*.dtb
fi

cp $RV_KERNEL_SRC_DIR/arch/riscv/boot/dts/sophgo/${CHIP}-*.dtb $RV_FIRMWARE_INSTALL_DIR

make -j$(nproc) ARCH=riscv CROSS_COMPILE=$RISCV64_LINUX_CROSS_COMPILE LOCALVERSION="" rpm-pkg
ret=$?
rm ~/.rpmmacros
if [ -e ~/.rpmmacros.orig ]; then
Expand All @@ -944,18 +953,8 @@ EOT
rm -f $RV_RPM_INSTALL_DIR/kernel-*.rpm
fi

if [ ! -d $RV_FIRMWARE_INSTALL_DIR ]; then
mkdir -p $RV_FIRMWARE_INSTALL_DIR
else
rm -f $RV_FIRMWARE_INSTALL_DIR/${CHIP}-*.dtb
fi

cp $RPMBUILD_DIR/RPMS/riscv64/*.rpm $RV_RPM_INSTALL_DIR/
if [[ ${KERNELRELEASE:0:4} == "6.1." ]]; then
cp $RPMBUILD_DIR/BUILD/kernel-${KERNELRELEASE}/arch/riscv/boot/dts/sophgo/${CHIP}-*.dtb $RV_FIRMWARE_INSTALL_DIR
else
cp $RV_KERNEL_SRC_DIR/arch/riscv/boot/dts/sophgo/${CHIP}-*.dtb $RV_FIRMWARE_INSTALL_DIR
fi
make ARCH=riscv CROSS_COMPILE=$RISCV64_LINUX_CROSS_COMPILE distclean
rm *.tar.gz
rm -rf $RPMBUILD_DIR
Expand Down
8 changes: 8 additions & 0 deletions scripts/gen_sg2044_img.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ RV_EULER_OFFICIAL_IMAGE=openEuler-24.03-riscv64-sg2044-20241025.template.img
DOWNLOAD_RV_EULER_OFFICIAL_IMAGE="wget https://github.com/sophgo/bootloader-riscv/releases/download/sg2044-v0.1/openEuler-24.03-riscv64-sg2044-20241025.template.img.xz"
UNCOMPRESS_RV_EULER_OFFICIAL_IMAGE="unxz $RV_EULER_OFFICIAL_IMAGE.xz"

RV_SG2044_FSBL_BIN="https://github.com/sophgo/bootloader-riscv/releases/download/sg2044-v0.1/fsbl.bin"

function get_distro_info()
{
DISTRO_NAME=`echo $1 | awk -F '-' '{print $1}'`
Expand Down Expand Up @@ -86,6 +88,12 @@ function build_rv_image()

sudo mkdir $EFI_PARTITION_DIR/riscv64

if [ "$CHIP" = "sg2044" ]; then
if [ ! -f "$RV_FIRMWARE_INSTALL_DIR/fsbl.bin" ]; then
wget -O "$RV_FIRMWARE_INSTALL_DIR/fsbl.bin" "$RV_SG2044_FSBL_BIN"
fi
fi

sudo cp -v $RV_FIRMWARE_INSTALL_DIR/fsbl.bin $EFI_PARTITION_DIR/riscv64

if [ -f $RV_FIRMWARE_INSTALL_DIR/${CHIP^^}.fd ]; then
Expand Down
Loading