Add a Makefile target to mount or extract the fat16 fs embedded in ISOs

pull/23/head
Robin Schneider 7 years ago
parent 8eb3d4f571
commit d3186b5a4a
No known key found for this signature in database
GPG Key ID: A81E8006DC95EFE6

1
.gitignore vendored

@ -3,6 +3,7 @@
*.iso
*.iso.orig
*.txt.orig
*.iso*.extract
*.img
*.img.orig
*.img.enc

@ -43,6 +43,7 @@ clean:
*.img.enc.orig *.img.orig *.bat \
*.img \
*.txt.orig
rm -rf *.iso.extract *.iso.orig.extract
# Also remove the large iso images downloaded from remote servers.
really_clean: clean
@ -99,6 +100,7 @@ list_images:
# All the bios update iso images I have checked have had a fat16 filesystem
# embedded in a dos mbr image as the el-torito ISO payload. They also all
# had the same offset to this fat filesystem, so hardcode that offset here.
# The offset value is bytes in decimal.
FAT_OFFSET := 71680
# Some versions of mtools need this flag set to allow them to work with the
@ -273,6 +275,21 @@ $(DEPSDIR)/slice.insert.deps: Makefile
%.dosflash.exe.orig: %.iso.orig
mcopy -m -i $^@@$(FAT_OFFSET) ::FLASH/DOSFLASH.EXE $@
MOUNT_POINT ?= /mnt
MOUNT_OPTIONS ?= loop,ro
# Mount the "embedded" fat file system from a given iso.
%.iso.mount: %.iso
sudo mount -o $(MOUNT_OPTIONS),offset=$(FAT_OFFSET) $< $(MOUNT_POINT)
%.iso.orig.mount: %.iso.orig
sudo mount -o $(MOUNT_OPTIONS),offset=$(FAT_OFFSET) $< $(MOUNT_POINT)
# Extract the "embedded" fat file system from a given iso.
%.iso.extract: %.iso
mcopy -ms -i $^@@$(FAT_OFFSET) :: $@
%.iso.orig.extract: %.iso.orig
mcopy -ms -i $^@@$(FAT_OFFSET) :: $@
## Use the system provided geteltorito script, if there is one
#GETELTORITO := $(shell if type geteltorito >/dev/null; then echo geteltorito; else echo ./geteltorito; fi)

Loading…
Cancel
Save