1 /////////////////////////////////////////////////////////////////////////
2 // $Id: make_cmos_image.cc,v 1.4 2003/06/07 19:16:55 vruppert Exp $
3 /////////////////////////////////////////////////////////////////////////
5 // Copyright (C) 2001 MandrakeSoft S.A.
9 // 75002 Paris - France
10 // http://www.linux-mandrake.com/
11 // http://www.mandrakesoft.com/
13 // This library is free software; you can redistribute it and/or
14 // modify it under the terms of the GNU Lesser General Public
15 // License as published by the Free Software Foundation; either
16 // version 2 of the License, or (at your option) any later version.
18 // This library is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 // Lesser General Public License for more details.
23 // You should have received a copy of the GNU Lesser General Public
24 // License along with this library; if not, write to the Free Software
25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 // Program which generates sample CMOS image files
34 #include <sys/types.h>
43 unsigned char cmos
[] = {
44 0x29, 0x2b, 0x30, 0x2b, 0x16, 0x0b, 0x00, 0x01,
45 0x01, 0x96, 0x26, 0x02, 0x50, 0x80, 0x00, 0x00,
46 0x40, 0x8f, 0xf0, 0xc0, 0x3f, 0x80, 0x02, 0x00,
47 0x3c, 0x2f, 0x00, 0x4c, 0x0c, 0x10, 0x00, 0x00,
48 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
49 0x00, 0x48, 0x2b, 0x03, 0x03, 0x03, 0x04, 0xce,
50 0x00, 0x3c, 0x19, 0xff, 0xff, 0xf0, 0x00, 0xf0,
51 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x7b
55 unsigned char cmos
[] = {
56 0x29, 0x2b, 0x30, 0x2b, 0x16, 0x0b, 0x00, 0x01,
57 0x01, 0x96, 0x26, 0x02, 0x50, 0x80, 0x00, 0x00,
58 0x40, 0x8f, 0xf0, 0xc0, 0x0f, 0x80, 0x02, 0x00,
59 0x3c, 0x2f, 0x00, 0x1e, 0x00, 0x04, 0xff, 0xff,
60 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
61 0x00, 0x08, 0x08, 0x03, 0x03, 0x03, 0x05, 0xc5,
62 0x00, 0x3c, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x10,
63 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, // 0x21
65 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
66 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
67 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, // 50
68 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
69 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 60
70 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
71 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 70
72 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
77 main(int argc
, char *argv
[])
82 fprintf(stderr
, "usage: %s pathname\n", argv
[0]);
86 fd
= open(argv
[1], O_WRONLY
| O_CREAT
93 perror("trying to open cmos image file to write.\n");
97 ret
= write(fd
, cmos
, sizeof(cmos
));
98 if (ret
!= sizeof(cmos
)) {
99 perror("write() did not write all CMOS data.\n");
102 printf("CMOS data successfuly written to file '%s'.\n", argv
[1]);