annotate bootmatch/comp_main.c @ 27:9e7ca43275eb

doc/Pirelli-VPM-howto: new article
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 12 Jun 2023 04:21:16 +0000
parents bfcc8180cf3c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This C module is the main for our bootmatch compiler.
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include <sys/types.h>
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdio.h>
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdlib.h>
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include "comp_defs.h"
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 u_char boot_image[BOOT_BLOCK_SIZE];
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 struct range range_list[MAX_RANGES];
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 unsigned range_count;
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 char *output_array_name;
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 main(argc, argv)
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 char **argv;
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 {
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 if (argc != 5) {
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 fprintf(stderr,
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 "usage: %s bin-file ranges-file array-name output-file\n",
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 argv[0]);
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 exit(1);
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 }
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 read_bin_file(argv[1]);
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 read_ranges_file(argv[2]);
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 output_array_name = argv[3];
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 emit_output_file(argv[4]);
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 exit(0);
bfcc8180cf3c bootmatch compiler written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 }