Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Commit

Permalink
switch to m4 for partable (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sparkles-Laurel authored Jul 28, 2023
1 parent 2dc3e7f commit 9c187f6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
7 changes: 0 additions & 7 deletions cuteloader-sfd.awk

This file was deleted.

33 changes: 33 additions & 0 deletions util/partable.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# partable.m4 - Partitioning table for Cuteloader

# the device name which Cuteloader will be installed
define(`device_name', `/dev/sdb')dnl

# the record label for the disk
define(`reclabel_type', `mbr')dnl

# the stage1 bootloader partition
define(`STAGE1_START', `2048')dnl
define(`STAGE1_SIZE', `1469440')dnl
define(`STAGE1_TYPE', `0C')dnl

# the stage2 bootloader (and ramdisk images) partition
define(`STAGE2_START', `1471488')dnl
define(`STAGE2_SIZE', `1469440')dnl
define(`STAGE2_TYPE', `83')dnl

# Run fdisk to get the device size and capture the output
define(`FDISK_OUTPUT', `esyscmd(`fdisk -l `device_name)')dnl

# Extract the line containing the device size information using grep
define(`SIZE_LINE', `regexp(FDISK_OUTPUT, `^Disk `device_name)': ')dnl

# Extract the total device size in sectors using awk
define(`DEVICE_SIZE', `regexp(SIZE_LINE, ` ([0-9]+) sectors', ` \1')')dnl

# Calculate the start and size of the third partition
define(`PART3_START', `STAGE2_START + STAGE2_SIZE')dnl
define(`PART3_SIZE', `DEVICE_SIZE - PART3_START')dnl

# the third partition (freely available space)
define(`PART3_TYPE', `83')dnl

0 comments on commit 9c187f6

Please sign in to comment.