Skip to contentSkip to conversation

Quik 2.0e patches and issues

PATCH Daniel Jacobowitz 2 participants 2 messages Mar 13, 2000

lore
Share & tools
lore
#0 lore raw

Well, I finally got quik 2.0* to work on my hardware (7300, Oldworld power macintosh) again. It required a couple of patches which I'm not quite sure about, so I wanted to get your opinion on them.

In order:

- The first chunk is to deal with the type of dev_t. I'm not entirely sure
why it is necessary, but it most definitely is. Otherwise PART always comes out as zero.

- The second is the really important part, and I'm really confused as to
why it was necessary. Without -N, the data section gets thoroughly trashed. This leads to e2fslibs returning an error code because the magic field of the struct_linux_manager is clobbered, as is the value in linux_io_manager. protect[] does not seem to help. My guess is the lack of page-aligning the data segment made the difference. Why did you decide to remove -N?

- The two adds of a __KERNEL__ are a workaround for a bug with the altivec
types in 2.2's headers - it should be fixed there rather than in quik, and I'll send you a patch for that later this week when I go through my kernel tree. I have a matching accumulation of little fixes for there.

- The boot logic. I don't understand how start += entry can ever be right;
shouldn't it be start = entry? I don't remember why I had start = load_loc in my tree, but it seems to work; I suspect that isn't right either.

Dan

/--------------------------------\ /--------------------------------\

|       Daniel Jacobowitz        |__|        SCS Class of 2002       |
|   Debian GNU/Linux Developer    __    Carnegie Mellon University   |
|         [email protected]         |  |       [email protected]      |
\--------------------------------/  \--------------------------------/
quik/quik.c +2 -2
diff -ur quik-2.0e/quik/quik.c quik-work/quik/quik.c
@@ -55,8 +55,8 @@
 
 int unit_shift;
 int part_mask;
-#define UNIT(dev)	(MINOR(dev) >> unit_shift)
-#define PART(dev)	(MINOR(dev) & part_mask)
+#define UNIT(dev)	(((int)MINOR(dev)) >> unit_shift)
+#define PART(dev)	(((int)MINOR(dev)) &  part_mask)
 
 #define swab_32(x)	((((x) >> 24) & 0xff) + (((x) >> 8) & 0xff00) \
 			 + (((x) & 0xff00) << 8) + (((x) & 0xff) << 24))
second/Makefile +1 -1
diff -ur quik-2.0e/second/Makefile quik-work/second/Makefile
@@ -4,7 +4,7 @@
 
 CFLAGS = -I../include -O2 -D__NO_STRING_INLINES
 
-LDFLAGS= -Ttext 0x3e0000
+LDFLAGS=-N -Ttext 0x3e0000
 
 OBJS =	crt0.o printf.o malloc.o main.o cmdline.o disk.o file.o \
 	cfg.o strtol.o prom.o cache.o string.o setjmp.o ctype.o \
second/main.c +12 -4
diff -ur quik-2.0e/second/main.c quik-work/second/main.c
@@ -29,6 +29,7 @@
 
 #include "quik.h"
 #include <string.h>
+#define __KERNEL__
 #include <linux/elf.h>
 #include <layout.h>
 #ifdef BOOTINFO
@@ -497,10 +501,17 @@
      * point may actually be a procedure descriptor.
      */
     start = *(unsigned *)entry;
-    if (start < load_loc || start >= load_loc + len
-	|| ((unsigned *)entry)[2] != 0)
-	/* doesn't look like a procedure descriptor */
-	start += entry;
+    /* new boot strategy - see head.S in the kernel for more info -- Cort */
+    if (start == 0x60000000/* nop */ )
+	    start = load_loc;
+    /* not the new boot strategy, use old logic -- Cort */
+    else
+    {
+	    if (start < load_loc || start >= load_loc + len
+		|| ((unsigned *)entry)[2] != 0)
+		    /* doesn't look like a procedure descriptor */
+		    start += entry;
+    }
     printf("Starting at %x\n", start);
 #ifdef BOOTINFO
     /* setup the bootinfo */
util/elfextract.c +1 -0
diff -ur quik-2.0e/util/elfextract.c quik-work/util/elfextract.c
@@ -4,6 +4,7 @@
  * Copyright 1996 Paul Mackerras.
  */
 #include <stdio.h>
+#define __KERNEL__
 #include <linux/elf.h>
 
 FILE *fi, *fo;
#1 lore raw

Great, thanks for the patches. I did some hacks to quik for chrp and called it quik-2.0. I wasn't even sure it worked on powermac hardware :) Thanks for the patches! I'll look into folding them in.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/