-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the version from 0.1.0 to 1.0.0 in pyproject.toml file and add a new __version__.py file with the updated version number "1.0.0". Also, include a description for the argument parser in args.py and provide a link to the project repository. For more details, see: https://github.com/25077667/cg feat: Add copy_artifact_dest and copy_artifact_path options Add support for specifying the destination directory for copied artifacts and the path of the artifact to be copied. This allows more flexibility in handling artifacts generated during the workflow execution. - Added `copy_artifact_dest` option to specify destination directory for copied artifacts - Added `copy_artifact_path` parameter to define path of specific artifact to be copied - Updated workflow steps to include copying artifact based on architecture into designated release folder feat: Update release workflow to correctly extract and upload artifacts - Use the current working directory variable to set the base path - Create a temporary mount directory in runner's temp folder - Mount the output image into the temporary mount directory - Create a 'release' folder in the current directory for artifact extraction - Copy artifacts from mounted location to local 'release' folder for upload via actions/upload-artifact This commit updates the release workflow in '.github/workflows/release.yml' to improve artifact extraction and uploading process. feat: Update release workflow to upload image artifact Add a step to extract and upload the image artifact for debugging purposes. Now, the workflow uploads the image file instead of the elf file. Also, commented out uploading elf file for now. feat: Add script to extract binary from ARM Linux image Add a new script `armlinux_loopdev_extract.sh` to extract the binary file from an ARM Linux image. This script sets up loop devices, mounts the partition, and copies the binary file to the specified output file. The script checks if the necessary arguments are provided and verifies the existence of the image file. It then sets up a loop device for the image, identifies and mounts the second partition, copies the binary, and unmounts/detaches loop devices upon completion. The addition enhances automation by facilitating extraction of binaries from ARM Linux images efficiently.
- Loading branch information
Showing
5 changed files
with
124 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/bin/bash | ||
|
||
# Check if the user provided an image file and output file | ||
if [ "$#" -ne 2 ]; then | ||
echo "Usage: $0 <image_file> <output_file>" | ||
exit 1 | ||
fi | ||
|
||
IMG_FILE=$1 | ||
OUTPUT_FILE=$2 | ||
PWD=$(pwd) | ||
MNT_POINT="$PWD/mnt" | ||
|
||
# Check if the file exists | ||
if [ ! -f "$IMG_FILE" ]; then | ||
echo "File not found: $IMG_FILE" | ||
exit 1 | ||
fi | ||
|
||
# Setup loop device and get partitions info | ||
LOOP_DEVICE=$(sudo losetup -fP --show "$IMG_FILE") | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Failed to setup loop device for $IMG_FILE" | ||
exit 1 | ||
fi | ||
|
||
echo "Created loopback device ${LOOP_DEVICE}" | ||
|
||
# Check the partition table | ||
sudo parted -s "$LOOP_DEVICE" print | ||
|
||
# Get partition information | ||
PARTITION_INFO=$(sudo parted -s "$LOOP_DEVICE" unit s print | grep "^ [0-9]") | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Failed to get partition information" | ||
sudo losetup -d "$LOOP_DEVICE" | ||
exit 1 | ||
fi | ||
|
||
# Parse the second partition details | ||
PARTITION_OFFSET=$(echo "$PARTITION_INFO" | awk 'NR==2 {print $2}' | sed 's/s//') | ||
PARTITION_SIZE=$(echo "$PARTITION_INFO" | awk 'NR==2 {print $4}' | sed 's/s//') | ||
|
||
# Create a loop device for the second partition | ||
PARTITION_LOOP_DEVICE=$(sudo losetup -o $((PARTITION_OFFSET * 512)) --sizelimit $((PARTITION_SIZE * 512)) --show -f "$LOOP_DEVICE") | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Failed to create loop device for partition" | ||
sudo losetup -d "$LOOP_DEVICE" | ||
exit 1 | ||
fi | ||
|
||
# Create the mount point directory if it doesn't exist | ||
mkdir -p $MNT_POINT | ||
|
||
# Mount the partition | ||
sudo mount "$PARTITION_LOOP_DEVICE" $MNT_POINT | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Failed to mount partition" | ||
sudo losetup -d "$PARTITION_LOOP_DEVICE" | ||
sudo losetup -d "$LOOP_DEVICE" | ||
exit 1 | ||
fi | ||
|
||
# Copy the binary file from the mounted partition to the output file | ||
sudo cp $MNT_POINT/cg/*.elf $OUTPUT_FILE | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Failed to copy the binary file" | ||
sudo umount $MNT_POINT | ||
sudo losetup -d "$PARTITION_LOOP_DEVICE" | ||
sudo losetup -d "$LOOP_DEVICE" | ||
exit 1 | ||
fi | ||
|
||
echo "Binary file copied successfully to $OUTPUT_FILE" | ||
|
||
# Cleanup function to unmount and detach loop devices | ||
cleanup() { | ||
sudo umount $MNT_POINT | ||
sudo losetup -d "$PARTITION_LOOP_DEVICE" | ||
sudo losetup -d "$LOOP_DEVICE" | ||
} | ||
|
||
# Trap EXIT signal to ensure cleanup is done | ||
trap cleanup EXIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "cg" | ||
version = "0.1.0" | ||
version = "1.0.0" | ||
description = "" | ||
authors = ["scc <[email protected]>"] | ||
license = "GPL3" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = "1.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters