brock@arden:~/sysadmin/notes$ mkdir tryit2
brock@arden:~/sysadmin/notes$ cd tryit2
brock@arden:~/sysadmin/notes/tryit2$ ln -s ../boot.img .
brock@arden:~/sysadmin/notes/tryit2$ dd if=boot.img of=boot.BPB.img bs=512 count=1
1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.0393583 s, 13.0 kB/s
brock@arden:~/sysadmin/notes/tryit2$ od -A d -j 11 -N 2 -t d2 boot.BPB.img
0000011    512
0000013
brock@arden:~/sysadmin/notes/tryit2$ BPB_BytsPerSec=512
brock@arden:~/sysadmin/notes/tryit2$ od -A d -j 13 -N 1 -t d1 boot.BPB.img 
0000013   16
0000014
brock@arden:~/sysadmin/notes/tryit2$ BPB_SecPerClus=16
brock@arden:~/sysadmin/notes/tryit2$ od -A d -j 16 -N 1 -t d1 boot.BPB.img 
0000016    2
0000017
brock@arden:~/sysadmin/notes/tryit2$ BPB_NumFATs=2
brock@arden:~/sysadmin/notes/tryit2$ od -A d -j 17 -N 2 -t d2 boot.BPB.img 
0000017    512
0000019
brock@arden:~/sysadmin/notes/tryit2$ BPB_RootEntCnt=512
brock@arden:~/sysadmin/notes/tryit2$ od -A d -j 19 -N 2 -t d2 boot.BPB.img 
0000019      0
0000021
brock@arden:~/sysadmin/notes/tryit2$ BPB_TotSec16=0
brock@arden:~/sysadmin/notes/tryit2$ od -A d -j 32 -N 4 -t d4 boot.BPB.img 
0000032      122880
0000036
brock@arden:~/sysadmin/notes/tryit2$ BPB_TotSec32=122880
brock@arden:~/sysadmin/notes/tryit2$ TotSec=$BPB_TotSec32
brock@arden:~/sysadmin/notes/tryit2$ echo $(( $TotSec * $BPB_BytsPerSec ))
62914560
brock@arden:~/sysadmin/notes/tryit2$ ls -lL boot.img 
-rw-r--r-- 2 brock users 62914560 Feb 19 14:48 boot.img
brock@arden:~/sysadmin/notes/tryit2$ RootDirSectors=$(( ( ( $BPB_RootEntCnt * 32 ) + ( $BPB_BytsPerSec - 1 ) ) / $BPB_BytsPerSec ))
brock@arden:~/sysadmin/notes/tryit2$ echo $RootDirSectors
32
brock@arden:~/sysadmin/notes/tryit2$ od -A d -j 22 -N 2 -t d2 boot.BPB.img
0000022     32
0000024
brock@arden:~/sysadmin/notes/tryit2$ BPB_FATSz16=32
brock@arden:~/sysadmin/notes/tryit2$ FATSz=$BPB_FATSz16
brock@arden:~/sysadmin/notes/tryit2$ od -A d -j 14 -N 2 -t d2 boot.BPB.img
0000014      1
0000016
brock@arden:~/sysadmin/notes/tryit2$ BPB_RsvdSecCnt=1
brock@arden:~/sysadmin/notes/tryit2$ FirstDataSector=$(( ( $BPB_RsvdSecCnt + ( $BPB_NumFATs * $FATSz ) + $RootDirSectors ) ))
brock@arden:~/sysadmin/notes/tryit2$ echo $FirstDataSector
97
brock@arden:~/sysadmin/notes/tryit2$ DataSec=$(( $TotSec - ( $BPB_RsvdSecCnt + ( $BPB_NumFATs * $FATSz ) + $RootDirSectors ) ))
brock@arden:~/sysadmin/notes/tryit2$ echo $DataSec
122783
brock@arden:~/sysadmin/notes/tryit2$ echo $(( $DataSec * 512 ))
62864896
brock@arden:~/sysadmin/notes/tryit2$ ls -lL boot.img 
-rw-r--r-- 2 brock users 62914560 Feb 19 14:48 boot.img
brock@arden:~/sysadmin/notes/tryit2$ CountofClusters=$(( $DataSec / $BPB_SecPerClus ))
brock@arden:~/sysadmin/notes/tryit2$ echo $CountofClusters
7673
brock@arden:~/sysadmin/notes/tryit2$ echo This is FAT16
This is FAT16
brock@arden:~/sysadmin/notes/tryit2$ echo $BPB_RsvdSecCnt
1
brock@arden:~/sysadmin/notes/tryit2$ BPB_ResvdSecCnt=$BPB_RsvdSecCnt
brock@arden:~/sysadmin/notes/tryit2$ echo $BPB_ResvdSecCnt
1
brock@arden:~/sysadmin/notes/tryit2$ rootDirStart=$(( $BPB_RsvdSecCnt + $BPB_NumFATs * $FATSz ))
brock@arden:~/sysadmin/notes/tryit2$ echo $rootDirStart
65
brock@arden:~/sysadmin/notes/tryit2$ echo $RootDirSectors
32
brock@arden:~/sysadmin/notes/tryit2$ dd if=boot.img of=boot.rootdir.img bs=512 count=$RootDirSectors skip=$rootDirStart
32+0 records in
32+0 records out
16384 bytes (16 kB) copied, 0.0378088 s, 433 kB/s
brock@arden:~/sysadmin/notes/tryit2$ cksum boot.rootdir.img 
1838819229 16384 boot.rootdir.img
brock@arden:~/sysadmin/notes/tryit2$ od -A d -t a boot.rootdir.img > boot.rootdir.asc
brock@arden:~/sysadmin/notes/tryit2$ od -t x1 boot.rootdir.img | head -12
0000000 62 6f 6f 74 20 20 20 20 20 20 20 08 00 00 c3 45
0000020 72 48 72 48 00 00 c3 45 72 48 00 00 00 00 00 00
0000040 41 6f 00 76 00 65 00 72 00 6c 00 0f 00 47 61 00
0000060 79 00 73 00 00 00 ff ff ff ff 00 00 ff ff ff ff
0000100 4f 56 45 52 4c 41 59 53 20 20 20 10 00 00 37 98
0000120 53 4a 53 4a 00 00 37 98 53 4a 1d 00 00 00 00 00
0000140 e5 74 00 6d 00 70 00 00 00 ff ff 0f 00 18 ff ff
0000160 ff ff ff ff ff ff ff ff ff ff 00 00 ff ff ff ff
0000200 e5 2e 00 64 00 70 00 6b 00 67 00 0f 00 18 2d 00
0000220 64 00 69 00 76 00 65 00 72 00 00 00 74 00 2e 00
0000240 e5 43 00 4f 00 50 00 59 00 49 00 0f 00 18 4e 00
0000260 47 00 2e 00 6c 00 69 00 6e 00 00 00 75 00 78 00
brock@arden:~/sysadmin/notes/tryit2$ od -A d -t a boot.rootdir.img | grep "I   S   S"
0000672   I   S   S   U   E  sp  sp  sp   T   X   T  sp nul   d   E   G
brock@arden:~/sysadmin/notes/tryit2$ od -A d -t a boot.rootdir.img | grep "C   O   P"
0000832   C   O   P   Y   I   N   ~   1   L   I   N  sp nul nul   & can
brock@arden:~/sysadmin/notes/tryit2$ od -j 672 -N 32 -A d -t a boot.rootdir.img 
0000672   I   S   S   U   E  sp  sp  sp   T   X   T  sp nul   d   E   G
0000688   r   H   r   H nul nul   E   G   r   H   q  ht   g nul nul nul
0000704
brock@arden:~/sysadmin/notes/tryit2$ od -j 672 -N 32 -A d -t x1 boot.rootdir.img 
0000672 49 53 53 55 45 20 20 20 54 58 54 20 00 64 45 47
0000688 72 48 72 48 00 00 45 47 72 48 f1 09 67 00 00 00
0000704
brock@arden:~/sysadmin/notes/tryit2$ dd if=boot.rootdir.img of=issue.txt.direntry.txt bs=1 skip=672 count=32
32+0 records in
32+0 records out
32 bytes (32 B) copied, 0.0551883 s, 0.6 kB/s
brock@arden:~/sysadmin/notes/tryit2$ od -A d -j 26 -N 2 -t d2 issue.txt.direntry.txt
0000026   2545
0000028
brock@arden:~/sysadmin/notes/tryit2$ od -A d -j 28 -N 4 -t d4 issue.txt.direntry.txt
0000028         103
0000032
