Hello!

On Thu, 2 Mar 2000, OKUJI Yoshinori wrote:

> From: Kalle Olavi Niemitalo <[EMAIL PROTECTED]>
> Subject: Re: grub/asmstub.c:533: undefined reference to `MAJOR'
> Date: 01 Mar 2000 19:17:10 +0200
> 
> > I just checked the fileutils source, as "ls" shows device
> > numbers.  It uses minor() and major() from <sys/types.h>,
> > <sys/mkdev.h> or <sys/sysmacros.h> if possible.  That ought to be
> > the right way.
> 
>   I agree that that is the Right Thing, but we can use MAJOR safely at
> the moment as long as the user uses GCC. As GRUB depends on GCC, no
> problem will happen.

The problem does happen, as the subject indicates.
This is Mandrake Linux 6.0

$ uname -a
Linux washington 2.2.9-19mdk #1 Wed May 19 19:53:00 GMT 1999 i586 unknown
$ gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/pgcc-2.91.66/specs
gcc version pgcc-2.91.66 19990314 (egcs-1.1.2 release)
$ ls -ld /usr/src/linux*
lrwxrwxrwx   1 root     root           11 Jan 11 08:49 /usr/src/linux ->
linux-2.2.9/
drwxr-xr-x  17 root     root         1024 Jan 11 08:49
/usr/src/linux-2.2.9/
$ ld -v
GNU ld version 2.9.1 (with BFD 2.9.1.0.24)

$ make
gcc -DHAVE_CONFIG_H -I. -I. -I..   -Wall -Wmissing-prototypes -Wunused -O2
-DGRUB_UTIL=1 -
DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_MINIX=1 -fwritable-strings
-I../stage2 -I.
./stage1 -I../lib -g -c -o asmstub.o asmstub.c
asmstub.c: In function `check_device':
asmstub.c:534: warning: implicit declaration of function `MAJOR'
gcc -O2 -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1
-DFSYS_MINIX=1 -fwritable-
strings -I../stage2 -I../stage1 -I../lib -g   -o grub  main.o asmstub.o
../stage2/libgrub.
a  ../lib/libcommon.a -lncurses
asmstub.o: In function `check_device':
/home/proskin/src/grub/grub/asmstub.c:533: undefined reference to `MAJOR'
make: *** [grub] Error 1

This patch helps (but I haven't tested it on any other machine):

=== cut here ===
diff -u -r1.43 asmstub.c
--- asmstub.c   2000/02/23 18:53:27     1.43
+++ asmstub.c   2000/03/07 14:50:56
@@ -44,6 +44,7 @@
 # include <sys/ioctl.h>                /* ioctl */
 # include <linux/hdreg.h>      /* HDIO_GETGEO */
 # include <linux/major.h>      /* FLOPPY_MAJOR */
+# include <linux/kdev_t.h>     /* MAJOR */
 # if (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))
 /* Maybe libc doesn't have large file support.  */
 #  include <linux/unistd.h>    /* _llseek */
=== cut here ===

Pavel Roskin

Reply via email to