Createimg now creates a working 1G partition

This commit is contained in:
aheirman 2021-02-13 13:11:06 +01:00
parent b0824a051b
commit 39b9430cf8
3 changed files with 25 additions and 8 deletions

View file

@ -1,25 +1,31 @@
#!/bin/sh
rm iglunix.img
dd if=../tiny-linux-bootloader/disk of=iglunix.img
exit
TOTAL=`stat -c %s iglunix.img`
SECTOR=$(($TOTAL / 512))
dd if=/dev/zero count=$((3145727 - $SECTOR)) >> iglunix.img
FILE_SIZE=$(stat -c %s iglunix.img)
echo "FILE_SIZE=${FILE_SIZE}"
PARTITION_START=$(($FILE_SIZE / 512))
PARTITION_START=$(($PARTITION_START + 1))
echo "PARTITION_START=${PARTITION_START}"
#create room for a partition
ls -al iglunix.img -h
dd if=/dev/zero bs=1 count=0 seek=1G of=iglunix.img
ls -al iglunix.img -h
echo "o
n
p
1
32256
${PARTITION_START}
a
1
w
" | fdisk iglunix.img
exit
# losetup -o 32256 /dev/loop0 iglunix.img
# mkfs.vfat /dev/loop0
# mount /dev/loop0 ./isoroot