/
bootlacestart.S
1327 lines (946 loc) · 29.9 KB
/
bootlacestart.S
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* bootlacestart.S -- A utility for installing GRLDR boot sectors to MBR/OSBR
* Copyright (C) 2005, 2012 Tinybit(tinybit@tom.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*
* This program is used to generate the GRLDR-INSTALL file.
*
* Use the following shell command to generate the GRLDR-INSTALL file:
*
* cp bootlacestart bootlace.com
*
*/
/* Use the following command to compile and build:
*
* gcc -o bootlacestart.exec -nostdlib -I. -I.. -I../stage1 -Wl,-N -Wl,-s bootlacestart.S
*
*/
//#define ABS(x) (x-_start+0x08048000)
//#define ABS(x) (x)
#define __DOT_COM
.text
.globl _start
_start:
/* command-line arguments:
* bootlace.com [OPTIONS] DEVICE_OR_FILE
*/
# ELF header begin here. Its length is 0x40.
# The ELF64 header is backed up at the end of file, which can be
# used to replace the ELF header for running on 64-bit Linux.
.byte 0x7F, 0x45, 0x4C, 0x46 # ELF magic number
// 7F 45 = jg dos_entry_point
// 4C = decw %sp
// 46 = incw %si
#if 1
.byte 0x01 # 32-bit
.byte 0x01 # little-endian
# not safe for 16-bit DOS code
// it changes word at [BX+DI]
// 01 01 = addw %ax, (%bx, %di)
#else
.byte 0x01 # 32-bit
.byte 0xC1 # corrupt-endian!
# Sorry!
# but safe for 16-bit DOS code
// 01 C1 = addw %ax, %cx
#endif
.byte 0x01 # ELF version
// opcode for ADD
#ifdef __DOT_COM
.byte 0xC0 # pad char
// 01 C0 = addw %ax, %ax
.byte 0x44 # pad char
// incw %sp
.byte 0x4E # pad char
// decw %si
.byte 0xd1,0xe8 // shr ax, 1
.byte 0x29,0x01 // subw %ax, (%bx, %di)
.byte 0xEB, 0x24 # pad char
// jmp invalid_dos_exec
#endif
. = _start + 0x10
.word 2 # e_type = Executable
.word 3 # e_machine = i386
.long 1 # e_version
.long (_start_linux - _start + 0x00400000)
# e_entry
.long (_ph_offset - _start) # e_phoff
.long (_sh_offset - _start) # e_shoff(section header table)
.long 0 # e_flags
.word 0x34 # e_ehsize (ELF header size)
.word 0x20 # e_phentsize(prog header entry size)
.word 1 # e_phnum(prog header entry count)
.word 0x28 # e_shentsize
.word 5 # e_shnum
.word 1 # e_shstrndx
# ELF header end
. = _start + 0x40 // aux dos entry point
#ifdef __DOT_COM
//invalid_dos_exec:
/* this is real mode dos code */
.code16
#define __DOS_16
#include "bootlace.inc"
bios_drive_number:
.long 0xff
#endif
_string_table:
.ascii "\0"
.ascii ".shstrtab\0"
.ascii ".text\0"
.ascii ".data\0"
.ascii ".bss\0"
_string_table_end:
.align 4
_ph_offset:
.long 1 # p_type
.long (_start_linux - _start) # p_offset
.long (_start_linux - _start + 0x00400000)
# p_vaddr
.long (_start_linux - _start + 0x00400000)
# p_paddr
.long (grldr_mbr_start + 0x2000 - _start_linux) # p_filesz
.long (grldr_mbr_start + 0x2000 - _start_linux + (0xBE00 + 0x200)) # p_memszz
.long 7 # p_flags
.long 0x200 # p_align
_ph_offset_end:
_sh_offset:
# SHT_UNDEF section
.long 0 # sh_name = No name
.long 0 # sh_type = Inactive
.long 0 # sh_flags = No flags
.long 0 # sh_addr = No address
.long 0 # sh_offset = No file offset
.long 0 # sh_size = No size
.long 0 # sh_link = No link information
.long 0 # sh_info = No auxiliary information
.long 0 # sh_addralign = No alignment
.long 0 # sh_entsize = No entries
# .shstrtab
.long 1 # sh_name
.long 3 # sh_type = SHT_STRTAB
.long 0 # sh_flags = no write,no alloc,no exec
.long 0 # sh_addr = not present in memory
.long (_string_table - _start)
# sh_offset (where strtab begins at)
.long (_string_table_end - _string_table)
# sh_size (size of the string table)
.long 0 # sh_link
.long 0 # sh_info
.long 1 # sh_addralign
.long 0 # sh_entsize
# .text
.long 0x0b # sh_name
.long 1 # sh_type = SHT_PROGBITS
.long 7 # sh_flags = WRITE,ALLOC, EXEC
.long (_start_linux - _start + 0x00400000)
# sh_addr(in process space)
.long (_start_linux - _start)
# sh_offset(from beginning of file)
.long (grldr_mbr_start + 0x2000 - _start_linux)
# sh_size
.long 0 # sh_link
.long 0 # sh_info
.long 0x200 # sh_addralign
.long 0 # sh_entsize
# .data
.long 0x11 # sh_name
.long 1 # sh_type = SHT_PROGBITS
.long 3 # sh_flags = WRITE, ALLOC
.long (grldr_mbr_start + 0x2000 - _start + 0x00400000)
# sh_addr(in process space)
.long (grldr_mbr_start + 0x2000 - _start)
# sh_offset(from beginning of file)
.long 0 # sh_size (no data present)
.long 0 # sh_link
.long 0 # sh_info
.long 4 # sh_addralign
.long 0 # sh_entsize
# .bss
.long 0x17 # sh_name
.long 8 # sh_type = SHT_NOBITS
.long 3 # sh_flags = WRITE, ALLOC
.long (grldr_mbr_start + 0x2000 - _start + 0x00400000)
# sh_addr(in process space)
.long (grldr_mbr_start + 0x2000 - _start)
# sh_offset(from beginning of file)
.long (0xbe00 + 0x200) # sh_size //mbr_63_sectors
.long 0 # sh_link
.long 0 # sh_info
.long 0x200 # sh_addralign
.long 0 # sh_entsize
_sh_offset_end:
.align 8
_ph_offset_64:
.long 1 # p_type
.long 7 # p_flags
.long (_start_linux - _start) # p_offset
.long 0 # ... hi
.long (_start_linux - _start + 0x00400000)
# p_vaddr
.long 0 # ... hi
.long (_start_linux - _start + 0x00400000)
# p_paddr
.long 0 # ... hi
.long (grldr_mbr_start + 0x2000 - _start_linux) # p_filesz
.long 0 # ... hi
.long (grldr_mbr_start + 0x2000 - _start_linux + (0xBE00 + 0x200))
# p_memszz //mbr_63_sectors
.long 0 # ... hi
.long 0x200 # p_align
.long 0 # ... hi
_ph_offset_64_end:
_sh_offset_64:
# SHT_UNDEF section
.long 0 # sh_name = No name
.long 0 # sh_type = Inactive
.long 0 # sh_flags = No flags
.long 0 # ... hi
.long 0 # sh_addr = No address
.long 0 # ... hi
.long 0 # sh_offset = No file offset
.long 0 # ... hi
.long 0 # sh_size = No size
.long 0 # ... hi
.long 0 # sh_link = No link information
.long 0 # sh_info = No auxiliary information
.long 0 # sh_addralign = No alignment
.long 0 # ... hi
.long 0 # sh_entsize = No entries
.long 0 # ... hi
# .shstrtab
.long 1 # sh_name
.long 3 # sh_type = SHT_STRTAB
.long 0 # sh_flags = no write,no alloc,no exec
.long 0 # ... hi
.long 0 # sh_addr = not present in memory
.long 0 # ... hi
.long (_string_table - _start)
# sh_offset (where strtab begins at)
.long 0 # ... hi
.long (_string_table_end - _string_table)
# sh_size (size of the string table)
.long 0 # ... hi
.long 0 # sh_link
.long 0 # sh_info
.long 1 # sh_addralign
.long 0 # ... hi
.long 0 # sh_entsize
.long 0 # ... hi
# .text
.long 0x0b # sh_name
.long 1 # sh_type = SHT_PROGBITS
.long 7 # sh_flags = WRITE,ALLOC, EXEC
.long 0 # ... hi
.long (_start_linux - _start + 0x00400000)
# sh_addr(in process space)
.long 0 # ... hi
.long (_start_linux - _start)
# sh_offset(from beginning of file)
.long 0 # ... hi
.long (grldr_mbr_start + 0x2000 - _start_linux)
# sh_size
.long 0 # ... hi
.long 0 # sh_link
.long 0 # sh_info
.long 0x200 # sh_addralign
.long 0 # ... hi
.long 0 # sh_entsize
.long 0 # ... hi
# .data
.long 0x11 # sh_name
.long 1 # sh_type = SHT_PROGBITS
.long 3 # sh_flags = WRITE, ALLOC
.long 0 # ... hi
.long (grldr_mbr_start + 0x2000 - _start + 0x00400000)
# sh_addr(in process space)
.long 0 # ... hi
.long (grldr_mbr_start + 0x2000 - _start)
# sh_offset(from beginning of file)
.long 0 # ... hi
.long 0 # sh_size (no data present)
.long 0 # ... hi
.long 0 # sh_link
.long 0 # sh_info
.long 4 # sh_addralign
.long 0 # ... hi
.long 0 # sh_entsize
.long 0 # ... hi
# .bss
.long 0x17 # sh_name
.long 8 # sh_type = SHT_NOBITS
.long 3 # sh_flags = WRITE, ALLOC
.long 0 # ... hi
.long (grldr_mbr_start + 0x2000 - _start + 0x00400000)
# sh_addr(in process space)
.long 0 # ... hi
.long (grldr_mbr_start + 0x2000 - _start)
# sh_offset(from beginning of file)
.long 0 # ... hi
.long (0xbe00 + 0x200) # sh_size //mbr_63_sectors
.long 0 # ... hi
.long 0 # sh_link
.long 0 # sh_info
.long 0x200 # sh_addralign
.long 0 # ... hi
.long 0 # sh_entsize
.long 0 # ... hi
_sh_offset_64_end:
.align 0x200
_start_linux:
/* this is protected mode linux code */
.code32
#undef __DOS_16
#include "bootlace.inc"
option_restore_mbr:
.ascii "--restore-mbr\0"
option_no_backup_mbr:
.ascii "--no-backup-mbr\0"
option_force_backup_mbr:
.ascii "--force-backup-mbr\0"
option_mbr_enable_floppy:
.ascii "--mbr-enable-floppy\0"
option_mbr_disable_floppy:
.ascii "--mbr-disable-floppy\0"
option_mbr_enable_osbr:
.ascii "--mbr-enable-osbr\0"
option_mbr_disable_osbr:
.ascii "--mbr-disable-osbr\0"
option_mbr_no_bpb:
.ascii "--mbr-no-bpb\0"
option_duce:
.ascii "--duce\0"
option_chs_no_tune:
.ascii "--chs-no-tune\0"
option_boot_prevmbr_first:
.ascii "--boot-prevmbr-first\0"
option_boot_prevmbr_last:
.ascii "--boot-prevmbr-last\0"
option_preferred_drive:
.ascii "--preferred-drive=\0"
option_preferred_partition:
.ascii "--preferred-partition=\0"
option_serial_number:
.ascii "--serial-number=\0"
option_install_partition:
.ascii "--install-partition=\0"
option_sectors_per_track:
.ascii "--sectors-per-track=\0"
option_heads:
.ascii "--heads=\0"
option_start_sector:
.ascii "--start-sector=\0"
option_total_sectors:
.ascii "--total-sectors=\0"
option_floppy_partition:
.ascii "--floppy=\0"
option_time_out:
.ascii "--time-out=\0"
option_hot_key:
.ascii "--hot-key=\0"
option_read_only:
.ascii "--read-only\0"
option_floppy:
.ascii "--floppy\0"
option_gpt:
.ascii "--gpt\0"
//option_lba:
// .ascii "--lba\0"
//option_chs:
// .ascii "--chs\0"
//option_fat12:
// .ascii "--fat12\0"
//option_fat16:
// .ascii "--fat16\0"
//option_fat32:
// .ascii "--fat32\0"
//option_ntfs:
// .ascii "--ntfs\0"
//option_ext2:
// .ascii "--ext2\0"
//option_vfat:
// .ascii "--vfat\0"
msg_start:
/* messages begins at here */
msg_ebios_read_failure:
.ascii "\r\nWarning: EBIOS read failure!\r\n\0"
msg_ebios_write_failure:
.ascii "\r\nWarning: EBIOS write failure! Now try standard CHS write, but not reliable.\r\n\0"
msg_no_ebios_support:
.ascii "\r\nWarning: EBIOS not present! It is not reliable running under DOS without EBIOS.\r\n\0"
msg_stdin_too_long:
.ascii "\r\nError: The standard input is too long.\r\n\0"
msg_too_many_parameters:
.ascii "\r\nError: Too many parameters in command line.\r\n\0"
msg_no_args:
.ascii "\r\nError: No command-line arguments specified.\r\n\0"
msg_too_many_files:
.ascii "\r\nError: More than one files specified.\r\n\0"
msg_no_file:
.ascii "\r\nError: No device or file specified.\r\n\0"
msg_option_restore_mbr:
.ascii "\r\nError: Specified --restore-mbr twice.\r\n\0"
msg_option_restore_mbr_with_other:
.ascii "\r\nError: Specified --restore-mbr with other options than --read-only.\r\n\0"
msg_invalid_prev_mbr:
.ascii "\r\nError: previous MBR is invalid, or it is the GRLDR MBR.\r\n\0"
msg_option_backup_mbr:
.ascii "\r\nError: Specified an option twice for backing up MBR.\r\n\0"
msg_option_backup_mbr_with_floppy:
.ascii "\r\nError: Specified --floppy with backing up MBR.\r\n\0"
msg_option_backup_mbr_with_partition:
.ascii "\r\nError: Specified --install-partition with backing up MBR.\r\n\0"
msg_option_mbr_floppy:
.ascii "\r\nError: Specified an option twice for searching floppy.\r\n\0"
msg_option_mbr_floppy_with_floppy:
.ascii "\r\nError: Specified --floppy with MBR searching floppy.\r\n\0"
msg_option_mbr_floppy_with_partition:
.ascii "\r\nError: Specified --install-partition with MBR searching floppy.\r\n\0"
msg_option_mbr_osbr:
.ascii "\r\nError: Specified an option twice for booting osbr.\r\n\0"
msg_option_mbr_osbr_with_floppy:
.ascii "\r\nError: Specified --floppy with booting osbr.\r\n\0"
msg_option_mbr_osbr_with_partition:
.ascii "\r\nError: Specified --install-partition with booting osbr.\r\n\0"
msg_option_mbr_bpb:
.ascii "\r\nError: Specified an option twice for mbr-bpb.\r\n\0"
msg_option_mbr_bpb_with_floppy:
.ascii "\r\nError: Specified --floppy with mbr-bpb.\r\n\0"
msg_option_mbr_bpb_with_partition:
.ascii "\r\nError: Specified --install-partition with mbr-bpb.\r\n\0"
msg_option_duce:
.ascii "\r\nError: Specified --duce twice.\r\n\0"
msg_option_duce_with_floppy:
.ascii "\r\nError: Specified --floppy with --duce.\r\n\0"
msg_option_duce_with_partition:
.ascii "\r\nError: Specified --install-partition with --duce.\r\n\0"
msg_option_chs_no_tune:
.ascii "\r\nError: Specified --chs-no-tune twice.\r\n\0"
msg_option_chs_no_tune_with_floppy:
.ascii "\r\nError: Specified --floppy with --chs-no-tune.\r\n\0"
msg_option_chs_no_tune_with_partition:
.ascii "\r\nError: Specified --install-partition with --chs-no-tune.\r\n\0"
msg_option_boot_prevmbr:
.ascii "\r\nError: Specified an option twice for booting prevmbr.\r\n\0"
msg_option_boot_prevmbr_with_floppy:
.ascii "\r\nError: Specified --floppy with booting prevmbr.\r\n\0"
msg_option_boot_prevmbr_with_partition:
.ascii "\r\nError: Specified --install-partition with booting prevmbr.\r\n\0"
msg_option_preferred_drive:
.ascii "\r\nError: Specified an option twice for preferred drive.\r\n\0"
msg_option_preferred_drive_with_floppy:
.ascii "\r\nError: Specified --floppy with preferred drive.\r\n\0"
msg_option_preferred_drive_with_partition:
.ascii "\r\nError: Specified --install-partition with preferred drive.\r\n\0"
msg_option_preferred_partition:
.ascii "\r\nError: Specified an option twice for preferred partition.\r\n\0"
msg_option_preferred_partition_with_floppy:
.ascii "\r\nError: Specified --floppy with preferred partition.\r\n\0"
msg_option_preferred_partition_with_partition:
.ascii "\r\nError: Specified --install-partition with preferred partition.\r\n\0"
msg_option_serial_number:
.ascii "\r\nError: Specified an option twice for disk serial number.\r\n\0"
msg_option_serial_number_with_floppy:
.ascii "\r\nError: Specified --floppy with disk serial number.\r\n\0"
msg_option_serial_number_with_partition:
.ascii "\r\nError: Specified --install-partition with disk serial number.\r\n\0"
msg_option_install_partition:
.ascii "\r\nError: Specified an option twice for install partition.\r\n\0"
msg_option_install_partition_with_floppy:
.ascii "\r\nError: Specified --floppy with install partition.\r\n\0"
//msg_option_install_partition_not_implemented:
// .ascii "\r\nSorry! --install-partition not yet implemented with this release.\r\n\0"
msg_option_time_out:
.ascii "\r\nError: Specified an option twice for time out.\r\n\0"
msg_option_time_out_with_floppy:
.ascii "\r\nError: Specified --floppy with time out.\r\n\0"
msg_option_time_out_with_partition:
.ascii "\r\nError: Specified --install-partition with time out.\r\n\0"
//msg_option_time_out_without_prevmbr:
// .ascii "\r\nError: Specified --time-out without specifying --boot-prevmbr-first.\r\n\0"
msg_option_hot_key:
.ascii "\r\nError: Specified an option twice for hot key.\r\n\0"
msg_option_hot_key_with_floppy:
.ascii "\r\nError: Specified --floppy with hot key.\r\n\0"
msg_option_hot_key_with_partition:
.ascii "\r\nError: Specified --install-partition with hot key.\r\n\0"
//msg_option_hot_key_without_prevmbr:
// .ascii "\r\nError: Specified --hot-key without specifying --boot-prevmbr-first.\r\n\0"
msg_option_sectors_per_track:
.ascii "\r\nError: Specified an option twice for sectors per track.\r\n\0"
msg_option_sectors_per_track_with_partition:
.ascii "\r\nError: Specified --install-partition with sectors per track.\r\n\0"
msg_option_sectors_per_track_for_mbr:
.ascii "\r\nError: Specified --sectors-per-track for a hard drive.\r\n\0"
msg_option_heads:
.ascii "\r\nError: Specified an option twice for heads.\r\n\0"
msg_option_heads_with_partition:
.ascii "\r\nError: Specified --install-partition with --heads.\r\n\0"
msg_option_heads_for_mbr:
.ascii "\r\nError: Specified --heads for a hard drive.\r\n\0"
msg_option_start_sector:
.ascii "\r\nError: Specified an option twice for start sector.\r\n\0"
msg_option_start_sector_with_partition:
.ascii "\r\nError: Specified --install-partition with --start-sector.\r\n\0"
msg_option_start_sector_for_mbr:
.ascii "\r\nError: Specified --start-sector for a hard drive.\r\n\0"
msg_option_total_sectors:
.ascii "\r\nError: Specified an option twice for total sectors.\r\n\0"
msg_option_total_sectors_with_partition:
.ascii "\r\nError: Specified --install-partition with --total-sectors.\r\n\0"
msg_option_total_sectors_for_mbr:
.ascii "\r\nError: Specified --total-sectors for a hard drive.\r\n\0"
msg_option_read_only:
.ascii "\r\nError: Specified an option twice for read only.\r\n\0"
msg_option_floppy:
.ascii "\r\nError: Specified an option twice for --floppy.\r\n\0"
msg_option_gpt:
.ascii "\r\nError: Specified an option twice for --gpt.\r\n\0"
//msg_option_lba:
// .ascii "\r\nError: Specified an option twice for lba-chs mode.\r\n\0"
//msg_option_lba_for_mbr:
// .ascii "\r\nError: Specified --lba for a hard drive.\r\n\0"
//msg_option_fstypes_for_mbr:
// .ascii "\r\nError: Specified file system types for a hard-drive mbr device.\r\n\0"
msg_partition_without_drive:
.ascii "\r\nError: Preferred partition without preferred drive.\r\n\0"
msg_partition_start:
.ascii "\r\nError: For a single partition you must specify --start-sector to non-zero.\r\n\0"
msg_floppy_start:
.ascii "\r\nError: For a real floppy you must specify --start-sector to 0.\r\n\0"
msg_invalid_number:
.ascii "\r\nError: Invalid number format or invalid value for the specified option.\r\n\0"
msg_invalid_option:
.ascii "\r\nError: Invalid option.\r\n\0"
msg_open_file_rw:
.ascii "\r\nError: Cannot open file for read/write access.\r\n\0"
msg_open_file_ro:
.ascii "\r\nError: Cannot open file for read-only access.\r\n\0"
msg_read_file:
.ascii "\r\nError: Read file failed.\r\n\0"
msg_lseek_file:
.ascii "\r\nError: Rewind file(lseek) failed.\r\n\0"
msg_write_file:
.ascii "\r\nError: Write file failed.\r\n\0"
msg_close_file:
.ascii "\r\nFatal! Close file failed. Please backup your disk in case it becomes unusable.\r\n\0"
msg_boot_signature_mbr:
.ascii "\r\nError: No boot signature(55 AA). Must specify --floppy explicitly for floppy.\r\n\0"
msg_invalid_partition_table:
.ascii "\r\nError: Invalid partition table. Must specify --floppy explicitly for floppy.\r\n\0"
msg_floppy_partition_table:
.ascii "\r\nError: Specified --floppy for DEVICE_OR_FILE that has a valid partition table.\r\n\0"
msg_sectors_per_track:
.ascii "\r\nError: Too few sectors to hold GRLDR.MBR.\r\n\0"
msg_geometry_S:
.ascii "\r\nDisk geometry calculated according to the partition table:\r\n\r\n"
.ascii " Sectors per track = \0"
msg_geometry_H:
.ascii ", Number of heads = \0"
msg_success:
.ascii "\r\nSuccess.\r\n\0"
msg_success_create_triple_mbr:
.ascii "\r\nSuccess. Triple MBR installed.\r\n\0"
msg_success_cancel_triple_mbr:
.ascii "\r\nTriple MBR cancelled. Original partition layout restored.\r\n\0"
//msg_fstype_fat32_deny:
// .ascii "\r\nError: Filesystem type is FAT32 but --fat32 was not specified.\r\n\0"
msg_fstype_fat32_allow:
.ascii "\r\nFilesystem type is FAT32.\r\n\0"
//msg_fstype_ntfs_deny:
// .ascii "\r\nError: Filesystem type is NTFS but --ntfs was not specified.\r\n\0"
msg_fstype_ntfs_allow:
.ascii "\r\nFilesystem type is NTFS.\r\n\0"
//msg_fstype_fat12_deny:
// .ascii "\r\nError: Filesystem type is FAT12 but --fat12 was not specified.\r\n\0"
msg_fstype_fat12_allow:
.ascii "\r\nFilesystem type is FAT12.\r\n\0"
//msg_fstype_fat16_deny:
// .ascii "\r\nError: Filesystem type is FAT16 but --fat16 was not specified.\r\n\0"
msg_fstype_fat16_allow:
.ascii "\r\nFilesystem type is FAT16.\r\n\0"
//msg_fstype_ext2_deny:
// .ascii "\r\nError: Filesystem type is EXT2 but --ext2 was not specified.\r\n\0"
msg_fstype_ext2_allow:
.ascii "\r\nFilesystem type is EXT2.\r\n\0"
//msg_fstype_exfat_deny:
// .ascii "\r\nError: Filesystem type is EXFAT but --exfat was not specified.\r\n\0"
msg_fstype_exfat_allow:
.ascii "\r\nFilesystem type is EXFAT.\r\n\0"
msg_unsupported_fstype:
.ascii "\r\nError: Unsupported filesystem type.\r\n\0"
msg_fstype_mbr_deny:
.ascii "\r\nError: Cannot overwrite the MBR of a harddrive(or HD image) with --floppy.\r\n\0"
//msg_no_ntfs_boot_record:
// .ascii "\r\nError: Filesystem type is NTFS, but no ntfs boot record was found.\r\n\0"
msg_no_enough_memory:
.ascii "\r\nError: No enough memory.\r\n\0"
msg_install_partition_not:
.ascii "\r\n\r\nError: Specified install partition not exist.\r\n\0"
msg_gpt_partition_not:
.ascii "\r\n\r\nError: Specified gpt partition not exist.\r\n\0"
msg_cannot_install_gpt_partition:
.ascii "\r\n\r\nError: Cannot install grldr.mbr to a GPT partition.\r\n\0"
msg_disk_Information:
.ascii "\r\nHD"
msg_disk:
.byte 0x30
msg_d:
.ascii ","
msg_partition:
.byte 0x30,0x20,0x20
msg_Information:
.ascii " \0"
scS_c_s:
.byte 0x30,0x30
scS_c:
.byte 0x30
scS_z_s:
.byte 0x20,0x20,0x20,0x20
scS_z_w:
.byte 0x20
scS_d:
.ascii "."
scS_x:
.byte 0x20,0x20
scM:
.ascii "Mb\0"
msg_Wait_for_key:
.ascii "\r\n\r\nPress 'y' to continue, other exit.\r\n\0"
msg_usage:
.ascii "\r\nBOOTLACE writes GRLDR BOOT RECORD to MBR or to the boot area of a file system.\r\n"
.ascii "Usage: bootlace.com [OPTIONS] DEVICE_OR_FILE\r\n"
.ascii "Options: --read-only, --floppy[=N], --boot-prevmbr-first, --boot-prevmbr-last,\r\n"
.ascii "--no-backup-mbr, --force-backup-mbr, --mbr-enable-floppy, --mbr-disable-floppy,\r\n"
.ascii "--mbr-enable-osbr, --mbr-disable-osbr, --duce, --time-out=T, --hot-key=K, \r\n"
.ascii "--preferred-drive=D, --preferred-partition=P, --sectors-per-track=S, --heads=H,\r\n"
// .ascii "--start-sector=B, --total-sectors=C, --install-partition=I, --lba, --chs,\r\n"
// .ascii "--fat12, --fat16, --fat32, --vfat, --ntfs, --ext2, --exfat, --serial-number=SN,\r\n"
.ascii "--start-sector=B, --total-sectors=C, --install-partition=I, --serial-number=SN,\r\n"
.ascii "--restore-mbr, --mbr-no-bpb, --chs-no-tune, --gpt\r\n"
.ascii "DEVICE_OR_FILE: Filename of the device or image. For DOS, a BIOS drive number\r\n"
.ascii "(in hex 0xHH or decimal DDD format)can be used to access the drive.\r\n\0"
msg_end:
.align 4
Cmax: .long 0
Hmax: .long 0
Smax: .long 0
i: .long 0
j: .long 0
X: .long 0
Y: .long 0
C: # long, but high word is always 0
.word 0, 0
.word 0, 0
.word 0, 0
.word 0, 0
.word 0, 0
.word 0, 0
.word 0, 0
.word 0, 0
.word 0, 0
H:
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
.long 0
H8: .long 0
L:
.long 0, 0
.long 0, 0
.long 0, 0
.long 0, 0
.long 0, 0
.long 0, 0
.long 0, 0
.long 0, 0
L8: .long 0, 0
probed_sectors_per_track:
.long 0
probed_heads:
.long 0
mbr_free_sectors:
.long 0
number_digits:
.ascii " \0" /* 10 spaces */
delimit_space:
.ascii " \0" /* 4 spaces */
delimit_newline:
.ascii "\n\0"
.align 4
restore_mbr:
.long 0
backup_mbr:
/* 0 no backup, Will not touch PREV_MBR
* 1 autobackup
* 2 forcebackup. Will overwrite the old PREV_MBR
*/
.long 1 /* default is autobackup */
mbr_floppy:
/* 0 enable floppy
* 1 disable floppy
* 2 enable floppy
*/
.long 0 /* default is enable floppy */
mbr_osbr:
/* 0 enable osbr
* 1 disable osbr
* 2 enable osbr
*/
.long 0 /* default is enable osbr */
mbr_bpb:
/* 0 enable bpb
* 1 disable bpb
* 2 enable bpb
*/
.long 0 /* default is enable bpb */
duce: