xref: /csrg-svn/sys/vax/mdec/installboot.c (revision 45802)
123140Smckusick /*
229322Smckusick  * Copyright (c) 1980, 1986 Regents of the University of California.
323140Smckusick  * All rights reserved.  The Berkeley software License Agreement
423140Smckusick  * specifies the terms and conditions for redistribution.
523140Smckusick  */
611102Ssam 
723140Smckusick #ifndef lint
823140Smckusick char copyright[] =
929322Smckusick "@(#) Copyright (c) 1980, 1986 Regents of the University of California.\n\
1023140Smckusick  All rights reserved.\n";
1123140Smckusick #endif not lint
1223140Smckusick 
1323140Smckusick #ifndef lint
14*45802Sbostic static char sccsid[] = "@(#)installboot.c	7.2 (Berkeley) 12/16/90";
1523140Smckusick #endif not lint
1623140Smckusick 
17*45802Sbostic #include "sys/param.h"
18*45802Sbostic #include "sys/fs.h"
1911102Ssam 
2011102Ssam char bootimage[BBSIZE];
2111102Ssam 
main(argc,argv)2211102Ssam main(argc, argv)
2311102Ssam 	int argc;
2411102Ssam 	char *argv[];
2511102Ssam {
2611102Ssam 	int fd;
2711102Ssam 
2811102Ssam 	if (argc != 4) {
2911102Ssam 		printf("Usage: installboot bootblock bootprog device\n");
3011102Ssam 		exit(1);
3111102Ssam 	}
3211102Ssam 	fd = open(argv[1], 0);
3311102Ssam 	if (fd < 0) {
3411102Ssam 		perror(argv[1]);
3511102Ssam 		exit(1);
3611102Ssam 	}
3711102Ssam 	read(fd, bootimage, DEV_BSIZE);
3811102Ssam 	close(fd);
3911102Ssam 	fd = open(argv[2], 0);
4011102Ssam 	if (fd < 0) {
4111102Ssam 		perror(argv[2]);
4211102Ssam 		exit(1);
4311102Ssam 	}
4411102Ssam 	read(fd, &bootimage[DEV_BSIZE], BBSIZE - DEV_BSIZE);
4511102Ssam 	close(fd);
4611102Ssam 	fd = open(argv[3], 1);
4711102Ssam 	if (fd < 0) {
4811102Ssam 		perror(argv[3]);
4911102Ssam 		exit(1);
5011102Ssam 	}
5111102Ssam 	write(fd, bootimage, BBSIZE);
5211102Ssam 	close(fd);
5311102Ssam }
54