Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-boot/cromwell/files: cromwell-2.40-r3-cvs-fixes.patch
Date: Sat, 07 Jun 2008 15:27:17
Message-Id: E1K50Jx-0007JP-6t@stork.gentoo.org
1 vapier 08/06/07 15:27:09
2
3 Added: cromwell-2.40-r3-cvs-fixes.patch
4 Log:
5 Add fixes from upstream #204026 by Alan Kingsley.
6 (Portage version: 2.2_pre5.spank.spunk)
7
8 Revision Changes Path
9 1.1 sys-boot/cromwell/files/cromwell-2.40-r3-cvs-fixes.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-boot/cromwell/files/cromwell-2.40-r3-cvs-fixes.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-boot/cromwell/files/cromwell-2.40-r3-cvs-fixes.patch?rev=1.1&content-type=text/plain
13
14 Index: cromwell-2.40-r3-cvs-fixes.patch
15 ===================================================================
16 --- cromwell-2.40/boot/LoadLinux.c
17 +++ cromwell-2.40/boot/LoadLinux.c
18 @@ -33,10 +33,12 @@
19
20
21 void ExittoLinux(CONFIGENTRY *config);
22 -void startLinux(void* initrdStart, unsigned long initrdSize, const char* appendLine);
23 +void startLinux(void* initrdStart, unsigned long initrdSize, const char* appendLine, unsigned int entry);
24 void setup(void* KernelPos, void* PhysInitrdPos, unsigned long InitrdSize, const char* kernel_cmdline);
25 void I2CRebootSlow(void);
26
27 +void try_elf_boot (char* data, int len);
28 +
29
30 void BootPrintConfig(CONFIGENTRY *config) {
31 int CharsProcessed=0, CharsSinceNewline=0, Length=0;
32 @@ -69,6 +71,10 @@
33 unsigned int nSizeHeader=((*(kernelOrg + 0x01f1))+1)*512;
34 memcpy((u8 *)KERNEL_SETUP, kernelOrg, nSizeHeader);
35 memcpy((u8 *)KERNEL_PM_CODE,(kernelOrg+nSizeHeader),kernelSize-nSizeHeader);
36 +
37 + /* Try to execute a pure ELF binary here, using the etherboot
38 + * code. This is required for ELF kernels, such as FreeBSD */
39 + try_elf_boot ((char*)kernelOrg, kernelSize);
40 }
41
42
43 @@ -313,9 +319,15 @@
44 configLoaded=1;
45 break;
46 }
47 + dwConfigSize = BootIso9660GetFile(cdromId,"/linuxboot.cfg", (u8 *)KERNEL_SETUP, 0x800);
48 + if (dwConfigSize>0) {
49 + configLoaded=1;
50 + break;
51 + }
52 wait_ms(250);
53 }
54
55 + //We couldn't read the disk, so we eject the drive so the user can insert one.
56 if (!configLoaded) {
57 //Needs to be changed for non-xbox drives, which don't have an eject line
58 //Need to send ATA eject command.
59 @@ -326,20 +338,29 @@
60 printk("\2Please insert CD and press Button A\n\n");
61
62 while(1) {
63 + // Make button 'A' close the DVD tray
64 if (risefall_xpad_BUTTON(TRIGGER_XPAD_KEY_A) == 1) {
65 - I2CTransmitWord(0x10, 0x0c01); // close DVD tray
66 + I2CTransmitWord(0x10, 0x0c01);
67 wait_ms(500);
68 break;
69 }
70 - wait_ms(10);
71 -
72 - //Keep trying to read, in case somebody puts the tray in manually, without pressing A
73 - dwConfigSize = BootIso9660GetFile(cdromId,"/linuxboo.cfg", (u8 *)KERNEL_SETUP, 0x800);
74 - if (dwConfigSize>0) {
75 - configLoaded=1;
76 + else if (DVD_TRAY_STATE == DVD_CLOSING) {
77 + //It's an xbox drive, and somebody pushed the tray in manually
78 + wait_ms(500);
79 break;
80 }
81 - }
82 + else if (BootIso9660GetFile(cdromId,"/linuxboo.cfg", (u8 *)KERNEL_SETUP, 0x800)>0) {
83 + //It isnt an xbox drive, and somebody pushed the tray in manually, and
84 + //the cd is valid.
85 + break;
86 + }
87 + else if (BootIso9660GetFile(cdromId,"/linuxboot.cfg", (u8 *)KERNEL_SETUP, 0x800)>0) {
88 + break;
89 + }
90 + wait_ms(10);
91 + }
92 +
93 + wait_ms(250);
94
95 VIDEO_ATTR=0xffffffff;
96
97 @@ -351,6 +372,11 @@
98 configLoaded=1;
99 break;
100 }
101 + dwConfigSize = BootIso9660GetFile(cdromId,"/linuxboot.cfg", (u8 *)KERNEL_SETUP, 0x800);
102 + if (dwConfigSize>0) {
103 + configLoaded=1;
104 + break;
105 + }
106 wait_ms(250);
107 }
108 }
109 @@ -423,7 +449,7 @@
110 //Try for 4 seconds.
111 I2CTransmitWord(0x10, 0x0c01); // close DVD tray
112 for (n=0;n<16;++n) {
113 - if((BootIso9660GetFile(cdromId,"/image.bin", (u8 *)KERNEL_SETUP, 0x10)) >=0 ) {
114 + if((BootIso9660GetFile(cdromId,"/image.bin", (u8 *)KERNEL_PM_CODE, 0x10)) >=0 ) {
115 cdPresent=1;
116 break;
117 }
118 @@ -454,7 +480,7 @@
119
120 // wait until the media is readable
121 while(1) {
122 - if((BootIso9660GetFile(cdromId,"/image.bin", (u8 *)KERNEL_SETUP, 0x10)) >=0 ) {
123 + if((BootIso9660GetFile(cdromId,"/image.bin", (u8 *)KERNEL_PM_CODE, 0x10)) >=0 ) {
124 break;
125 }
126 wait_ms(200);
127 @@ -462,7 +488,7 @@
128 }
129 printk("CDROM: ");
130 printk("Loading bios image from CDROM:/image.bin. \n");
131 - dwConfigSize=BootIso9660GetFile(cdromId, "/image.bin", (u8 *)KERNEL_PM_CODE, 256*1024);
132 + dwConfigSize=BootIso9660GetFile(cdromId, "/image.bin", (u8 *)KERNEL_PM_CODE, 256*1024);
133
134 if( dwConfigSize < 0 ) { //It's not there
135 printk("image.bin not found on CDROM... Halting\n");
136 @@ -508,12 +534,12 @@
137 VIDEO_ATTR=0xff9f9fbf;
138 printk(sz);
139 }
140 - I2cSetFrontpanelLed(I2C_LED_RED0 | I2C_LED_RED1 | I2C_LED_RED2 | I2C_LED_RED3 );
141 - startLinux((void*)INITRD_START, dwInitrdSize, config->szAppend);
142 + setLED("rrrr");
143 + startLinux((void*)INITRD_START, dwInitrdSize, config->szAppend, 0x100000);
144 }
145
146
147 -void startLinux(void* initrdStart, unsigned long initrdSize, const char* appendLine)
148 +void startLinux(void* initrdStart, unsigned long initrdSize, const char* appendLine, unsigned int entry)
149 {
150 int nAta=0;
151 // turn off USB
152 @@ -535,10 +561,7 @@
153 BootIdeSetTransferMode(1, 0x40 | nAta);
154
155 // orange, people seem to like that colour
156 - I2cSetFrontpanelLed(
157 - I2C_LED_GREEN0 | I2C_LED_GREEN1 | I2C_LED_GREEN2 | I2C_LED_GREEN3 |
158 - I2C_LED_RED0 | I2C_LED_RED1 | I2C_LED_RED2 | I2C_LED_RED3
159 - );
160 + setLED("oooo");
161
162 // Set framebuffer address to final location (for vesafb driver)
163 (*(unsigned int*)0xFD600800) = (0xf0000000 | ((xbox_ram*0x100000) - FB_SIZE));
164 @@ -549,6 +572,8 @@
165 // clear idt area
166 memset((void*)IDT_LOC,0x0,1024*8);
167
168 + __asm__ ("movl %0,%%ebx" : : "a" (entry)); /* ebx = entry */
169 +
170 __asm __volatile__ (
171 "wbinvd\n"
172
173 @@ -597,13 +622,15 @@
174 // Set the stack pointer to give us a valid stack
175 "movl $0x03BFFFFC, %esp \n"
176
177 - "xor %ebx, %ebx \n"
178 "xor %eax, %eax \n"
179 "xor %ecx, %ecx \n"
180 "xor %edx, %edx \n"
181 "xor %edi, %edi \n"
182 "movl $0x90000, %esi\n" // kernel setup area
183 - "ljmp $0x10, $0x100000\n" // Jump to Kernel protected mode entry
184 + "pushl $0x10\n"
185 + "pushl %ebx\n" // 0x10:ebx is the entry point
186 + "xor %ebx,%ebx\n" // clean leftover ebx (held entry point)
187 + ".byte 0xcb\n " // retf
188 );
189
190 // We are not longer here, we are already in the Linux loader, we never come back here
191 --- cromwell-2.40/boot_rom/bootrom.ld
192 +++ cromwell-2.40/boot_rom/bootrom.ld
193 @@ -45,6 +45,7 @@
194 .rodata ( RAM_CODE + SIZEOF(.text) + SIZEOF(.data) ) : AT ( SIZEOF(.low_rom) + SIZEOF(.text) + SIZEOF(.data)) {
195 *(.rodata);
196 *(.rodata.str1.1);
197 + *(.rodata.str1.4);
198 *(.rodata.str1.32);
199 *(.rodata.cst4);
200 *(.rodata.cst8);
201 --- cromwell-2.40/drivers/ide/BootHddKey.c
202 +++ cromwell-2.40/drivers/ide/BootHddKey.c
203 @@ -5,13 +5,8 @@
204 #include <stdarg.h>
205 //#include <string.h>
206
207 -
208 -
209 void HMAC_hdd_calculation(int version,unsigned char *HMAC_result, ... );
210
211 -extern size_t strlen(const char * s);
212 -
213 -
214 int copy_swap_trim(unsigned char *dst, unsigned char *src, int len)
215 {
216 unsigned char tmp;
217 --- cromwell-2.40/drivers/video/encoder.h
218 +++ cromwell-2.40/drivers/video/encoder.h
219 @@ -21,13 +21,13 @@
220 #define NUM_CONEXANT_REGS 0x69
221 #define MAX_ENCODER_REGS 256
222
223 -#define u8 unsigned char
224 #define U032 long
225 #ifndef encoder_h
226 #define encoder_h
227
228 //#include <linux/xboxfbctl.h>
229 #include "VideoInitialization.h"
230 +#include "boot.h"
231
232 typedef struct {
233 double m_dHzBurstFrequency;
234 --- cromwell-2.40/drivers/video/focus.c
235 +++ cromwell-2.40/drivers/video/focus.c
236 @@ -13,6 +13,7 @@
237 */
238 #include "focus.h"
239 #include "encoder.h"
240 +#include "boot.h"
241
242 typedef struct _focus_pll_settings{
243 long dotclock;
244 --- cromwell-2.40/etherboot/core/Makefile
245 +++ cromwell-2.40/etherboot/core/Makefile
246 @@ -1,4 +1,4 @@
247
248 -O_TARGET := nfs.o nic.o osloader.o proto_tftm.o xbox_misc.o xbox_pci.o etherboot_config.o xbox_main.o
249 +O_TARGET := nfs.o nic.o osloader.o proto_tftm.o xbox_misc.o xbox_pci.o etherboot_config.o xbox_main.o exec_elf.o
250
251 include $(TOPDIR)/Rules.make
252 --- cromwell-2.40/etherboot/core/exec_elf.c
253 +++ cromwell-2.40/etherboot/core/exec_elf.c
254 @@ -0,0 +1,22 @@
255 +#include "etherboot.h"
256 +
257 +/*
258 + * This is a helper function; it tries to execute an ELF image using
259 + * the Etherboot code. This is because *BSD kernels are raw ELF files,
260 + * which are unsupported when booting from CD-ROM or disk.
261 + */
262 +void
263 +try_elf_boot (char* image, int len)
264 +{
265 + os_download_t os_download;
266 +
267 + /* do nothing if the ELF magic mismatches */
268 + if (*(int*)image != 0x464c457f)
269 + return;
270 +
271 + os_download = probe_image (image, len);
272 + if (os_download == 0)
273 + return;
274 +
275 + os_download (image, len, 1);
276 +}
277 --- cromwell-2.40/fs/cdrom/iso9660.c
278 +++ cromwell-2.40/fs/cdrom/iso9660.c
279 @@ -10,7 +10,11 @@
280 2004-07-22 "Edgar Hucek"<hostmaster@×××××××.at> Created
281 */
282
283 +#ifndef STANDALONE
284 #include "boot.h"
285 +#else
286 +# define printk printf
287 +#endif
288 #include "iso_fs.h"
289
290 int isupper( int ch )
291 @@ -96,25 +100,31 @@
292 sprintf(newfilename, "%s/",filename);
293 iso9660_name_translate(newfilename + strlen(newfilename),
294 dir->name, (unsigned char)dir->name_len[0]);
295 -// printk("Read : Sector %d Filename %s %d\n",
296 -// *((unsigned long *)(dir->extent)), newfilename,
297 -// (unsigned char)dir->ext_attr_length[0]);
298 +#ifdef DEBUG_ISO
299 + printk("Read : Sector %d Filename %s %d\n",
300 + *((unsigned long *)(dir->extent)), newfilename,
301 + (unsigned char)dir->ext_attr_length[0]);
302 +#endif
303 }
304
305 if(strlen(newfilename) <= strlen(search)) {
306 if(memcmp(newfilename, search, strlen(search)) == 0) {
307 sect = *((unsigned long *)(dir->extent));
308 memcpy(dir_found, dir, sizeof(struct iso_directory_record));
309 -// printk("Found : Sector %d Directory %s Filename %s %d %d \n",
310 -// sect, newfilename, search,
311 -// strlen(newfilename), strlen(search));
312 +#ifdef DEBUG_ISO
313 + printk("Found : Sector %d Directory %s Filename %s %d %d \n",
314 + sect, newfilename, search,
315 + strlen(newfilename), strlen(search));
316 +#endif
317 // free(newfilename);
318 // free(buffer);
319 return sect;
320 }
321 }
322 if((*((char *)(dir->flags)) & IS_DIR) && (*((unsigned char *)(dir->name_len)) > 1)) {
323 -// printk("Directory %s Filename %s\n", newfilename, search);
324 +#ifdef DEBUG_ISO
325 + printk("Directory %s Filename %s\n", newfilename, search);
326 +#endif
327 if (strlen(newfilename) < strlen(search) && !memcmp(search,newfilename,
328 strlen(newfilename)) && search[strlen(newfilename)]=='/') {
329 sect = read_dir(driveId, dir, search, newfilename, dir_found);
330 @@ -131,35 +141,46 @@
331 return sect;
332 }
333
334 -void read_file(int driveId, struct iso_directory_record *dir_read, char *buffer) {
335 +unsigned long read_file(int driveId, struct iso_directory_record *dir_read, char *buffer, unsigned int max_bytes_to_read) {
336 unsigned long read_size;
337 + unsigned long bytes_read;
338 unsigned long offset;
339 int i;
340 char *tmpbuff;
341
342 +
343 offset = *((unsigned long *)(dir_read->extent));
344 tmpbuff = (char *) malloc(ISO_BLOCKSIZE);
345 +
346 + if (max_bytes_to_read > *((unsigned int *)(dir_read->size)) ) {
347 + read_size = *(unsigned long *)dir_read->size;
348 + }
349 + else read_size = *(unsigned long *)max_bytes_to_read;
350 +
351 + bytes_read = read_size;
352
353 - read_size = *((unsigned long *)(dir_read->size));
354 if(read_size <= ISO_BLOCKSIZE) {
355 read_size = ISO_BLOCKSIZE;
356 } else {
357 read_size+=(ISO_BLOCKSIZE - (read_size % ISO_BLOCKSIZE));
358 }
359
360 -// printk(" read_file sector %d %d\n", offset, read_size);
361 -
362 +#ifdef DEBUG_ISO
363 + printk(" read_file sector %d %d\n", offset, read_size);
364 +#endif
365 for(i = 0; i < (read_size >> ISOFS_BLOCK_BITS) ; i++) {
366 memset(tmpbuff, 0x0, ISO_BLOCKSIZE);
367 BootIdeReadSector(driveId, tmpbuff, offset , 0, ISO_BLOCKSIZE);
368 offset++;
369 if(((i+1) * ISO_BLOCKSIZE) > read_size) {
370 - memcpy(&buffer[i * ISO_BLOCKSIZE], tmpbuff, (i * ISO_BLOCKSIZE) - *((unsigned long *)(dir_read->size)));
371 + memcpy(&buffer[i * ISO_BLOCKSIZE], tmpbuff, (i * ISO_BLOCKSIZE) - read_size);
372 } else {
373 memcpy(&buffer[i * ISO_BLOCKSIZE], tmpbuff, ISO_BLOCKSIZE);
374 }
375 }
376 free(tmpbuff);
377 +
378 + return bytes_read;
379 }
380
381 int BootIso9660GetFile(int driveId, char *szcPath, unsigned char *pbaFile, unsigned int dwFileLengthMax) {
382 @@ -177,7 +198,9 @@
383 memset(dir,0x0,sizeof(struct iso_directory_record));
384
385 if(BootIdeReadSector(driveId, pvd, 16 , 0, ISO_BLOCKSIZE)) {
386 -// printk("BootIso9660GetFile : Error read Sector\n");
387 +#ifdef DEBUG_ISO
388 + printk("BootIso9660GetFile : Error read Sector\n");
389 +#endif
390 free(pvd);
391 free(dir);
392 return -1;
393 @@ -187,14 +210,9 @@
394 offset = read_dir(driveId, rootd, szcPath, "", dir);
395
396 if(offset > 0) {
397 - if(*((unsigned long *)(dir->size)) > dwFileLengthMax) {
398 - free(pvd);
399 - free(dir);
400 - return -1;
401 - }
402 - read_file(driveId, dir, pbaFile);
403 - return *((unsigned long *)(dir->size));
404 + return read_file(driveId, dir, pbaFile, dwFileLengthMax);
405 } else {
406 + //Not found
407 free(pvd);
408 free(dir);
409 return -1;
410 --- cromwell-2.40/fs/grub/fsys_ext2fs.c
411 +++ cromwell-2.40/fs/grub/fsys_ext2fs.c
412 @@ -16,6 +16,7 @@
413 * along with this program; if not, write to the Free Software
414 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
415 */
416 +#include "boot.h"
417
418 #ifdef FSYS_EXT2FS
419
420 --- cromwell-2.40/fs/grub/fsys_reiserfs.c
421 +++ cromwell-2.40/fs/grub/fsys_reiserfs.c
422 @@ -17,7 +17,7 @@
423 * along with this program; if not, write to the Free Software
424 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
425 */
426 -
427 +#include "boot.h"
428 #ifdef FSYS_REISERFS
429 #include "shared.h"
430 #include "filesys.h"
431 @@ -367,7 +367,7 @@
432
433
434 static __inline__ unsigned long
435 -log2 (unsigned long word)
436 +reiser_log2 (unsigned long word)
437 {
438 __asm__ ("bsfl %1,%0"
439 : "=r" (word)
440 @@ -609,7 +609,7 @@
441
442 INFO->version = super.s_version;
443 INFO->blocksize = super.s_blocksize;
444 - INFO->fullblocksize_shift = log2 (super.s_blocksize);
445 + INFO->fullblocksize_shift = reiser_log2 (super.s_blocksize);
446 INFO->blocksize_shift = INFO->fullblocksize_shift - SECTOR_BITS;
447 INFO->cached_slots =
448 (FSYSREISER_CACHE_SIZE >> INFO->fullblocksize_shift) - 1;
449 --- cromwell-2.40/include/boot.h
450 +++ cromwell-2.40/include/boot.h
451 @@ -331,8 +331,12 @@
452 unsigned char *text1, int text1_length,
453 unsigned char *text2, int text2_length );
454
455 -char *HelpGetLine(char *ptr);
456 -void HelpGetParm(char *szBuffer, char *szOrig);
457 char *strrchr0(char *string, char ch);
458
459 +void setLED(void *pattern);
460 +
461 +int strlen(const char * s);
462 +int sprintf(char * buf, const char *fmt, ...);
463 +char * strncpy(char * dest,const char *src,int count);
464 +char * strstr(const char * s1,const char * s2);
465 #endif // _Boot_H_
466 --- cromwell-2.40/include/config.h
467 +++ cromwell-2.40/include/config.h
468 @@ -1,7 +1,7 @@
469 ////////////////////// compile-time options ////////////////////////////////
470
471 //Cromwell version number
472 -#define VERSION "2.40"
473 +#define VERSION "2.40-r3"
474
475 // selects between the supported video modes, see boot.h for enum listing those available
476 //#define VIDEO_PREFERRED_MODE VIDEO_MODE_800x600
477 --- cromwell-2.40/lib/gzip/misc.c
478 +++ cromwell-2.40/lib/gzip/misc.c
479 @@ -29,8 +29,6 @@
480 *
481 * Incomprehensible are the ways of bootloaders.
482 */
483 -static void* memset(void *, int, size_t);
484 -static void* memcpy(void *, __const void *, size_t);
485 #define memzero(s, n) memset ((s), 0, (n))
486
487 typedef unsigned char uch;
488 @@ -138,25 +136,6 @@
489 free_mem_ptr = (long) *ptr;
490 }
491
492 -static void* memset(void* s, int c, size_t n)
493 -{
494 - int i;
495 - char *ss = (char*)s;
496 -
497 - for (i=0;i<n;i++) ss[i] = c;
498 - return s;
499 -}
500 -
501 -static void* memcpy(void* __dest, __const void* __src,
502 - size_t __n)
503 -{
504 - int i;
505 - char *d = (char *)__dest, *s = (char *)__src;
506 -
507 - for (i=0;i<__n;i++) d[i] = s[i];
508 - return __dest;
509 -}
510 -
511 /* ===========================================================================
512 * Fill the input buffer. This is called only when the buffer is empty
513 * and at least one byte is really needed.
514 --- cromwell-2.40/lib/misc/BootLibrary.c
515 +++ cromwell-2.40/lib/misc/BootLibrary.c
516 @@ -36,7 +36,7 @@
517 }
518
519
520 -size_t strlen(const char * s)
521 +int strlen(const char * s)
522 {
523 int d0;
524 register int __res;
525 @@ -99,7 +99,7 @@
526 return dest;
527 }
528
529 -char * strncpy(char * dest,const char *src,size_t count)
530 +char * strncpy(char * dest,const char *src,int count)
531 {
532 int d0, d1, d2, d3;
533 __asm__ __volatile__(
534 --- cromwell-2.40/lib/misc/LED.c
535 +++ cromwell-2.40/lib/misc/LED.c
536 @@ -0,0 +1,52 @@
537 +/**
538 + * Xbox LED Pattern setting for Cromwell.
539 + * Copyright (C) Thomas "ShALLaX" Pedley (gentoox@×××××××.com)
540 + *
541 + * This program is free software; you can redistribute it and/or modify
542 + * it under the terms of the GNU General Public License as published by
543 + * the Free Software Foundation; either version 2 of the License, or
544 + * (at your option) any later version.
545 + *
546 + * This program is distributed in the hope that it will be useful,
547 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
548 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
549 + * GNU General Public License for more details.
550 + *
551 + * You should have received a copy of the GNU General Public License
552 + * along with this program; if not, write to the Free Software
553 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
554 + */
555 +
556 +// Set the pattern of the LED.
557 +// The pattern must be 4 characters long and must consist
558 +// only of 'r', 'g', 'o' and 'x'.
559 +//
560 +// r = Red
561 +// g = Green
562 +// o = Orange
563 +// x = Off
564 +//
565 +// E.g. rgog will cycle through red, green, orange, green and then loop.
566 +
567 +void setLED(char *pattern) {
568 + int i, r, g;
569 + r = g = 0;
570 +
571 + for (i=0; i<4; ++i) {
572 + switch (pattern[i]) {
573 + case 'r':
574 + r++;
575 + break;
576 + case 'g':
577 + g++;
578 + break;
579 + case 'o':
580 + r++;
581 + g++;
582 + break;
583 + }
584 + r *= 2;
585 + g *= 2;
586 + }
587 + I2cSetFrontpanelLed(((r<<4) & 0xF0) + (g & 0xF));
588 +}
589 --- cromwell-2.40/lib/misc/Makefile
590 +++ cromwell-2.40/lib/misc/Makefile
591 @@ -1,4 +1,4 @@
592
593 -O_TARGET := BootLibrary.o BootParser.o setup.o vsprintf.o
594 +O_TARGET := BootLibrary.o BootParser.o setup.o vsprintf.o LED.o
595
596 include $(TOPDIR)/Rules.make
597 --- cromwell-2.40/menu/iconmenu/IconMenuInit.c
598 +++ cromwell-2.40/menu/iconmenu/IconMenuInit.c
599 @@ -26,7 +26,7 @@
600 if (tsaHarddiskInfo[i].m_fAtapi) {
601 char *driveName=malloc(sizeof(char)*14);
602 sprintf(driveName,"CD-ROM (hd%c)",i ? 'b':'a');
603 - iconPtr = (ICON *)malloc(sizeof(ICON));
604 + iconPtr = malloc(sizeof(ICON));
605 iconPtr->iconSlot = ICON_SOURCE_SLOT2;
606 iconPtr->szCaption = driveName;
607 iconPtr->functionPtr = BootFromCD;
608 @@ -41,7 +41,7 @@
609
610 #ifdef ETHERBOOT
611 //Etherboot icon - if it's compiled in, it's always available.
612 - iconPtr = (ICON *)malloc(sizeof(ICON));
613 + iconPtr = malloc(sizeof(ICON));
614 iconPtr->iconSlot = ICON_SOURCE_SLOT3;
615 iconPtr->szCaption = "Etherboot";
616 iconPtr->functionPtr = BootFromEtherboot;
617 @@ -49,7 +49,7 @@
618 #endif
619
620 #ifdef ADVANCED_MENU
621 - iconPtr = (ICON *)malloc(sizeof(ICON));
622 + iconPtr = malloc(sizeof(ICON));
623 iconPtr->iconSlot = ICON_SOURCE_SLOT0;
624 iconPtr->szCaption = "Advanced";
625 iconPtr->functionPtr = AdvancedMenu;
626 @@ -74,7 +74,7 @@
627 CONFIGENTRY *entry = (CONFIGENTRY*)LoadConfigFatX();
628 if (entry !=NULL) {
629 //There is a config file present.
630 - iconPtr = (ICON *)malloc(sizeof(ICON));
631 + iconPtr = malloc(sizeof(ICON));
632 iconPtr->iconSlot = ICON_SOURCE_SLOT4;
633 iconPtr->szCaption="FatX (E:)";
634 iconPtr->functionPtr = DrawBootMenu;
635 @@ -101,10 +101,10 @@
636 memset(ba,0x00,512);
637 BootIdeReadSector(driveId, ba, 0, 0, 512);
638
639 - //See if there is an MBR - no MBR means no native boot options.
640 - if( !(ba[0x1fe]==0x55) || !(ba[0x1ff]==0xaa)) return;
641 + //See if there is an MBR - no MBR means no native boot options for this drive.
642 + if( !(ba[0x1fe]==0x55) || !(ba[0x1ff]==0xaa)) continue;
643
644 - (volatile u8 *)pb=&ba[0x1be];
645 + pb=&ba[0x1be];
646 //Check the primary partitions
647 for (n=0; n<4; n++,pb+=16) {
648 if(pb[0]&0x80) {
649 @@ -113,10 +113,10 @@
650 if (entry!=NULL) {
651 //There is a valid config file here.
652 //Add an icon for this partition
653 - iconPtr = (ICON *)malloc(sizeof(ICON));
654 + iconPtr = malloc(sizeof(ICON));
655 iconPtr->iconSlot = ICON_SOURCE_SLOT1;
656 iconPtr->szCaption=malloc(10);
657 - sprintf(iconPtr->szCaption, "hd%c%d", driveId+'a', n);
658 + sprintf(iconPtr->szCaption, "hd%c%d", driveId+'a', n+1);
659 iconPtr->functionPtr = DrawBootMenu;
660 iconPtr->functionDataPtr = (void *)entry;
661 AddIcon(iconPtr);
662 --- cromwell-2.40/Makefile
663 +++ cromwell-2.40/Makefile
664 @@ -10,11 +10,15 @@
665 -I$(TOPDIR)/startuploader -I$(TOPDIR)/drivers/cpu \
666 -I$(TOPDIR)/lib/jpeg/
667
668 -CFLAGS = -O2 -mcpu=pentium -Werror $(INCLUDE) -Wstrict-prototypes -fomit-frame-pointer -pipe
669 +#These are intended to be non-overridable.
670 +CROM_CFLAGS=$(INCLUDE)
671
672 -# add the option for gcc 3.3 only
673 +#You can override these if you wish.
674 +CFLAGS= -O2 -g -march=pentium -pipe -fomit-frame-pointer -Wstrict-prototypes
675 +
676 +# add the option for gcc 3.3 only, again, non-overridable
677 ifeq ($(GCC_3.3), 1)
678 -CFLAGS += -fno-zero-initialized-in-bss
679 +CROM_CFLAGS += -fno-zero-initialized-in-bss
680 endif
681
682 LD = ld
683 @@ -27,9 +31,9 @@
684 #### Etherboot specific stuff
685 ifeq ($(ETHERBOOT), yes)
686 ETH_SUBDIRS = etherboot
687 -CFLAGS += -DETHERBOOT
688 +CROM_CFLAGS += -DETHERBOOT
689 ETH_INCLUDE = -I$(TOPDIR)/etherboot/include -I$(TOPDIR)/etherboot/arch/i386/include
690 -ETH_CFLAGS = -O2 -mcpu=pentium -Werror $(ETH_INCLUDE) -Wstrict-prototypes -fomit-frame-pointer -pipe -Ui386
691 +ETH_CFLAGS = -O2 -march=pentium -Werror $(ETH_INCLUDE) -Wstrict-prototypes -fomit-frame-pointer -pipe -Ui386
692 endif
693
694 LDFLAGS-ROM = -s -S -T $(TOPDIR)/scripts/ldscript-crom.ld
695 @@ -107,6 +111,7 @@
696 OBJECTS-CROM += $(TOPDIR)/obj/BootEEPROM.o
697 OBJECTS-CROM += $(TOPDIR)/obj/BootParser.o
698 OBJECTS-CROM += $(TOPDIR)/obj/BootFATX.o
699 +OBJECTS-CROM += $(TOPDIR)/obj/LED.o
700 #USB
701 OBJECTS-CROM += $(TOPDIR)/obj/config.o
702 OBJECTS-CROM += $(TOPDIR)/obj/hcd-pci.o
703 @@ -137,6 +142,7 @@
704 OBJECTS-CROM += $(TOPDIR)/obj/etherboot_config.o
705 OBJECTS-CROM += $(TOPDIR)/obj/xbox_main.o
706 OBJECTS-CROM += $(TOPDIR)/obj/elf.o
707 +OBJECTS-CROM += $(TOPDIR)/obj/exec_elf.o
708 endif
709
710 RESOURCES = $(TOPDIR)/obj/backdrop.elf
711 @@ -159,7 +165,7 @@
712
713 cromsubdirs: $(patsubst %, _dir_%, $(SUBDIRS))
714 $(patsubst %, _dir_%, $(SUBDIRS)) : dummy
715 - $(MAKE) CFLAGS="$(CFLAGS)" -C $(patsubst _dir_%, %, $@)
716 + $(MAKE) CFLAGS="$(CFLAGS) $(CROM_CFLAGS)" -C $(patsubst _dir_%, %, $@)
717
718 dummy:
719
720
721
722
723 --
724 gentoo-commits@l.g.o mailing list