Subject: The world's worst RPM

From: Alex deVries <[email-masked]>
Date: Wed, 14 Jan 1998 01:43:00 -0500 (EST)

I have generated the world's worst RPM for util-linux, which is much
needed, since it contains fdisk.

I had to kludge some things; util-linux is truly an awful thing.  It
contains things like hwclock, which sets the clock on ISA bus only
machines.  This is designed only for sparc, alpha and i386 _ONLY_.

Anyway, I kludged it into compiling, but I really had to guess on the
parameters for the disk operations.  Fdisk compiles and works, but I can't
really test it as I need both disks on my system.  Could somebody give it
a try?

Also, it has things like more , write and mkswap. Yay! I now have swap
space!

So, give it a try, or clean up my diff files.

- Alex

-- 
      Alex deVries          Run Linux on everything,
  System Administrator      run everything on Linux.
   The EngSoc Project       Send spam to [email-masked].

---

From: [email-masked]
Date: Wed, 14 Jan 1998 11:28:44 +0100

> machines.  This is designed only for sparc, alpha and i386 _ONLY_.

You must be talking about clock.  As I remember hwclock is using some
/dev/rtc and should be portable.  Anyway, all the world is using the
same rtc from Dallas Semiconductor, so ...

> So, give it a try, or clean up my diff files.

Suicide doesn't look like a bad alternative to cleaning the diffs.  And
it's not your fault.  Actually I rememer that somebody already put his
mental health on the game, there is a glibc patch for util-linux floating
around.

  Ralf

---

From: Oliver Frommel <[email-masked]>
Date: Wed, 14 Jan 1998 14:28:32 +0100 (MET)

> really test it as I need both disks on my system.  Could somebody give it

i'll do that tomorrow (when i am back at my indy).
i also wonder what you changed to not only make it compile but also work,
but i guess i'll see .. :)
anyway if there's still anything to work on, converning fdisk, i'd have some
time to do so this weekend ..

oliver

---

From: [email-masked]
Date: Wed, 14 Jan 1998 14:58:20 +0100

> time to do so this weekend ..

As I understand Alex's words he only made fdisk running but it still doesn't
support IRIX style disklabels.  How about that?

That's aside of getting rid of sash one of the major thing we still need
to do in order to get fully self hosting.

  Ralf

---

From: [email-masked]
Date: Wed, 14 Jan 1998 15:29:35 +0100

On Wed, Jan 14, 1998 at 02:36:17PM +0000, Alan Cox wrote:

> I've stuck some more new rpms on ftp.uk.linux.org incoming and SGI dir
> including sox, xmorph, ncompress, sysklogd 

Have you taken care of the fact that ncompress makes assumptions about
the byteorder of the machine it's running on?  For MIPS it's broken, but
I don't remember if it was on big or little endian ...

  Ralf

---

From: [email-masked] (Alan Cox)
Date: Wed, 14 Jan 1998 14:36:17 +0000 (GMT)

Alan

---

From: [email-masked] (Alan Cox)
Date: Wed, 14 Jan 1998 15:07:27 +0000 (GMT)

> I don't remember if it was on big or little endian ...

Its passed in the spec file. I've even port mipsel in as well for you ;)

---

From: Alex deVries <[email-masked]>
Date: Wed, 14 Jan 1998 11:38:18 -0500 (EST)

> same rtc from Dallas Semiconductor, so ...

On closer inspection it's just a matter of doing something like:

#ifdef ISA_BUS
(ISA specific routines that use iopl())
#endif

Yes, it is fixable.

> mental health on the game, there is a glibc patch for util-linux floating

Yeah.  Those are in the source RPM, and I'm using them.  There's a lot of
#ifdef __SPARC__  or similiar statements that need to be fixed for mips.

I really think this should be broken into multiple packages.

- Alex

---

From: Alex deVries <[email-masked]>
Date: Wed, 14 Jan 1998 11:42:55 -0500 (EST)

> support IRIX style disklabels.  How about that?

That's correct. It should be able to modify partition tables of disks, but
Irix won't recognize it. That's no problem if you have no intention of
using Irix once your machine is running smoothly, like me.

- Alex

---

From: Thomas Bogendoerfer <[email-masked]>
Date: Wed, 14 Jan 1998 21:58:47 +0100

> Its passed in the spec file. I've even port mipsel in as well for you ;)

hmm, to do this with only one src.rpm, we need a little support from
rpm. At the moment mips is defined for mipsel and mipseb. I would suggest,
that for .spec execution mips is defined for bot mipsel and mipseb, because 
there are changes, which work for both and we only need to seperate changes 
like that needed by ncompress.  Comments ? Does anybody how to do this ?

