[C] Change to fdisk (MBR)

This commit is contained in:
user1 2022-06-26 14:34:15 +02:00
parent 150d60168d
commit f318fac487
3 changed files with 35 additions and 7 deletions

1
.gitignore vendored
View file

@ -9,3 +9,4 @@ xnee.xns
out.txt
boot
root
ArchLinuxARM-rpi-armv7-latest.tar.gz

View file

@ -8,16 +8,16 @@ if [[ $EUID -ne 0 ]]; then
exit 0
fi
fdisk -l
sfdisk -l
read -p "Welches Laufwerk soll beschrieben werden?: [/dev/sda|/dev/sdb] " device
[[ -z "${device}" ]] && echo "No device is set! Abort..." && exit 1
echo "Wipe Device ${device} ..."
sleep 5
wipefs -a -f ${device}
sgdisk -o ${device}
echo "Create new Partition type ..."
@ -26,15 +26,32 @@ sleep 5
bootpartitionnummer=1
rootpartitionnummer=2
sgdisk -a 2048 -n ${bootpartitionnummer: -1}::+1024K -c ${bootpartitionnummer: -1}:"BIOS Boot Partition" -t ${bootpartitionnummer: -1}:ef02 ${device}
sgdisk -a 2048 -n ${rootpartitionnummer: -1}:: -c ${rootpartitionnummer: -1}:"Linux filesystem" -t ${rootpartitionnummer: -1}:8300 ${device}
fdisk /dev/sdd <<EOF
o
p
n
p
1
2048
+200M
J
t
c
n
p
2
J
w
EOF
echo "Create and mount the FAT filesystem..."
sleep 5
mkfs.vfat ${device}${bootpartitionnummer}
mkdir boot
mkdir -p boot
mount ${device}${bootpartitionnummer} boot
echo "Create and mount the ext4 filesystem..."
@ -42,14 +59,16 @@ echo "Create and mount the ext4 filesystem..."
sleep 5
mkfs.ext4 ${device}${rootpartitionnummer}
mkdir root
mkdir -p root
mount ${device}${rootpartitionnummer} root
echo "Download and extract the root filesystem..."
sleep 5
if ! [ -f "ArchLinuxARM-rpi-armv7-latest.tar.gz" ]; then
wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-armv7-latest.tar.gz
fi
bsdtar -xpf ArchLinuxARM-rpi-armv7-latest.tar.gz -C root
sync

View file

@ -0,0 +1,8 @@
label: dos
label-id: 0xc8b2f8b8
device: /dev/sdd
unit: sectors
sector-size: 512
/dev/sdd1 : start= 2048, size= 409600, type=c
/dev/sdd2 : start= 411648, size= 60655616, type=83