makefile now fills part 1 with test pattern and other two formats in EXT2
This commit is contained in:
parent
c8ba7e29e8
commit
d63936c4f5
2 changed files with 33 additions and 4 deletions
32
Makefile
32
Makefile
|
|
@ -8,20 +8,32 @@ DISK_LOOP = /dev/loop690
|
||||||
|
|
||||||
PART1_START_SECTOR = 2048
|
PART1_START_SECTOR = 2048
|
||||||
PART1_END_SECTOR = 4096
|
PART1_END_SECTOR = 4096
|
||||||
|
PART1_START = $$(( $(PART1_START_SECTOR) * 512 ))
|
||||||
|
PART1_SIZE = $$(( ($(PART1_END_SECTOR) - $(PART1_START_SECTOR)) * 512 ))
|
||||||
PART1_ID = 1
|
PART1_ID = 1
|
||||||
PART1_TYPE = 0x9F
|
PART1_TYPE = 0x9F
|
||||||
PART1_LOOP = /dev/loop691
|
PART1_LOOP = /dev/loop691
|
||||||
|
|
||||||
PART2_START_SECTOR = 6144
|
PART2_START_SECTOR = 6144
|
||||||
PART2_END_SECTOR = 71680
|
PART2_END_SECTOR = 71680
|
||||||
|
PART2_START = $$(( $(PART2_START_SECTOR) * 512 ))
|
||||||
|
PART2_SIZE = $$(( ($(PART2_END_SECTOR) - $(PART2_START_SECTOR)) * 512 ))
|
||||||
PART2_ID = 2
|
PART2_ID = 2
|
||||||
PART2_TYPE = 0x83
|
PART2_TYPE = 0x83
|
||||||
|
PART2_FSTYPE = ext2
|
||||||
|
PART2_LABEL = smol
|
||||||
|
PART2_UUID = 11223344-aabb-ccdd-ffee-cafebabed00d
|
||||||
PART2_LOOP = /dev/loop692
|
PART2_LOOP = /dev/loop692
|
||||||
|
|
||||||
PART3_START_SECTOR = 73728s
|
PART3_START_SECTOR = 73728
|
||||||
PART3_END_SECTOR = $$(( ($(DISK_SIZE) / 512) - 1 ))
|
PART3_END_SECTOR = $$(( ($(DISK_SIZE) / 512) - 1 ))
|
||||||
|
PART3_START = $$(( $(PART3_START_SECTOR) * 512 ))
|
||||||
|
PART3_SIZE = $$(( ($(PART3_END_SECTOR) - $(PART3_START_SECTOR)) * 512 ))
|
||||||
PART3_ID = 3
|
PART3_ID = 3
|
||||||
PART3_TYPE = 0x83
|
PART3_TYPE = 0x83
|
||||||
|
PART3_FSTYPE = ext2
|
||||||
|
PART3_LABEL = root
|
||||||
|
PART3_UUID = 44332211-bbaa-ddcc-eeff-cafebabed00d
|
||||||
PART3_LOOP = /dev/loop693
|
PART3_LOOP = /dev/loop693
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
@ -36,10 +48,22 @@ $(DISK):
|
||||||
sudo parted $(DISK_LOOP) mkpart primary $(PART2_START_SECTOR)s $(PART2_END_SECTOR)s # 2 - 32MB small EXT2 partition
|
sudo parted $(DISK_LOOP) mkpart primary $(PART2_START_SECTOR)s $(PART2_END_SECTOR)s # 2 - 32MB small EXT2 partition
|
||||||
sudo parted $(DISK_LOOP) mkpart primary $(PART3_START_SECTOR)s $(PART3_END_SECTOR)s # 3 - "root" EXT2 partition
|
sudo parted $(DISK_LOOP) mkpart primary $(PART3_START_SECTOR)s $(PART3_END_SECTOR)s # 3 - "root" EXT2 partition
|
||||||
# set MBR partition types
|
# set MBR partition types
|
||||||
sudo parted $(DISK_LOOP) type $(PART1_ID) $(PART1_TYPE)
|
sudo parted $(DISK_LOOP) type $(PART1_ID) $(PART1_TYPE) # 1 - 0x9F BSD/OS (BSD/386) as reference to Gundam: The 08th MS Team
|
||||||
sudo parted $(DISK_LOOP) type $(PART2_ID) $(PART2_TYPE)
|
sudo parted $(DISK_LOOP) type $(PART2_ID) $(PART2_TYPE) # 2 - 0x83 Linux
|
||||||
sudo parted $(DISK_LOOP) type $(PART3_ID) $(PART3_TYPE)
|
sudo parted $(DISK_LOOP) type $(PART3_ID) $(PART3_TYPE) # 3 - 0x83 Linux
|
||||||
|
# attach partitions
|
||||||
|
sudo losetup --offset $(PART1_START) --sizelimit $(PART1_SIZE) $(PART1_LOOP) $(DISK)
|
||||||
|
sudo losetup --offset $(PART2_START) --sizelimit $(PART2_SIZE) $(PART2_LOOP) $(DISK)
|
||||||
|
sudo losetup --offset $(PART3_START) --sizelimit $(PART3_SIZE) $(PART3_LOOP) $(DISK)
|
||||||
|
# format partitions
|
||||||
|
python gen/test_pattern.py | sudo dd of=$(PART1_LOOP)
|
||||||
|
sudo mkfs.ext2 -t $(PART2_FSTYPE) -L $(PART2_LABEL) -U $(PART2_UUID) $(PART2_LOOP)
|
||||||
|
sudo mkfs.ext2 -t $(PART3_FSTYPE) -L $(PART3_LABEL) -U $(PART3_UUID) $(PART3_LOOP)
|
||||||
|
# fill EXT2 partitions
|
||||||
# detach loopback devices
|
# detach loopback devices
|
||||||
|
sudo losetup -d $(PART1_LOOP)
|
||||||
|
sudo losetup -d $(PART2_LOOP)
|
||||||
|
sudo losetup -d $(PART3_LOOP)
|
||||||
sudo losetup -d $(DISK_LOOP)
|
sudo losetup -d $(DISK_LOOP)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
|
||||||
5
gen/test_pattern.py
Normal file
5
gen/test_pattern.py
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
import sys
|
||||||
|
from struct import pack
|
||||||
|
|
||||||
|
for i in range (0, 2048):
|
||||||
|
sys.stdout.buffer.write(pack("<I", i) + b'\0'*504 + b'\x45\x4e\x44\x21')
|
||||||
Loading…
Add table
Reference in a new issue