Thomas.

-- 
See, you not only have to be a good coder to create a system like Linux,
you have to be a sneaky bastard too ;-)
                   [Linus Torvalds in <[email-masked]>]

---

From: [email-masked] (Alan Cox)
Date: Wed, 14 Jan 1998 22:17:31 +0000 (GMT)

> like that needed by ncompress.  Comments ? Does anybody how to do this ?

Just ask Erik Troan nicely

---

From: Alex deVries <[email-masked]>
Date: Wed, 14 Jan 1998 17:25:31 -0500 (EST)

> Just ask Erik Troan nicely 

He has already agreed to it, I just need to submit my patches to RPM that
do the detection of the byte order for setting the soft-coded default
architecture. It'll be done by the end of the week.

- Alex

---

From: Miguel de Icaza <[email-masked]>
Date: Wed, 14 Jan 1998 17:59:27 -0600

> like that needed by ncompress.  Comments ? Does anybody how to do this ?

The code should be fixed to autoconfigure itself by using the
__LITTLE_ENDIAN and __BIG_ENDIAN macros that are defined somewhere in
/usr/include.  And ship the patch with this.

Miguel.

---

From: [email-masked]
Date: Thu, 15 Jan 1998 01:03:35 +0100

> architecture. It'll be done by the end of the week.

Ah, you were the volunteer :-)  Recently I fixed RPM already, so we should
somewhen deciede who's patch is the nicer.

  Ralf

---

From: Alex deVries <[email-masked]>
Date: Wed, 14 Jan 1998 22:56:58 -0500 (EST)

> somewhen deciede who's patch is the nicer.

Erik,

	Feel free to apply either Ralf's or my patch (below my .sig).  It
supports auto-byte order detection in defaultMachine(), and patches to the
rpmrc and rpm.magic files to change the name to mipseb and mipsel.

	I've made little-endian mips 11, and renamed the existing mips to
mipseb.

- Alex

z

diff -rc rpm-2.4.99.orig/lib/rpmrc.c rpm-2.4.99/lib/rpmrc.c
*** rpm-2.4.99.orig/lib/rpmrc.c	Tue Jan 13 16:08:24 1998
--- rpm-2.4.99/lib/rpmrc.c	Wed Jan 14 19:07:28 1998
***************
*** 669,674 ****
--- 669,681 ----
      char * chptr;
      struct canonEntry * canon;
  
