Skip to content

ci:Add Flatbuild generation Support #27

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

sgaud-quic
Copy link
Contributor

Add flatbuild generation support for the targets.
Target configuration is stored in a json file,
it also have Build Id, which is used to fetch boot binaries
from artifactory to generate flat build.

Add flatbuild generation support for the targets.
Target configuration is stored in a json file,
it also have Build Id, which is used to fetch boot binaries
from artifactory to generate flat build.

Signed-off-by: Salendarsingh Gaud <[email protected]>
Copy contents.xml from contents.zip

Signed-off-by: Salendarsingh Gaud <[email protected]>
Copy link
Contributor

Choose a reason for hiding this comment

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

please add an empty line at the end of this file.

Comment on lines +50 to +124
- name: Generate Flat Build
run: |
set -x
bootbins='${{ inputs.bootbins }}'
echo "$bootbins"
workspace=${{ steps.sync.outputs.workspace_path }}
cd $workspace/../
git clone https://github.com/qualcomm-linux/qcom-ptool.git
for row in $(echo "$bootbins" | jq -c '.[]'); do
(
target=$(echo "$row" | jq -r '.target')
buildid=$(echo "$row" | jq -r '.buildid')
firmwareid=$(echo "$row" | jq -r '.firmwareid')
echo "DT : $target"
echo "BuildId : $buildid"
echo "FirmwareId : $firmwareid"
echo "-----------------------------"
platform=$(echo "$buildid" | cut -d '.' -f1)
echo "$platform"
mkdir -p $workspace/../flatbuild-"$platform"
cd $workspace/../flatbuild-"$platform"
wget https://artifactory-las.qualcomm.com/artifactory/lint-lv-local/k2c_nhlos_fw/$buildid/common/build/ufs/bin/"$platform"_bootbinaries.zip
wget https://artifactory-las.qualcomm.com/artifactory/lint-lv-local/k2c_nhlos_fw/$buildid/common/build/ufs/bin/contents.zip
unzip "$platform"_bootbinaries.zip
unzip contents.zip
python $workspace/../qcom-ptool/ptool.py -x "$platform"_bootbinaries/partition_ufs.xml -t "$platform"_bootbinaries/
cp $workspace/../flatbuild-"$platform"/contents/contents.xml "$platform"_bootbinaries/
cd $workspace/../flatbuild-"$platform"/"$platform"_bootbinaries/
rm -rf rawprogram0_* rawprogram1_* rawprogram2_* rawprogram3_* rawprogram4_* rawprogram5_*
sed -i '/system.img/d' rawprogram0.xml
mkdir -p $workspace/../flatbuild-"$platform"/artifacts
cd $workspace/../flatbuild-"$platform"/artifacts

#This needs to be downloaded from S3 bucket.
wget http://hu-sgaud-hyd:8000/initramfs-kerneltest-full-image-qcom-armv8a.cpio.gz
wget http://hu-sgaud-hyd:8000/initramfs-firmware-"$firmwareid"-image-qcom-armv8a.cpio.gz

gunzip -c initramfs-kerneltest-full-image-qcom-armv8a.cpio.gz > initramfs-kerneltest-full-image-qcom-armv8a.cpio
gunzip -c initramfs-firmware-"$firmwareid"-image-qcom-armv8a.cpio.gz > initramfs-firmware-"$firmwareid"-image-qcom-armv8a.cpio
cat initramfs-kerneltest-full-image-qcom-armv8a.cpio initramfs-firmware-"$firmwareid"-image-qcom-armv8a.cpio > merged-initramfs-"$firmwareid".cpio
gzip merged-initramfs-"$firmwareid".cpio

(cd $workspace/../kobj/tar-install ; find lib/modules | cpio -o -H newc -R +0:+0 | gzip -9 >> $workspace/../flatbuild-"$platform"/artifacts/merged-initramfs-"$firmwareid".cpio.gz)

wget -O $workspace/../flatbuild-"$platform"/artifacts/systemd-boot-efi.deb http://ports.ubuntu.com/pool/universe/s/systemd/systemd-boot-efi_255.4-1ubuntu8_arm64.deb
dpkg-deb -xv $workspace/../flatbuild-"$platform"/artifacts/systemd-boot-efi.deb $workspace/../flatbuild-"$platform"/artifacts/systemd
cd $workspace/../flatbuild-"$platform"

docker run -i --rm \
--user $(id -u):$(id -g) \
--workdir="$PWD" \
-v "$(dirname $PWD)":"$(dirname $PWD)" \
${{ inputs.docker_image }} bash -c "
generate_boot_bins.sh efi --ramdisk artifacts/merged-initramfs-"$firmwareid".cpio.gz \
--systemd-boot artifacts/systemd/usr/lib/systemd/boot/efi/systemd-bootaa64.efi \
--stub artifacts/systemd/usr/lib/systemd/boot/efi/linuxaa64.efi.stub \
--linux ../kobj/arch/arm64/boot/Image \
--output images
"
docker run -i --rm \
--user $(id -u):$(id -g) \
--workdir="$PWD" \
-v "$(dirname $PWD)":"$(dirname $PWD)" \
${{ inputs.docker_image }} bash -c "
generate_boot_bins.sh dtb --input ../kobj/arch/arm64/boot/dts/qcom/"$target".dtb --output images
"

cp $workspace/../flatbuild-"$platform"/images/efi.bin $workspace/../flatbuild-"$platform"/"$platform"_bootbinaries
cp $workspace/../flatbuild-"$platform"/images/dtb.bin $workspace/../flatbuild-"$platform"/"$platform"_bootbinaries

#Upload these to location from where Axiom jobs can be triggered.
#$workspace/../flatbuild-"$platform"/"$platform"_bootbinaries
)
done

Copy link
Contributor

Choose a reason for hiding this comment

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

There's a lot of work done here to generate flat build.
This scripting part needs to be written in a separate action file, to maintain code clarity and file consistency.

try {
if (!fs.existsSync(binsFilePath)) {
core.setFailed(`MACHINES.json not found at ${binsFilePath}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update the error message accordingly.


#This needs to be downloaded from S3 bucket.
wget http://hu-sgaud-hyd:8000/initramfs-kerneltest-full-image-qcom-armv8a.cpio.gz
wget http://hu-sgaud-hyd:8000/initramfs-firmware-"$firmwareid"-image-qcom-armv8a.cpio.gz

Choose a reason for hiding this comment

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

pointing to local machine?

@@ -42,6 +47,81 @@ jobs:
docker_image: ${{ inputs.docker_image }}
workspace_path: ${{ steps.sync.outputs.workspace_path }}

- name: Generate Flat Build

Choose a reason for hiding this comment

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

move to a separate action? since it is not needed every time

echo "$platform"
mkdir -p $workspace/../flatbuild-"$platform"
cd $workspace/../flatbuild-"$platform"
wget https://artifactory-las.qualcomm.com/artifactory/lint-lv-local/k2c_nhlos_fw/$buildid/common/build/ufs/bin/"$platform"_bootbinaries.zip

Choose a reason for hiding this comment

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

these are internal urls, need to replace them

@quic-viskuma quic-viskuma force-pushed the main branch 5 times, most recently from dbf4b91 to df6efde Compare July 14, 2025 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants