Rev 3509 | Rev 3520 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3509 | Rev 3511 | ||
|---|---|---|---|
| Line 92... | Line 92... | ||
| 92 | char fstype[8] /* filesystem type */ |
92 | char fstype[8] /* filesystem type */ |
| 93 | padding[448] /* boot code */ |
93 | padding[448] /* boot code */ |
| 94 | uint8_t boot_signature[2] /* boot signature */ |
94 | uint8_t boot_signature[2] /* boot signature */ |
| 95 | """ |
95 | """ |
| 96 | 96 | ||
| - | 97 | EMPTY_SECTOR = """little: |
|
| - | 98 | padding[512] |
|
| - | 99 | """ |
|
| - | 100 | ||
| 97 | def usage(prname): |
101 | def usage(prname): |
| 98 | "Print usage syntax" |
102 | "Print usage syntax" |
| 99 | print prname + " <PATH> <IMAGE>" |
103 | print prname + " <PATH> <IMAGE>" |
| 100 | 104 | ||
| 101 | def main(): |
105 | def main(): |
| Line 142... | Line 146... | ||
| 142 | boot_sector.fstype = "FAT16 " |
146 | boot_sector.fstype = "FAT16 " |
| 143 | boot_sector.boot_signature = [0x55, 0xAA] |
147 | boot_sector.boot_signature = [0x55, 0xAA] |
| 144 | 148 | ||
| 145 | outf.write(boot_sector.pack()) |
149 | outf.write(boot_sector.pack()) |
| 146 | 150 | ||
| - | 151 | empty_sector = xstruct.create(EMPTY_SECTOR) |
|
| - | 152 | ||
| - | 153 | # Reserved sectors (boot_sector.reserved - boot_sector) |
|
| - | 154 | for i in range(1, boot_sector.reserved): |
|
| - | 155 | outf.write(empty_sector.pack()) |
|
| - | 156 | ||
| - | 157 | # FAT tables |
|
| - | 158 | for i in range(0, boot_sector.fats): |
|
| - | 159 | for j in range(0, boot_sector.fat_sectors): |
|
| - | 160 | outf.write(empty_sector.pack()) |
|
| - | 161 | ||
| - | 162 | # Root directory |
|
| - | 163 | for i in range(0, root_size / sector_size): |
|
| - | 164 | outf.write(empty_sector.pack()) |
|
| - | 165 | ||
| - | 166 | # Data |
|
| - | 167 | for i in range(0, size / sector_size): |
|
| - | 168 | outf.write(empty_sector.pack()) |
|
| - | 169 | ||
| 147 | outf.close() |
170 | outf.close() |
| 148 | 171 | ||
| 149 | if __name__ == '__main__': |
172 | if __name__ == '__main__': |
| 150 | main() |
173 | main() |