+ #if defined (__mips)
+     union {
+       long l;
+       char c[sizeof (long)];
+     } u;
+ #endif
+ 
      if (!gotDefaults) {
  	uname(&un);
  	if (!strcmp(un.sysname, "AIX")) {
***************
*** 681,686 ****
--- 688,702 ----
  	chptr = un.machine;
  	while (*chptr++)
  	    if (*chptr == '/') *chptr = '-';
+ 
+ #if defined(__mips)
+             u.l = 1;
+             if (u.c[sizeof (long) - 1] == 1) {
+ 		    strcpy(un.machine, "mipseb");
+             } else {
+ 		    strcpy(un.machine, "mipsel");
+            }
+ #endif
  
  	#if defined(__hpux) && defined(_SC_CPU_VERSION)
  	{
diff -rc rpm-2.4.99.orig/lib-rpmrc.in rpm-2.4.99/lib-rpmrc.in
*** rpm-2.4.99.orig/lib-rpmrc.in	Tue Jan 13 16:08:23 1998
--- rpm-2.4.99/lib-rpmrc.in	Wed Jan 14 18:41:13 1998
***************
*** 41,47 ****
  arch_canon: 	sun4c:	sparc	3
  arch_canon:     sun4d:  sparc   3
  # This is really a place holder for MIPS.
! arch_canon:	mips:	mips	4
  arch_canon:	ppc:	ppc	5
  arch_canon:	m68k:	m68k	6
  arch_canon:	IP:	sgi	7
--- 41,47 ----
  arch_canon: 	sun4c:	sparc	3
  arch_canon:     sun4d:  sparc   3
  # This is really a place holder for MIPS.
! arch_canon:	mipseb:	mipseb	4
  arch_canon:	ppc:	ppc	5
  arch_canon:	m68k:	m68k	6
  arch_canon:	IP:	sgi	7
***************
*** 50,55 ****
--- 50,56 ----
  arch_canon:    9000/712:       hppa1.1 9
  
  arch_canon:    sun4u:   usparc  10
+ arch_canon:	mipsel:	mipsel	11
  
  #############################################################
  # Canonical OS names and numbers
***************
*** 118,124 ****
  arch_compat: sparc: noarch
  
  arch_compat: ppc: noarch
! arch_compat: mips: noarch
  
  arch_compat: hppa1.1: hppa1.0
  arch_compat: hppa1.0: noarch
--- 119,126 ----
  arch_compat: sparc: noarch
  
  arch_compat: ppc: noarch
! arch_compat: mipseb: noarch
! arch_compat: mipsel: noarch
  
  arch_compat: hppa1.1: hppa1.0
  arch_compat: hppa1.0: noarch
***************
*** 137,140 ****
  buildarch_compat: alpha: noarch
  buildarch_compat: m68k: noarch
  buildarch_compat: ppc: noarch
! buildarch_compat: mips: noarch
--- 139,144 ----
  buildarch_compat: alpha: noarch
  buildarch_compat: m68k: noarch
  buildarch_compat: ppc: noarch
! buildarch_compat: mipsel: noarch
! buildarch_compat: mipseb: noarch
! 
diff -rc rpm-2.4.99.orig/rpm.magic rpm-2.4.99/rpm.magic
*** rpm-2.4.99.orig/rpm.magic	Tue Jan 13 16:08:23 1998
--- rpm-2.4.99/rpm.magic	Wed Jan 14 16:43:43 1998
***************
*** 10,17 ****
  >>8	beshort		1		i386
  >>8	beshort		2		Alpha
  >>8	beshort		3		Sparc
! >>8	beshort		4		MIPS
  >>8	beshort		5		PowerPC
  >>8	beshort		6		68000
  >>8	beshort		7		SGI
  >>10	string		x		%s
--- 10,18 ----
  >>8	beshort		1		i386
  >>8	beshort		2		Alpha
  >>8	beshort		3		Sparc
! >>8	beshort		4		MIPS big endian
  >>8	beshort		5		PowerPC
  >>8	beshort		6		68000
  >>8	beshort		7		SGI
+ >>8	beshort		11		MIPS little endian
  >>10	string		x		%s

---

From: [email-masked]
Date: Thu, 15 Jan 1998 06:25:01 +0100

On Wed, Jan 14, 1998 at 10:56:58PM -0500, Alex deVries wrote:

You can solve the byteorder detection issue more efficient at compile
time by something like:

#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL)
/* little endian */
		    strcpy(un.machine, "mipsel");
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB)
/* big endian */
		    strcpy(un.machine, "mipseb");
#else
/* This doesn't happen (TM) */
#endif
#endif

Other than that my patch is almost down to the byte the same.

  Ralf

---

From: Alex deVries <[email-masked]>
Date: Thu, 15 Jan 1998 13:59:05 -0500 (EST)

Erik,

	Please consider this as the final patch for the mips byteorder
issue.  It'd be nice to get this into the next version of rpm (101?).

	Thanks!

- Alex

diff -rc rpm-2.4.99.orig/lib/rpmrc.c rpm-2.4.99/lib/rpmrc.c
*** rpm-2.4.99.orig/lib/rpmrc.c	Tue Jan 13 16:08:24 1998
--- rpm-2.4.99/lib/rpmrc.c	Thu Jan 15 12:21:29 1998
***************
*** 682,687 ****
--- 682,699 ----
  	while (*chptr++)
  	    if (*chptr == '/') *chptr = '-';
  
+             #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL)
+                 /* little endian */
+ 		strcpy(un.machine, "mipsel");
+             #else
+                #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB)
+                /* big endian */
+ 		    strcpy(un.machine, "mipseb");
+                #else
+                     /* This doesn't happen (TM) */
+                #endif
+             #endif
+ 
  	#if defined(__hpux) && defined(_SC_CPU_VERSION)
  	{
  	    int cpu_version = sysconf(_SC_CPU_VERSION);
diff -rc rpm-2.4.99.orig/lib-rpmrc.in rpm-2.4.99/lib-rpmrc.in
*** rpm-2.4.99.orig/lib-rpmrc.in	Tue Jan 13 16:08:23 1998
--- rpm-2.4.99/lib-rpmrc.in	Wed Jan 14 18:41:13 1998
***************
*** 41,47 ****
  arch_canon: 	sun4c:	sparc	3
  arch_canon:     sun4d:  sparc   3
  # This is really a place holder for MIPS.
! arch_canon:	mips:	mips	4
  arch_canon:	ppc:	ppc	5
  arch_canon:	m68k:	m68k	6
  arch_canon:	IP:	sgi	7
--- 41,47 ----
  arch_canon: 	sun4c:	sparc	3
  arch_canon:     sun4d:  sparc   3
  # This is really a place holder for MIPS.
! arch_canon:	mipseb:	mipseb	4
  arch_canon:	ppc:	ppc	5
  arch_canon:	m68k:	m68k	6
  arch_canon:	IP:	sgi	7
***************
*** 50,55 ****
--- 50,56 ----
  arch_canon:    9000/712:       hppa1.1 9

  
  arch_compat: ppc: noarch

  arch_compat: ppc: noarch
  
! >>8	beshort		4		MIPS
--- 10,18 ----

---

From: Erik Troan <[email-masked]>
Date: Thu, 15 Jan 1998 14:44:59 -0500 (EST)

> issue.  It'd be nice to get this into the next version of rpm (101?).

I'll get this in the next version.

In the guture, please use unified diffs though -- they tend to be easier
to deal with.

Erik

-------------------------------------------------------------------------------
|       "For the next two hours, VH1 will be filled with foul-mouthed,        |
|          crossdressing Australians. Viewer discretion is advised."          |
|                                                                             |
|       Erik Troan   =   [email-masked]     =    [email-masked]          |

---

From: Erik Troan <[email-masked]>
Date: Thu, 15 Jan 1998 14:51:17 -0500 (EST)

> issue.  It'd be nice to get this into the next version of rpm (101?).

Here's the final patch I used. It's basically the same as yours, I just
changed the #if stuff to look a bit cleaner. I also made the old 'mips'
architecture compatible with your new 'mipseb' one -- that should save
you some migration headaches.

Let me know if this doesn't look right.

Erik

Index: lib-rpmrc.in
===================================================================
RCS file: /usr/rhs/CVS/rpm/lib-rpmrc.in,v
retrieving revision 1.32
diff -u -r1.32 lib-rpmrc.in
--- lib-rpmrc.in	1997/12/30 19:26:15	1.32
+++ lib-rpmrc.in	1998/01/15 19:51:02
@@ -41,7 +41,7 @@
 arch_canon: 	sun4c:	sparc	3
 arch_canon:     sun4d:  sparc   3
 # This is really a place holder for MIPS.
-arch_canon:	mips:	mips	4
+arch_canon:	mipseb:	mipseb	4
 arch_canon:	ppc:	ppc	5
 arch_canon:	m68k:	m68k	6
 arch_canon:	IP:	sgi	7
@@ -50,6 +50,7 @@
 arch_canon:    9000/712:       hppa1.1 9
 
 arch_canon:    sun4u:   usparc  10
+arch_canon:	mipsel:	mipsel	11
 
@@ -118,10 +119,13 @@
 
 arch_compat: ppc: noarch
-arch_compat: mips: noarch
+arch_compat: mipseb: noarch
+arch_compat: mipsel: noarch
 
 arch_compat: hppa1.1: hppa1.0
 arch_compat: hppa1.0: noarch
+# we used to call mipseb just mips -- let those packages still work
+arch_compat: mipseb: mips
 
 os_compat:   IRIX64: IRIX
 
@@ -137,4 +141,6 @@
 buildarch_compat: alpha: noarch
 buildarch_compat: m68k: noarch
 buildarch_compat: ppc: noarch
-buildarch_compat: mips: noarch
+buildarch_compat: mipsel: noarch
+buildarch_compat: mipseb: noarch
+
Index: rpm.magic
===================================================================
RCS file: /usr/rhs/CVS/rpm/rpm.magic,v
retrieving revision 2.2
diff -u -r2.2 rpm.magic
--- rpm.magic	1996/05/22 20:39:33	2.2
+++ rpm.magic	1998/01/15 19:51:02
@@ -10,8 +10,9 @@
 >>8	beshort		3		Sparc
->>8	beshort		4		MIPS
+>>8	beshort		4		MIPS big endian
 >>8	beshort		7		SGI
+>>8	beshort		11		MIPS little endian
 >>10	string		x		%s
Index: lib/rpmrc.c
===================================================================
RCS file: /usr/rhs/CVS/rpm/lib/rpmrc.c,v
retrieving revision 2.57
diff -u -r2.57 rpmrc.c
--- rpmrc.c	1998/01/12 16:58:16	2.57
+++ rpmrc.c	1998/01/15 19:51:02
@@ -682,6 +682,14 @@
 	while (*chptr++)
 	    if (*chptr == '/') *chptr = '-';
 
+	#elif defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB)

---

From: [email-masked]
Date: Fri, 16 Jan 1998 00:42:36 +0100

> /usr/include.  And ship the patch with this.

I actually have some patch ... somewhere on a disk ...

  Ralf