Wednesday, July 25, 2018

Inspecting an Atari ST hard disk image with Unix / Linux tools

GNU libparted has Atari partition table support since two years ago. For this you will need the disktype and parted programs. Any good Unix should have those (I use Debian GNU/Linux)

Let us try this with a disk image I used for my Ultrasatan device, for example st_mint
Unzip the disk image
 Inspect the diskimage with the disktype program, an excellent disk analysis tool.
disktype st_mint-0.7.img

--- st_mint-0.7.img
Regular file, size 600 MiB (629145600 bytes)
ATARI ST partition map
Partition 1: 128.0 MiB (134201344 bytes, 262112 sectors from 4, bootable)
  Type "BGM" (Big GEMDOS)
  FAT16 file system (hints score 3 of 5, ATARI ST bootable)
    Unusual sector size 4096 bytes
    Volume size 127.9 MiB (134119424 bytes, 16372 clusters of 8 KiB)
Partition 2: 384.0 MiB (402666496 bytes, 786458 sectors from 262116)
  Type "MIX" (Unknown)

Notice the two partitions, first one is of type BGM, the second one is a Minix partition.

Print the partition table parted (this will output some warnings if running as non-root)
parted st_mint-0.7.img print
Partition Table: atari
Disk Flags: 

Number  Start  End    Size   Type     File system  Flags
 1      2048B  134MB  134MB  primary               boot
 2      134MB  537MB  403MB  primary

 Print the partition table with the begin and end of each partition being printed in bytes we will need this to create the loopback devices
parted  st_mint-0.7.img -- unit b print
Partition Table: atari
Disk Flags: 

Number  Start       End         Size        Type     File system  Flags
 1      2048B       134203391B  134201344B  primary               boot
 2      134203392B  536869887B  402666496B  primary

 Now using the beginning and end of each partition in bytes from the line above, create the /dev/loop devices corresponding to each partition:
sudo losetup --find --offset 2048 --sizelimit 134201344 --verbose st_mint-0.7.img

This should give a loopback device
losetup --all
/dev/loop3: []: (/home/manu/Téléchargements/st_mint-0.7.img), offset 2048, sizelimit 134201344
Now let us do a file check on the partition
sudo fsck.vfat /dev/loop3 
fsck.fat 4.1 (2017-01-24)
/dev/loop3: 217 files, 966/16372 clusters
and mount it
sudo mount /dev/loop3 /mnt

looks an Atari ST system inside
ls /mnt
file /mnt/APPS/QED/QED.APP 
/mnt/APPS/QED/QED.APP: Atari ST M68K contiguous executable (txt=189972, dat=16234, bss=103214, sym=0)

when your work is finished, unmount the partition and detach the loop device from the disk image
sudo umount /mnt
sudo losetup --detach /dev/loop3 

Friday, July 20, 2018

Generating a visual history of a git repo

If you haven't met it yet the gource programm really rocks: it generates a OpenGL rendered graph of all the commits of a git project.

You can see the video on real time just by calling the command gource in your git repo, or generate a video of it by piping to ffmpeg

This is the command line I used to generate my own video:

gource --hide filenames --hide files --title "the history of pmc" -s 0.1 --highlight-users -1280x720 -o - | ffmpeg -y -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -preset ultrafast -pix_fmt yuv420p -crf 1 -threads 0 -bf 0 gource.mp4