1 /*
2 * Copyright (c) 1980, 1986 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
5 */
6
7 #ifndef lint
8 char copyright[] =
9 "@(#) Copyright (c) 1980, 1986 Regents of the University of California.\n\
10 All rights reserved.\n";
11 #endif not lint
12
13 #ifndef lint
14 static char sccsid[] = "@(#)installboot.c 7.2 (Berkeley) 12/16/90";
15 #endif not lint
16
17 #include "sys/param.h"
18 #include "sys/fs.h"
19
20 char bootimage[BBSIZE];
21
main(argc,argv)22 main(argc, argv)
23 int argc;
24 char *argv[];
25 {
26 int fd;
27
28 if (argc != 4) {
29 printf("Usage: installboot bootblock bootprog device\n");
30 exit(1);
31 }
32 fd = open(argv[1], 0);
33 if (fd < 0) {
34 perror(argv[1]);
35 exit(1);
36 }
37 read(fd, bootimage, DEV_BSIZE);
38 close(fd);
39 fd = open(argv[2], 0);
40 if (fd < 0) {
41 perror(argv[2]);
42 exit(1);
43 }
44 read(fd, &bootimage[DEV_BSIZE], BBSIZE - DEV_BSIZE);
45 close(fd);
46 fd = open(argv[3], 1);
47 if (fd < 0) {
48 perror(argv[3]);
49 exit(1);
50 }
51 write(fd, bootimage, BBSIZE);
52 close(fd);
53 }
54