From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 21 Dec 2006 19:13:15 +0300 From: Sergey Vlasov To: ALT Devel discussion list Message-ID: <20061221161315.GH13343@master.mivlgu.local> Mail-Followup-To: ALT Devel discussion list References: <20061219170522.9C40217FD4@teams.lrn.ru> <200612211712.19666.serpiph@nikiet.ru> <20061221143906.GA8910@basalt.office.altlinux.org> <200612211815.04937.serpiph@nikiet.ru> <20061221154243.GG13343@master.mivlgu.local> <20061221154657.GB10842@basalt.office.altlinux.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SUk9VBj82R8Xhb8H" Content-Disposition: inline In-Reply-To: <20061221154657.GB10842@basalt.office.altlinux.org> Subject: Re: [devel] =?koi8-r?b?R1JVQiDJINPP0s/Eyd7J?= X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.9rc1 Precedence: list Reply-To: ALT Devel discussion list List-Id: ALT Devel discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Dec 2006 16:13:24 -0000 Archived-At: List-Archive: List-Post: --SUk9VBj82R8Xhb8H Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 21, 2006 at 06:46:57PM +0300, Dmitry V. Levin wrote: > On Thu, Dec 21, 2006 at 06:42:43PM +0300, Sergey Vlasov wrote: > > On Thu, Dec 21, 2006 at 06:15:04PM +0300, Epiphanov Sergei wrote: > > > > > =E4=D5=CD=C1=CC, =CD=CF=D6=CE=CF =CF=C2=CF=CA=D4=C9=D3=D8 =CD=C1= =CC=CF=CA =CB=D2=CF=D7=D8=C0. :( =E9=CE=D4=C5=D2=C5=D3=CE=CF, =C1 =DE=D4=CF= =CD=C5=DB=C1=C5=D4 > > > > > =D0=CF=D0=D2=CF=C2=CF=D7=C1=D4=D8 =D3=CF=C2=D2=C1=D4=D8 grub =C2= =C5=DA =DC=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B=D6=C5 > > =C9=D3=D0=D2=C1=D7=CC=C5=CE=C9=D1 =CE=C5=D3=CB=CF=CC=D8=CB=C9=C8 =CF=DB= =C9=C2=CF=CB =D7 Makefile.am). >=20 > =F4.=C5. =D4=C1=CD =CE=C5 =CE=D5=D6=C5=CE -m32? =EB=C1=CB =D2=C1=DA =CE=D5=D6=C5=CE - =D0=D2=CF=C2=CC=C5=CD=C1 =D7 =D4=CF= =CD, =DE=D4=CF =D3 =CE=C1=DB=C9=CD gcc =CE=C5 =D0=D2=CF=C8=CF=C4=D1=D4 =D4= =C5=D3=D4=D9 =D7 configure =C9=DA-=DA=C1 =D4=CF=C7=CF, =DE=D4=CF =C4=C5=CC=C1=C5=D4=D3=D1 = =D0=CF=D0=D9=D4=CB=C1 =D3=CF=C2=D2=C1=D4=D8 =C2=C9=CE=C1=D2=CE=C9=CB =D3 -m= 32; =D0=D2=C9=C8=CF=C4=C9=D4=D3=D1 =CF=C2=C8=CF=C4=C9=D4=D8 =DC=D4=CF =C8=C1=CB= =C1=CD=C9. --- grub-0.97/stage2/Makefile.am.alt-x86_64-m32 2006-07-21 11:02:14 +0400 +++ grub-0.97/stage2/Makefile.am 2006-07-21 11:09:07 +0400 @@ -55,11 +55,11 @@ endif MOSTLYCLEANFILES =3D $(noinst_PROGRAMS) =20 -PRE_STAGE2_LINK =3D -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200 -START_LINK =3D -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000 -NBLOADER_LINK =3D -nostdlib -Wl,-N -Wl,-Ttext -Wl,0 -PXELOADER_LINK =3D -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 -START_ELTORITO_LINK =3D -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 +PRE_STAGE2_LINK =3D $(STAGE2_CFLAGS) -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200 +START_LINK =3D $(STAGE2_CFLAGS) -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000 +NBLOADER_LINK =3D $(STAGE2_CFLAGS) -nostdlib -Wl,-N -Wl,-Ttext -Wl,0 +PXELOADER_LINK =3D $(STAGE2_CFLAGS) -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 +START_ELTORITO_LINK =3D $(STAGE2_CFLAGS) -nostdlib -Wl,-N -Wl,-Ttext -Wl,7= C00 =20 if NETBOOT_SUPPORT NETBOOT_FLAGS =3D -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=3D1 @@ -82,7 +82,7 @@ STAGE2_COMPILE =3D $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) =20 -STAGE1_5_LINK =3D -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 +STAGE1_5_LINK =3D $(STAGE2_CFLAGS) -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 STAGE1_5_COMPILE =3D $(STAGE2_COMPILE) -DNO_DECOMPRESSION=3D1 -DSTAGE1_5= =3D1 =20 # For stage2 target. --- grub-0.97/stage1/Makefile.am.alt-x86_64-m32 2006-07-21 11:02:14 +0400 +++ grub-0.97/stage1/Makefile.am 2006-07-21 11:09:33 +0400 @@ -5,7 +5,7 @@ =20 # We can't use builtins or standard includes. AM_CCASFLAGS =3D $(STAGE1_CFLAGS) -fno-builtin -nostdinc -LDFLAGS =3D -nostdlib -Wl,-N,-Ttext,7C00 +LDFLAGS =3D $(STAGE1_CFLAGS) -nostdlib -Wl,-N,-Ttext,7C00 =20 noinst_PROGRAMS =3D stage1.exec stage1_exec_SOURCES =3D stage1.S stage1.h --- grub-0.97/configure.ac.alt-x86_64-m32 2005-05-08 06:36:03 +0400 +++ grub-0.97/configure.ac 2006-07-21 11:02:15 +0400 @@ -47,7 +47,9 @@ fi =20 if test "x$host_cpu" =3D xx86_64; then - CFLAGS=3D"-m32 $CFLAGS" + M32_FLAG=3D"-m32 -nodefaultlibs" +else + M32_FLAG=3D fi =20 # @@ -84,7 +86,7 @@ if test "x$with_binutils" !=3D x; then CFLAGS=3D"-B$with_binutils/ $CFLAGS" fi - STAGE1_CFLAGS=3D"-O2" + STAGE1_CFLAGS=3D"$M32_FLAG -O2" GRUB_CFLAGS=3D"-O2" AC_CACHE_CHECK([whether optimization for size works], size_flag, [ saved_CFLAGS=3D$CFLAGS @@ -97,6 +99,7 @@ else STAGE2_CFLAGS=3D"-O2 -fno-strength-reduce -fno-unroll-loops" fi + STAGE2_CFLAGS=3D"$M32_FLAG $STAGE2_CFLAGS" # OpenBSD has a GCC extension for protecting applications from # stack smashing attacks, but GRUB doesn't want this feature. AC_CACHE_CHECK([whether gcc has -fno-stack-protector], @@ -157,6 +160,9 @@ AC_CHECK_TOOL(OBJCOPY, objcopy) fi =20 +grub_saved_CFLAGS=3D"$CFLAGS" +CFLAGS=3D"$M32_FLAG $CFLAGS" + # Defined in acinclude.m4. grub_ASM_USCORE grub_PROG_OBJCOPY_ABSOLUTE @@ -173,6 +179,8 @@ =20 grub_ASM_ABSOLUTE_WITHOUT_ASTERISK =20 +CFLAGS=3D"$grub_saved_CFLAGS" + grub_CHECK_START_SYMBOL grub_CHECK_USCORE_START_SYMBOL if test "x$grub_cv_check_start_symbol" !=3D "xyes" \ --- grub-0.97/stage2/disk_io.c.alt-x86_64-build 2006-07-21 10:58:25 +0400 +++ grub-0.97/stage2/disk_io.c 2006-07-21 10:58:25 +0400 @@ -130,7 +130,7 @@ static inline unsigned long grub_log2 (unsigned long word) { - asm volatile ("bsfl %1,%0" + asm volatile ("bsf %1,%0" : "=3Dr" (word) : "r" (word)); return word; --- grub-0.97/stage2/fsys_ext2fs.c.alt-x86_64-build 2006-07-21 10:58:25 +04= 00 +++ grub-0.97/stage2/fsys_ext2fs.c 2006-07-21 10:58:25 +0400 @@ -242,7 +242,7 @@ static __inline__ unsigned long ffz (unsigned long word) { - __asm__ ("bsfl %1,%0" + __asm__ ("bsf %1,%0" : "=3Dr" (word) : "r" (~word)); return word; --- grub-0.97/stage2/fsys_fat.c.alt-x86_64-build 2006-07-21 10:58:25 +0400 +++ grub-0.97/stage2/fsys_fat.c 2006-07-21 10:58:25 +0400 @@ -57,7 +57,7 @@ static __inline__ unsigned long grub_log2 (unsigned long word) { - __asm__ ("bsfl %1,%0" + __asm__ ("bsf %1,%0" : "=3Dr" (word) : "r" (word)); return word; --- grub-0.97/stage2/fsys_iso9660.c.alt-x86_64-build 2006-07-21 10:58:25 +0= 400 +++ grub-0.97/stage2/fsys_iso9660.c 2006-07-21 10:58:25 +0400 @@ -59,7 +59,7 @@ static inline unsigned long grub_log2 (unsigned long word) { - asm volatile ("bsfl %1,%0" + asm volatile ("bsf %1,%0" : "=3Dr" (word) : "r" (word)); return word; --- grub-0.97/stage2/fsys_reiserfs.c.alt-x86_64-build 2006-07-21 10:58:25 += 0400 +++ grub-0.97/stage2/fsys_reiserfs.c 2006-07-21 10:58:25 +0400 @@ -369,7 +369,7 @@ static __inline__ unsigned long grub_log2 (unsigned long word) { - __asm__ ("bsfl %1,%0" + __asm__ ("bsf %1,%0" : "=3Dr" (word) : "r" (word)); return word; --- grub-0.97/stage2/fsys_xfs.c.alt-x86_64-build 2005-05-08 06:15:55 +0400 +++ grub-0.97/stage2/fsys_xfs.c 2006-07-21 10:58:25 +0400 @@ -100,26 +100,16 @@ static inline __const__ xfs_uint16_t le16 (xfs_uint16_t x) { - __asm__("xchgb %b0,%h0" \ - : "=3Dq" (x) \ - : "0" (x)); \ - return x; + return ((x & 0x00ff) << 8) | ((x & 0xff00) >> 8 ); } =20 static inline __const__ xfs_uint32_t le32 (xfs_uint32_t x) { -#if 0 - /* 386 doesn't have bswap. */ - __asm__("bswap %0" : "=3Dr" (x) : "0" (x)); -#else - /* This is slower but this works on all x86 architectures. */ - __asm__("xchgb %b0, %h0" \ - "\n\troll $16, %0" \ - "\n\txchgb %b0, %h0" \ - : "=3Dq" (x) : "0" (x)); -#endif - return x; + return (((x & 0x000000ffUL) << 24) | + ((x & 0x0000ff00UL) << 8) | + ((x & 0x00ff0000UL) >> 8) | + ((x & 0xff000000UL) >> 24)); } =20 static inline __const__ xfs_uint64_t --- grub-0.97/stage2/smp-imps.c.alt-x86_64-build 2005-02-02 23:36:00 +0300 +++ grub-0.97/stage2/smp-imps.c 2006-07-21 11:01:30 +0400 @@ -270,7 +270,7 @@ /* * This contains the local APIC hardware address. */ -static unsigned imps_lapic_addr =3D ((unsigned) (&lapic_dummy)) - LAPIC_ID; +static unsigned long imps_lapic_addr =3D ((unsigned long) (&lapic_dummy)) = - LAPIC_ID; /* * These map from virtual cpu numbers to APIC id's and back. */ --- grub-0.97/grub/asmstub.c.alt-x86_64-build 2006-07-21 10:58:25 +0400 +++ grub-0.97/grub/asmstub.c 2006-07-21 10:58:25 +0400 @@ -105,6 +105,12 @@ static unsigned int serial_speed; #endif /* SIMULATE_SLOWNESS_OF_SERIAL */ =20 +#ifdef __x86_64__ +#define SP_REG "rsp" +#else +#define SP_REG "esp" +#endif + /* The main entry point into this mess. */ int grub_stage2 (void) @@ -122,7 +128,7 @@ void doit (void) { /* Make sure our stack lives in the simulated memory area. */ - asm volatile ("movl %%esp, %0\n\tmovl %1, %%esp\n" + asm volatile ("mov %%" SP_REG ", %0\n\tmov %1, %%" SP_REG "\n" : "=3D&r" (realstack) : "r" (simstack)); =20 /* Do a setjmp here for the stop command. */ @@ -140,7 +146,7 @@ } =20 /* Replace our stack before we use any local variables. */ - asm volatile ("movl %0, %%esp\n" : : "r" (realstack)); + asm volatile ("mov %0, %%" SP_REG "\n" : : "r" (realstack)); } =20 assert (grub_scratch_mem =3D=3D 0); --- grub-0.97-alt2/grub.spec 2006-05-31 11:51:47 +0000 +++ grub-0.97-alt2.0.1/grub.spec 2006-07-21 06:58:22 +0000 @@ -1,11 +1,11 @@ Name: grub Version: 0.97 -Release: alt2 +Release: alt2.0.1 =20 Summary: GRand Unified Bootloader License: GPL Group: System/Kernel and hardware -Exclusivearch: %ix86 +Exclusivearch: %ix86 x86_64 =20 Source: ftp://alpha.gnu.org/gnu/grub/%name-%version.tar #"grubonce" is script to demonstrate & ease "savedefault --once" @@ -46,12 +46,15 @@ Patch223: stage2-wildcard-doc.dif Patch224: grub-%{version}-protexec.patch Patch299: grub-0.97-stackptr.diff =20 +Patch1000: grub-0.97-alt-x86_64-m32.patch +Patch1001: grub-0.97-alt-x86_64-build.patch =20 Provides: %name-doc =3D %version, %name-graph =3D %version Obsoletes: %name-doc, %name-graph =20 # Automatically added by buildreq on Wed May 31 2006 -BuildRequires: libncurses-devel reiser4progs-minimal-devel tetex-latex +BuildRequires: libncurses-devel tetex-latex +# reiser4progs-minimal-devel =20 %package utils Group: System/Kernel and hardware @@ -81,8 +84,8 @@ Additional utilites for %name #%patch5 -p1 %patch6 -p1 %patch7 -p1 -%patch8 -p1 -%patch9 -p1 +#%patch8 -p1 +#%patch9 -p1 #SuSE: =20 rm -f acconfig.h || true @@ -90,7 +93,7 @@ rm -f acconfig.h || true %patch201 %patch202 -p1 %patch203 -p1 -%patch204 -p1 +###%patch204 -p1 %patch205 -p1 %patch206 -p1 %patch207 -p1 @@ -99,15 +102,18 @@ rm -f acconfig.h || true %patch210 -p1 %patch211 -p1 %patch212 -p1 -%patch213 -%patch214 +###%patch213 +###%patch214 # Disable the wildcard feature #%patch220 -p1 #%patch221 -p1 #%patch222 -p1 #%patch223 -p1 %patch224 -p1 -%patch299 +###%patch299 + +%patch1000 -p1 -b .alt-x86_64-m32 +%patch1001 -p1 -b .alt-x86_64-build =20 %build #rm -rf configure @@ -117,12 +123,15 @@ rm -f acconfig.h || true aclocal && autoheader && autoconf && automake --add-missing ### =20 -#%ifarch x86_64 -# EXTRACFLAGS=3D' -fno-strict-aliasing -minline-all-stringops -m32 -fno-a= synchronous-unwind-tables ' -#%else +%ifarch x86_64 + EXTRACFLAGS=3D' -fno-strict-aliasing -minline-all-stringops -fno-asynchr= onous-unwind-tables ' + STAGEx_CFLAGS=3D' -m32 ' +%else EXTRACFLAGS=3D' -fno-strict-aliasing -minline-all-stringops' -#%endif =20 -CFLAGS=3D"$RPM_OPT_FLAGS -Os -DNDEBUG -W -Wall -Wpointer-arith $EXTRACFLAG= S" ./configure \ + STAGEx_CFLAGS=3D +%endif =20 +CFLAGS=3D"$RPM_OPT_FLAGS -Os -DNDEBUG -W -Wall -Wpointer-arith $EXTRACFLAG= S" \ +STAGE1_CFLAGS=3D"$STAGEx_CFLAGS" STAGE2_CFLAGS=3D"$STAGEx_CFLAGS" ./config= ure \ --prefix=3D/usr --infodir=3D%{_infodir} --mandir=3D%{_mandir} --datadir= =3D%{_datadir} \ --libexecdir=3D%{_libexecdir} \ --disable-auto-linux-mem-opt --enable-diskless \ =F4=C1=CB =CF=CE=CF =C4=C5=CC=C1=C5=D4 =D7=C9=C4, =DE=D4=CF =D3=CF=C2=C9=D2= =C1=C5=D4=D3=D1, =CE=CF =CE=C1 =D3=C1=CD=CF=CD =C4=C5=CC=C5 =CE=C5 =D2=C1= =C2=CF=D4=C1=C5=D4. > > =F0=D2=CF=C2=CC=C5=CD=C1 =D7 =CE=C5=D7=CF=DA=CD=CF=D6=CE=CF=D3=D4=C9 = =D3=CF=C2=D2=C1=D4=D8 /usr/sbin/grub (=CB=D3=D4=C1=D4=C9, =C1 > > =D0=CF=DE=C5=CD=D5 =CF=CE =CC=C5=D6=C9=D4 =D7 /usr?), =D7 =D2=C5=DA=D5= =CC=D8=D4=C1=D4=C5 grub =CE=C5=DE=C5=CD =D5=D3=D4=C1=CE=CF=D7=C9=D4=D8 =CE= =C1 > > =C4=C9=D3=CB =D0=D2=C9 =DA=C1=D0=D5=DD=C5=CE=CE=CF=CA =D3=C9=D3=D4=C5= =CD=C5. >=20 > =EB=D4=CF =C2=D9 =CD=CE=C5 =CF=C2=DF=D1=D3=CE=C9=CC, =DA=C1=DE=C5=CD =CE= =D5=D6=C5=CE -m32 =D7 /usr/sbin/grub? char *stage2_first_buffer =3D ... int i; ... i =3D (int) stage2_first_buffer + SECTOR_SIZE - 4; while (*((unsigned long *) i)) { if (i < (int) stage2_first_buffer || (*((int *) (i - 4)) & 0x80000000) || *((unsigned short *) i) >=3D 0xA00 || *((short *) (i + 2)) =3D=3D 0) { errnum =3D ERR_BAD_VERSION; goto fail; } =20 *((int *) i) =3D 0; *((int *) (i - 4)) =3D 0; i -=3D 8; } =E9 =D4=C1=CB=CF=C7=CF =CB=CF=C4=C1 =D4=C1=CD =CB=D5=DE=C1. --SUk9VBj82R8Xhb8H Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFFirKbW82GfkQfsqIRAiVeAJwOZzmFKIj6gu46lRpDt1oLUuckMQCffz2e UT7A7OCzO6Hdtt35M0Q4ijI= =6MKe -----END PGP SIGNATURE----- --SUk9VBj82R8Xhb8H--