Skip to content

Commit

Permalink
Update uPart.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelscholle committed Jul 30, 2024
1 parent 2d67086 commit d7b2e16
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/uPart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ add_fat32_partition() {
dd if=/dev/zero of=fat.img bs=1M count=300
cat fat.img >> "${PREV_WORK_DIR}"/*.img
rm -f fat.img

if [[ "${OS}" == "radxa-debian-rock-cm3" ]]; then
if [[ "${OS}" == "ubuntu-x86-minimal" ]] || [[ "${OS}" == "ubuntu-x86" ]] || [[ "${OS}" == "debian-X20" ]]; then
echo "Video partition not supporte yet"
elif [[ "${OS}" == "radxa-debian-rock-cm3" ]]; then
sgdisk -e "${PREV_WORK_DIR}"/*.img
echo -e "n\n4\n\n\n\n0C00\nw\ny" | sudo gdisk "${PREV_WORK_DIR}"/*.img
sudo parted "${PREV_WORK_DIR}"/*.img set 4 msftdata on
log "Video Partition Added"
log "Video partition added"
local loop_device
loop_device=$(sudo losetup -f --show -P "${PREV_WORK_DIR}"/*.img)
sudo mkfs.fat -F 32 "${loop_device}p4"
Expand All @@ -32,7 +33,7 @@ add_fat32_partition() {
first_sec=$((first_sec + (2048 - first_sec % 2048) % 2048))
sudo parted "${PREV_WORK_DIR}"/*.img --script mkpart primary fat32 "${first_sec}s" 100%
echo -e "t\n3\n0c\nw" | fdisk "${PREV_WORK_DIR}"/*.img
log "Video Partition Added"
log "Video partition added"
local loop_device
loop_device=$(sudo losetup -f --show -o $((first_sec * 512)) "${PREV_WORK_DIR}"/*.img)
sudo mkfs.fat -F 32 "${loop_device}"
Expand All @@ -41,4 +42,4 @@ add_fat32_partition() {
}

# Call the function to add FAT32 partition
add_fat32_partition
add_fat32_partition

0 comments on commit d7b2e16

Please sign in to comment.