sdutil cleanup start_part_dos (), write_iso.sh only work with block devs
All checks were successful
Build documentation / build-and-deploy (push) Successful in 3m50s

This commit is contained in:
2026-03-21 16:03:51 +01:00
parent cc291568f5
commit eccc022091
2 changed files with 22 additions and 27 deletions

View File

@@ -3,6 +3,17 @@
# Requires sudo
# USAGE: ./aux/write_iso.sh /dev/sda
TARGET="$1"
if [ -z "$TARGET" ]; then
exit 1
fi
if [ ! -b "$TARGET" ]; then
echo "Not a block device"
exit 1
fi
set -x
dd if=./mop3.iso of="$1" bs=4M status=progress oflag=direct conv=notrunc,sync && sync
dd if=./mop3.iso of="$TARGET" bs=4M status=progress oflag=direct conv=notrunc,sync && sync

View File

@@ -59,39 +59,23 @@ static void start_part_dos (void) {
in_stream_read_line ("Device name: ", dev_name, sizeof (dev_name));
#define prompt_partition(N) \
#define prompt_and_setup_partition(N) \
char p##N##_start_lba_str[12], p##N##_sector_cout_str[12]; \
uint32_t p##N##_start_lba, p##N##_sector_count; \
mprintf ("\nConfigure parition %d:\n", N); \
in_stream_read_line ("Start LBA: ", p##N##_start_lba_str, sizeof (p##N##_start_lba_str)); \
in_stream_read_line ("Sector count: ", p##N##_sector_cout_str, sizeof (p##N##_sector_cout_str)); \
p##N##_start_lba = str_to_uint32 (p##N##_start_lba_str); \
p##N##_sector_count = str_to_uint32 (p##N##_sector_cout_str);
p##N##_sector_count = str_to_uint32 (p##N##_sector_cout_str); \
mbr.ptes[N].start_lba = p##N##_start_lba; \
mbr.ptes[N].sector_count = p##N##_sector_count; \
lba_to_chs (p##N##_start_lba, mbr.ptes[N].chs_start_addr); \
lba_to_chs (p##N##_start_lba + p##N##_sector_count - 1, mbr.ptes[N].chs_last_sect_addr);
prompt_partition (0);
prompt_partition (1);
prompt_partition (2);
prompt_partition (3);
mbr.ptes[0].start_lba = p0_start_lba;
mbr.ptes[0].sector_count = p0_sector_count;
lba_to_chs (p0_start_lba, mbr.ptes[0].chs_start_addr);
lba_to_chs (p0_start_lba + p0_sector_count - 1, mbr.ptes[0].chs_last_sect_addr);
mbr.ptes[1].start_lba = p1_start_lba;
mbr.ptes[1].sector_count = p1_sector_count;
lba_to_chs (p1_start_lba, mbr.ptes[1].chs_start_addr);
lba_to_chs (p1_start_lba + p1_sector_count - 1, mbr.ptes[1].chs_last_sect_addr);
mbr.ptes[2].start_lba = p2_start_lba;
mbr.ptes[2].sector_count = p2_sector_count;
lba_to_chs (p2_start_lba, mbr.ptes[2].chs_start_addr);
lba_to_chs (p2_start_lba + p2_sector_count - 1, mbr.ptes[2].chs_last_sect_addr);
mbr.ptes[3].start_lba = p3_start_lba;
mbr.ptes[3].sector_count = p3_sector_count;
lba_to_chs (p3_start_lba, mbr.ptes[3].chs_start_addr);
lba_to_chs (p3_start_lba + p3_sector_count - 1, mbr.ptes[3].chs_last_sect_addr);
prompt_and_setup_partition (0);
prompt_and_setup_partition (1);
prompt_and_setup_partition (2);
prompt_and_setup_partition (3);
mbr.valid_sign[0] = 0x55;
mbr.valid_sign[1] = 0xAA;