blacktop/go-apfs

Support for dmgs extracted from IMG4

CRKatri opened this issue · 7 comments

> tar -xf iPhone14,5_15.4.1_19E258_Restore.ipsw 078-29017-016.dmg                 

> file 078-29017-016.dmg 
078-29017-016.dmg: IM4P, ramdisk

> ipsw img4 extract 078-29017-016.dmg           
   • Parsing Im4p             
      • Exracting payload to file 078-29017-016.dmg.payload

> apfs ls 078-29017-016.dmg.payload                           
Error: found unexpected UDIFResourceFile signure: , expected: koly

As you can see from that, the dmgs extracted from an IM4P can be mounted by hdiutil but not parsed by go-apfs.

I didn't know tar could unzip zip?!

I didn't know tar could unzip zip?!

bsdtar from libarchive can, which macOS and *BSD use as their /usr/bin/tar

❯ hdiutil imageinfo 078-26254-029.dmg.payload.dmg
Class Name: CRawDiskImage
Size Information:
        Total Bytes: 124961792
        Compressed Ratio: 1
        Sector Count: 244066
        Total Non-Empty Bytes: 124961792
        Compressed Bytes: 124961792
        Total Empty Bytes: 0
Checksum Type: none
Format: UDRW
partitions:
        partition-scheme: none
        block-size: 512
        appendable: true
        partitions:
                0:
                        partition-name: whole disk
                        partition-start: 0
                        partition-synthesized: true
                        partition-length: 244066
                        partition-hint: Apple_HFSX
                        partition-filesystems:
                                "HFSX":  <======= 👀 
        burnable: true
Format Description: raw read/write
Checksum Value: 
Properties:
        Encrypted: false
        Kernel Compatible: true
        Checksummed: false
        Software License Agreement: false
        Partitioned: false
        Compressed: no
Segments:
        0: 078-26254-029.dmg.payload.dmg
Backing Store Information:
        URL: file://078-26254-029.dmg.payload.dmg
        Name: 078-26254-029.dmg.payload.dmg
        Class Name: CBSDBackingStore
Resize limits (per hdiutil resize -limits):
 min     cur     max 
244066  244066  2486271306

wanna help build a HFS+ parser 😁

Oh. I had just assumed that it was APFS, didn't realize HFS+ was still used.
I'll close this since it's out of scope of this project.

I still think it's cool, I didn't know that either. I think that go-apfs should at least be able to recognize HFS and print out a helpful error message?

Yeah, an error message would be good. file doesn't recognize it so getting any information from it without hdiutil would be good 😃