$ dd if=boot.img of=boot.BPB.img bs=512 count=1 1+0 records in 1+0 records out 512 bytes copied, 0.0129819 s, 39.4 kB/s $ od -c boot.BPB.img 0000000 353 < 220 m k f s . f a t \0 002 020 001 \0 0000020 002 \0 002 \0 \0 370 \0 ? \0 377 \0 \0 \0 \0 \0 0000040 \0 340 001 \0 200 001 ) 351 Q 376 004 b o o t 0000060 F A T 1 6 016 037 0000100 276 [ | 254 " 300 t \v V 264 016 273 \a \0 315 020 0000120 ^ 353 360 2 344 315 026 315 031 353 376 T h i s 0000140 i s n o t a b o o t a b l 0000160 e d i s k . P l e a s e 0000200 i n s e r t a b o o t a b l 0000220 e f l o p p y a n d \r \n p r 0000240 e s s a n y k e y t o t 0000260 r y a g a i n . . . \r \n \0 0000300 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 * 0000760 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 U 252 0001000 $ od -A d -j 11 -N 2 -t d2 boot.BPB.img 0000011 512 0000013 $ BPB_BytsPerSec=512 $ od -A d -j 13 -N 1 -t d1 boot.BPB.img 0000013 16 0000014 $ BPB_SecPerClus=16 $ echo $(( $BPB_BytsPerSec * $BPB_SecPerClus )) 8192 $ od -A d -j 14 -N 2 -t d2 boot.BPB.img 0000014 1 0000016 $ BPB_RsvdSecCnt=1 $ od -A d -j 16 -N 1 -t d2 boot.BPB.img 0000016 2 0000017 $ BPB_NumFATs=2 $ od -A d -j 17 -N 2 -t d2 boot.BPB.img 0000017 512 0000019 $ BPB_RootEntCnt=512 $ od -A d -j 19 -N 2 -t d2 boot.BPB.img 0000019 0 0000021 $ od -A d -j 32 -N 4 -t d4 boot.BPB.img 0000032 122880 0000036 $ BPB_TotSec16=0 $ BPB_TotSec32=122880 $ TotSec=$BPB_TotSec32 $ echo $TotSec 122880 $ echo $(( $TotSec * 512 )) 62914560 $ ls -l boot.img -rw-r--r-- 4 brock users 62914560 Feb 19 2017 boot.img $ RootDirSectors=$(( ( ( $BPB_RootEntCnt * 32 ) + ( $BPB_BytsPerSec - 1 ) ) / $BPB_BytsPerSec )) $ echo $RootDirSectors 32 $ od -A d -j 22 -N 2 -t d2 boot.BPB.img 0000022 32 0000024 $ BPB_FATSz16=32 $ FATSz=$BPB_FATSz16 $ FirstDataSector=$(( $BPB_RsvdSecCnt + ( $BPB_NumFATs * $FATSz ) + $RootDirSectors )) $ echo $FirstDataSector 97 $ DataSec=$(( $TotSec - ( $BPB_RsvdSecCnt + ( $BPB_NumFATs * $FATSz ) + $RootDirSectors ) )) $ echo $DataSec 122783 $ CountofClusters=$(( $DataSec / $BPB_SecPerClus )) $ echo $CountofClusters 7673 $ rootDirStart=$(( $BPB_RsvdSecCnt + $BPB_NumFATs * $FATSz )) $ echo $rootDirStart 65 $ echo $RootDirSectors 32 $ dd if=boot.img of=FAT.img bs=512 count=$FATSz skip=$BPB_RsvdSecCnt 32+0 records in 32+0 records out 16384 bytes (16 kB, 16 KiB) copied, 0.00806627 s, 2.0 MB/s $ 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, 16 KiB) copied, 0.00591393 s, 2.8 MB/s $ od -A d -t a boot.rootdir.img ................ 0000800 A C nul O nul P nul Y nul I nul si nul dc2 N nul 0000816 G nul . nul l nul i nul n nul nul nul u nul x nul 0000832 C O P Y I N ~ 1 L I N sp nul nul & can 0000848 S J S J nul nul & can S J [ dle enq I nul nul ................ 0000928 A c nul m nul d nul l nul i nul si nul si n nul 0000944 e nul . nul t nul x nul t nul nul nul nul nul del del 0000960 C M D L I N E sp T X T sp nul nul si etb 0000976 S J S J nul nul si etb S J enq nul bs nul nul nul ................ 0002112 nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul nul * 0016384 $ od -A d -j 800 -N 64 -t a boot.rootdir.img 0000800 A C nul O nul P nul Y nul I nul si nul dc2 N nul 0000816 G nul . nul l nul i nul n nul nul nul u nul x nul 0000832 C O P Y I N ~ 1 L I N sp nul nul & can 0000848 S J S J nul nul & can S J [ dle enq I nul nul 0000864 $ dd if=boot.rootdir.img of=Copying.linux.direntry bs=1 skip=832 count=32 32+0 records in 32+0 records out 32 bytes copied, 0.00852023 s, 3.8 kB/s $ od -A d -t a Copying.linux.direntry 0000000 C O P Y I N ~ 1 L I N sp nul nul & can 0000016 S J S J nul nul & can S J [ dle enq I nul nul 0000032 $ od -A d -j 26 -N 2 -t d2 Copying.linux.direntry 0000026 4187 0000028 $ CLUSTERADD0=4187 $ echo $(( $CLUSTERADD0 * 2 )) 8374 $ od -A d -j 8374 -N 32 -t d2 FAT.img 0008374 4188 4189 -1 4191 4192 4193 4194 4195 0008390 4196 -1 -1 -1 -1 -1 -1 -1 0008406 $ od -A d -j $(( 4187 * 2 )) -N 2 -t d2 FAT.img 0008374 4188 0008376 $ od -A d -j $(( 4188 * 2 )) -N 2 -t d2 FAT.img 0008376 4189 0008378 $ od -A d -j $(( 4189 * 2 )) -N 2 -t d2 FAT.img 0008378 -1 0008380 $ CLUSTERADD0=4187 $ CLUSTERADD1=4188 $ CLUSTERADD2=4189 $ od -A d -j 28 -N 4 -t d4 Copying.linux.direntry 0000028 18693 0000032 $ FILESIZE=18693 $ echo $FirstDataSector 97 $ echo $BPB_SecPerClus 16 $ function DataCluster2Sector() { local result=$(( ( ( $1 - 2 ) * $BPB_SecPerClus ) + $FirstDataSector )) echo "$result" } $ SECTORADD0=`DataCluster2Sector $CLUSTERADD0` $ SECTORADD1=`DataCluster2Sector $CLUSTERADD1` $ SECTORADD2=`DataCluster2Sector $CLUSTERADD2` $ echo $SECTORADD0 $SECTORADD1 $SECTORADD2 67057 67073 67089 $ dd if=boot.img bs=512 skip=$SECTORADD0 count=16 of=copying.LINUX-0 16+0 records in 16+0 records out 8192 bytes (8.2 kB, 8.0 KiB) copied, 0.00293192 s, 2.8 MB/s $ dd if=boot.img bs=512 skip=$SECTORADD1 count=16 of=copying.LINUX-1 16+0 records in 16+0 records out 8192 bytes (8.2 kB, 8.0 KiB) copied, 0.00790882 s, 1.0 MB/s $ dd if=boot.img bs=512 skip=$SECTORADD2 count=16 of=copying.LINUX-2 16+0 records in 16+0 records out 8192 bytes (8.2 kB, 8.0 KiB) copied, 0.00899374 s, 911 kB/s $ cat copying.LINUX-* > copying.LINUX-all $ dd if=copying.LINUX-all bs=$FILESIZE count=1 of=copying.LINUX 1+0 records in 1+0 records out 18693 bytes (19 kB, 18 KiB) copied, 0.00840871 s, 2.2 MB/s $ head copying.LINUX NOTE! This copyright does *not* cover user programs that use kernel services by normal system calls - this is merely considered normal use of the kernel, and does *not* fall under the heading of "derived work". Also note that the GPL below is copyrighted by the Free Software Foundation, but the instance of code that it refers to (the Linux kernel) is copyrighted by me and others who actually wrote it. Also note that the only valid version of the GPL as far as the kernel is concerned is _this_ particular version of the license (ie v2, not $ tail copying.LINUX `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.