1 /* $OpenBSD: build.c,v 1.9 2005/05/17 18:48:51 jason Exp $ */ 2 3 /* 4 * Copyright (c) 2004 Theo de Raadt <deraadt@openbsd.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 #include <sys/types.h> 19 #include <fcntl.h> 20 #include <stdio.h> 21 #include <err.h> 22 #include <unistd.h> 23 24 #include "atmel_intersil_fw.h" 25 #include "atmel_rfmd2958-smc_fw.h" 26 #include "atmel_rfmd2958_fw.h" 27 #include "atmel_rfmd_fw.h" 28 29 #include "atmel_at76c503_i3863_fw.h" 30 #include "atmel_at76c503_rfmd_acc_fw.h" 31 #include "atmel_at76c505_rfmd.h" 32 33 void 34 output(const char *name, char *buf, int buflen) 35 { 36 ssize_t rlen; 37 int fd; 38 39 printf("creating %s length %d\n", name, buflen); 40 fd = open(name, O_WRONLY|O_CREAT|O_TRUNC, 0644); 41 if (fd == -1) 42 err(1, "%s", name); 43 44 rlen = write(fd, buf, buflen); 45 if (rlen == -1) 46 err(1, "%s", name); 47 if (rlen != buflen) 48 errx(1, "%s: short write", name); 49 close(fd); 50 } 51 52 53 int 54 main(int argc, char *argv[]) 55 { 56 output("atu-intersil-int", atmel_fw_intersil_int, 57 sizeof(atmel_fw_intersil_int)); 58 output("atu-intersil-ext", atmel_fw_intersil_ext, 59 sizeof(atmel_fw_intersil_ext)); 60 61 output("atu-rfmd2958smc-int", atmel_fw_rfmd2958_smc_int, 62 sizeof(atmel_fw_rfmd2958_smc_int)); 63 output("atu-rfmd2958smc-ext", atmel_fw_rfmd2958_smc_ext, 64 sizeof(atmel_fw_rfmd2958_smc_ext)); 65 66 output("atu-rfmd2958-int", atmel_fw_rfmd2958_int, 67 sizeof(atmel_fw_rfmd2958_int)); 68 output("atu-rfmd2958-ext", atmel_fw_rfmd2958_ext, 69 sizeof(atmel_fw_rfmd2958_ext)); 70 71 output("atu-rfmd-int", atmel_fw_rfmd_int, 72 sizeof(atmel_fw_rfmd_int)); 73 output("atu-rfmd-ext", atmel_fw_rfmd_ext, 74 sizeof(atmel_fw_rfmd_ext)); 75 76 output("atu-at76c503-i3863-int", atmel_at76c503_i3863_fw_int, 77 sizeof(atmel_at76c503_i3863_fw_int)); 78 output("atu-at76c503-i3863-ext", atmel_at76c503_i3863_fw_ext, 79 sizeof(atmel_at76c503_i3863_fw_ext)); 80 81 output("atu-at76c503-rfmd-acc-int", atmel_at76c503_rfmd_acc_fw_int, 82 sizeof(atmel_at76c503_rfmd_acc_fw_int)); 83 output("atu-at76c503-rfmd-acc-ext", atmel_at76c503_rfmd_acc_fw_ext, 84 sizeof(atmel_at76c503_rfmd_acc_fw_ext)); 85 86 output("atu-at76c505-rfmd-int", atmel_at76c505_rfmd_fw_int, 87 sizeof(atmel_at76c505_rfmd_fw_int)); 88 output("atu-at76c505-rfmd-ext", atmel_at76c505_rfmd_fw_ext, 89 sizeof(atmel_at76c505_rfmd_fw_ext)); 90 91 return (0); 92 } 93