Re: Building amd64/k8 kernel from 32-bit userspace

2005-10-27 Thread Dave Ewart
On Wednesday, 26.10.2005 at 12:18 +0100, Dave Ewart wrote:

   [...]
  
   However, when I try to install this for the host system, this error
   occurs:
  
   # dpkg -i kernel-image-2.6.12_+davee.1.0_amd64.deb 
  
   dpkg: error processing kernel-image-2.6.12_+davee.1.0_amd64.deb 
   (--install):
package architecture (amd64) does not match system (i386)
   Errors were encountered while processing:
kernel-image-2.6.12_+davee.1.0_amd64.deb
  
  That is correct. You compiled on amd64 and for amd64. Try mount --bind
  /boot /chroot/boot and install the kernel inside the chroot.
  
  Alternatively dpkg --force-architecture.
  
  Or you can change the architecture of the deb with (from memory)
  
  echo '#!/bin/sh' /tmp/foo.sh
  echo sed -i 's/Architecture: amd64/Architecture: i386/' DEBIAN/control 
  /tmp/foo.sh
  chmod a+x /tmp/foo.sh
  fakeroot dpkg-reversion -k /tmp/foo.sh 
  kernel-image-2.6.12_+davee.1.0_amd64.deb change arch to i386
 
 OK, will try those methods.  As a result of your second post here, I
 will dispute your remark above which says That way it all just
 magically works. :-)

Hmmm, the kernels can be installed as above, but don't seem to behave
very well.  Perhaps I'll give up on this for now and try to seek out
some other precompiled kernel images for amd64 ...

Thanks for your help, anyway.

Dave.
-- 
Dave Ewart
[EMAIL PROTECTED]
Computing Manager, Cancer Epidemiology Unit
Cancer Research UK / Oxford University
PGP: CC70 1883 BD92 E665 B840 118B 6E94 2CFD 694D E370
Get key from http://www.ceu.ox.ac.uk/~davee/davee-ceu-ox-ac-uk.asc
N 51.7518, W 1.2016


signature.asc
Description: Digital signature


Re: Building amd64/k8 kernel from 32-bit userspace

2005-10-26 Thread Dave Ewart
On Tuesday, 25.10.2005 at 10:56 +0100, Dave Ewart wrote:

 On Tuesday, 25.10.2005 at 11:36 +0200, Goswin von Brederlow wrote:
 
  The recommended (and only user friendly) way to build a 64bit kernel
  is a 64bit userland.
  
  For i386 users that means installing the existing 64bit kernel, create
  a 64bit chroot and compile the kernel in there.
  
  That way it all just magically works.
 
 That makes sense.  The slight difficulty here is that the existing
 64-bit kernel, Debian stock package, kicks off a hardware conflict on my
 machine with my nVidia card.
 
 Maybe I can just run it in non-graphical mode for long enough to build a
 chroot and build a kernel in it.  I guess that for *subsequent* kernel
 rebuilds, this will be easier, since I'll have a running 64-bit kernel
 :-)

This still doesn't seem to quite work.

Build environment:

Host system:  running stock Debian kernel 2.6.8-11-amd64-k8
  32-bit userspace
  64-bit Sarge chroot
Sarge chroot: gcc 3.4
  building kernel 2.6.12 from Debian source package

This build in the chroot works: I get kernel-image-2.6.12_+davee.1.0_amd64.deb 
created

However, when I try to install this for the host system, this error
occurs:

# dpkg -i kernel-image-2.6.12_+davee.1.0_amd64.deb 

dpkg: error processing kernel-image-2.6.12_+davee.1.0_amd64.deb (--install):
 package architecture (amd64) does not match system (i386)
Errors were encountered while processing:
 kernel-image-2.6.12_+davee.1.0_amd64.deb

The package info for my newly created kernel includes the following:

# dpkg -I kernel-image-2.6.12_+davee.1.0_amd64.deb
[...]
Architecture: amd64

However, the existing pre-packaged Debian kernel is different:

# apt-cache show kernel-image-2.6.8-11-amd64-k8
[...]
Architecture: i386

So, my built kernel has different characteristics from the pre-packaged
one, which may explain why I am having difficulties.

Can anyone shed any more light on this?

Cheers,

Dave.
-- 
Dave Ewart
[EMAIL PROTECTED]
Computing Manager, Cancer Epidemiology Unit
Cancer Research UK / Oxford University
PGP: CC70 1883 BD92 E665 B840 118B 6E94 2CFD 694D E370
Get key from http://www.ceu.ox.ac.uk/~davee/davee-ceu-ox-ac-uk.asc
N 51.7518, W 1.2016


signature.asc
Description: Digital signature


Re: Building amd64/k8 kernel from 32-bit userspace

2005-10-26 Thread Dave Ewart
On Wednesday, 26.10.2005 at 11:32 +0200, Goswin von Brederlow wrote:

   The recommended (and only user friendly) way to build a 64bit kernel
   is a 64bit userland.
   
   For i386 users that means installing the existing 64bit kernel, create
   a 64bit chroot and compile the kernel in there.
   
   That way it all just magically works.
  
  That makes sense.  The slight difficulty here is that the existing
  64-bit kernel, Debian stock package, kicks off a hardware conflict on my
  machine with my nVidia card.
  
  Maybe I can just run it in non-graphical mode for long enough to build a
  chroot and build a kernel in it.  I guess that for *subsequent* kernel
  rebuilds, this will be easier, since I'll have a running 64-bit kernel
  :-)
 
  This still doesn't seem to quite work.
 
  Build environment:
 
  Host system:  running stock Debian kernel 2.6.8-11-amd64-k8
32-bit userspace
64-bit Sarge chroot
  Sarge chroot: gcc 3.4
building kernel 2.6.12 from Debian source package
 
  This build in the chroot works: I get 
  kernel-image-2.6.12_+davee.1.0_amd64.deb created
 
  However, when I try to install this for the host system, this error
  occurs:
 
  # dpkg -i kernel-image-2.6.12_+davee.1.0_amd64.deb 
 
  dpkg: error processing kernel-image-2.6.12_+davee.1.0_amd64.deb 
  (--install):
   package architecture (amd64) does not match system (i386)
  Errors were encountered while processing:
   kernel-image-2.6.12_+davee.1.0_amd64.deb
 
 That is correct. You compiled on amd64 and for amd64. Try mount --bind
 /boot /chroot/boot and install the kernel inside the chroot.
 
 Alternatively dpkg --force-architecture.
 
 Or you can change the architecture of the deb with (from memory)
 
 echo '#!/bin/sh' /tmp/foo.sh
 echo sed -i 's/Architecture: amd64/Architecture: i386/' DEBIAN/control 
 /tmp/foo.sh
 chmod a+x /tmp/foo.sh
 fakeroot dpkg-reversion -k /tmp/foo.sh 
 kernel-image-2.6.12_+davee.1.0_amd64.deb change arch to i386

OK, will try those methods.  As a result of your second post here, I
will dispute your remark above which says That way it all just
magically works. :-)

Thanks again, Goswin, much appreciated.

Dave.
-- 
Dave Ewart
[EMAIL PROTECTED]
Computing Manager, Cancer Epidemiology Unit
Cancer Research UK / Oxford University
PGP: CC70 1883 BD92 E665 B840 118B 6E94 2CFD 694D E370
Get key from http://www.ceu.ox.ac.uk/~davee/davee-ceu-ox-ac-uk.asc
N 51.7518, W 1.2016


signature.asc
Description: Digital signature


Re: Building amd64/k8 kernel from 32-bit userspace

2005-10-25 Thread Dave Ewart
On Monday, 24.10.2005 at 23:01 +0100, Paul Brook wrote:

 On Monday 24 October 2005 22:35, Max wrote:
  Dave Ewart wrote:
   Is it because I have a 32-bit i686 userspace and this is
   considered cross-compiling or something??
 
   From old version of FAQ:
 
  ===
 
  *Crosscompiling a 64bit kernel on a 32bit host*
 
 snip
 
 Most of this is obsolete. The Debian i386 gcc-3.4 packages have biarch amd64 
 support.

So what does that actually mean for the compilation process?

I found, after failing to build an amd64-k8 kernel with gcc 3.3, that
using gcc 3.4 did no better.

Do I need to do anything 'different' during the kernel build to make it
build an amd64-k8 kernel?

I'm currently doing this:

make-kpkg clean
make menuconfig (setting pc-arch/amd64/k8 etc.)
make-kpkg kernel_image

This results in the i686 kernel I described previously.

Do I need to give further options to the above kernel-building commands
to make it produce an amd64-k8 version?

Dave.
-- 
Dave Ewart
[EMAIL PROTECTED]
Computing Manager, Cancer Epidemiology Unit
Cancer Research UK / Oxford University
PGP: CC70 1883 BD92 E665 B840 118B 6E94 2CFD 694D E370
Get key from http://www.ceu.ox.ac.uk/~davee/davee-ceu-ox-ac-uk.asc
N 51.7518, W 1.2016


signature.asc
Description: Digital signature


Re: Building amd64/k8 kernel from 32-bit userspace

2005-10-25 Thread Goswin von Brederlow
Max [EMAIL PROTECTED] writes:

 Paul Brook wrote:

 Is it because I have a 32-bit i686 userspace and this is
 considered cross-compiling or something??
  From old version of FAQ:

 ===

 *Crosscompiling a 64bit kernel on a 32bit host*
 snip
 Most of this is obsolete. The Debian i386 gcc-3.4 packages have
 biarch amd64 support.

 Shouldn't that be included in the FAQ?

 Thanks,
 Max

No.

The recommended (and only user friendly) way to build a 64bit kernel
is a 64bit userland.

For i386 users that means installing the existing 64bit kernel, create
a 64bit chroot and compile the kernel in there.

That way it all just magically works.

MfG
Goswin


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Building amd64/k8 kernel from 32-bit userspace

2005-10-25 Thread Dave Ewart
On Tuesday, 25.10.2005 at 11:36 +0200, Goswin von Brederlow wrote:

 The recommended (and only user friendly) way to build a 64bit kernel
 is a 64bit userland.
 
 For i386 users that means installing the existing 64bit kernel, create
 a 64bit chroot and compile the kernel in there.
 
 That way it all just magically works.

That makes sense.  The slight difficulty here is that the existing
64-bit kernel, Debian stock package, kicks off a hardware conflict on my
machine with my nVidia card.

Maybe I can just run it in non-graphical mode for long enough to build a
chroot and build a kernel in it.  I guess that for *subsequent* kernel
rebuilds, this will be easier, since I'll have a running 64-bit kernel
:-)

Thanks Goswin

Dave.
-- 
Dave Ewart
[EMAIL PROTECTED]
Computing Manager, Cancer Epidemiology Unit
Cancer Research UK / Oxford University
PGP: CC70 1883 BD92 E665 B840 118B 6E94 2CFD 694D E370
Get key from http://www.ceu.ox.ac.uk/~davee/davee-ceu-ox-ac-uk.asc
N 51.7518, W 1.2016


signature.asc
Description: Digital signature


Building amd64/k8 kernel from 32-bit userspace

2005-10-24 Thread Dave Ewart
I'm running a 32-bit Sarge on an Athlon-64 system.  I was previously
using the kernel-image-2.6.8-11-amd64-k8 kernel, but to solve a hardware
conflict I needed to build my own kernel.

In doing so, I have solved the hardware conflict.  However, I notice
that my running kernel is described by 'uname' as follows:

Linux .. 2.6.12+davee .. i686 GNU/Linux

This suggests I have an i686 kernel, not an amd64-k8 kernel.  I've
double-checked the kernel config and it is correctly set:

CONFIG_MK8=y

The resulting kernel packages produced by make-kpkg all include 'i386'
in the name and since 'uname' shows me 'i686', I can only assume that
the optimization for amd64-k8 hasn't been done.

This kernel appears to *run* fine, but why can't I build one for
amd64-k8?  Is it because I have a 32-bit i686 userspace and this is
considered cross-compiling or something??

OS details: fresh Debian Sarge, gcc 3.3.5

Any hints gratefully received.

Cheers,

Dave.
-- 
Dave Ewart
[EMAIL PROTECTED]
Computing Manager, Cancer Epidemiology Unit
Cancer Research UK / Oxford University
PGP: CC70 1883 BD92 E665 B840 118B 6E94 2CFD 694D E370
Get key from http://www.ceu.ox.ac.uk/~davee/davee-ceu-ox-ac-uk.asc
N 51.7518, W 1.2016


signature.asc
Description: Digital signature


Re: Building amd64/k8 kernel from 32-bit userspace

2005-10-24 Thread Lennart Sorensen
On Mon, Oct 24, 2005 at 08:15:32PM +0100, Dave Ewart wrote:
 I'm running a 32-bit Sarge on an Athlon-64 system.  I was previously
 using the kernel-image-2.6.8-11-amd64-k8 kernel, but to solve a hardware
 conflict I needed to build my own kernel.
 
 In doing so, I have solved the hardware conflict.  However, I notice
 that my running kernel is described by 'uname' as follows:
 
 Linux .. 2.6.12+davee .. i686 GNU/Linux
 
 This suggests I have an i686 kernel, not an amd64-k8 kernel.  I've
 double-checked the kernel config and it is correctly set:
 
 CONFIG_MK8=y
 
 The resulting kernel packages produced by make-kpkg all include 'i386'
 in the name and since 'uname' shows me 'i686', I can only assume that
 the optimization for amd64-k8 hasn't been done.
 
 This kernel appears to *run* fine, but why can't I build one for
 amd64-k8?  Is it because I have a 32-bit i686 userspace and this is
 considered cross-compiling or something??

It _is_ cross compiling to build amd64 binaries on i386.  Different
architecture after all.

 OS details: fresh Debian Sarge, gcc 3.3.5
 
 Any hints gratefully received.

I believe you also MUST use gcc-3.4 or higher when building amd64
kernels.

Len Sorensen


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Building amd64/k8 kernel from 32-bit userspace

2005-10-24 Thread Dave Ewart
On Monday, 24.10.2005 at 15:43 -0400, Lennart Sorensen wrote:

  OS details: fresh Debian Sarge, gcc 3.3.5
  
  Any hints gratefully received.
 
 I believe you also MUST use gcc-3.4 or higher when building amd64
 kernels.

Ah, gcc-3.4.

That sounds helpful.  I'll check that out, thanks.

Dave.
-- 
Dave Ewart
[EMAIL PROTECTED]
Computing Manager, Cancer Epidemiology Unit
Cancer Research UK / Oxford University
PGP: CC70 1883 BD92 E665 B840 118B 6E94 2CFD 694D E370
Get key from http://www.ceu.ox.ac.uk/~davee/davee-ceu-ox-ac-uk.asc
N 51.7518, W 1.2016


signature.asc
Description: Digital signature


Re: Building amd64/k8 kernel from 32-bit userspace

2005-10-24 Thread Max

Dave Ewart wrote:

Is it because I have a 32-bit i686 userspace and this is
considered cross-compiling or something??


From old version of FAQ:

===

*Crosscompiling a 64bit kernel on a 32bit host*

In order to get full advantage of the x86_64 architecture, you need to build a 
kernel which supports the 64bit extensions.

You should use the latest 2.6 kernel, since the amd64 support is much better 
than in the 2.4 series.

You may not want to use the debian kernel, since support for the widely-used 
tigon3 based network interfaces (some 3Com 940s, Broadcom 57xx) has been 
dropped by the debian kernel maintainer, but this depends on which mainboard 
and network interface card you are going to install.

*Installing the woody chroot*

Since the cross-compile packages on alioth are built from old Sarge versions, you need to 
install a woody chroot first. Note that you need woody and not Sarge, because the biarch 
packages are based on an old Sarge version no longer in the archive. As a result, you 
will not be able to install the alioth biarch packages into an actual testing or unstable 
chroot. Upgrading an already installed biarch chroot to unstable or testing will 
upgrade the toolchain to a non-biarch version at least, if not render your 
chroot entirely unusable.

Follow the instructions found at Debian Reference Manual 8.6.33 or the 
(c)debootstrap documentation for a complete explanation of how to set up a 
chroot environment.

In short:

*  mkdir /chroot-woody ;
cdebootstrap woody /chroot-woody http://ftp.de.debian.org/debian

* cp /etc/resolv.conf /etc/hostname /chroot-woody/etc/

* chroot /chroot-woody

* mount -t proc proc /proc

* unset LC_CTYPE ; base-config

Installing the cross-compile environment

* add
deb http://debian-amd64.alioth.debian.org/biarch/ sarge main
to your /etc/apt/sources.list which should already point to woody.

* run
apt-get update ; apt-get install libc6 libc6-dev lib64c6
lib64c6-dev libncurses5 libncurses5-dev \
lib64ncurses5 lib64ncurses5-dev gcc gcc-3.3 g++-3.3 patch make
devscripts dpkg-dev wget bzip2

* wget the latest 2.6 kernel from http://www.kernel.org/ and untar it
to /usr/src, or wherever you usually build your kernels.

*The gcc wrapper*

You need to get a gcc wrapper in order to crosscompile on a i386 host.
This wrapper is found at
http://www.jukie.net/~bart/debian/amd64/scripts/gcc.bart
You can simply delete the /usr/bin/gcc symlink and move the wrapper
there. Configuring the kernel

make HOSTCC=gcc -m32 ARCH=x86_64 menuconfig

Be sure to include IA32 emulation, otherwise you will not be able to run 
multiarch or i386 binaries on your host system or in a chroot. And for 
simplicity, build a monolithic kernel without any modules.

make HOSTCC=gcc -m32 ARCH=x86_64 bzImage

If everything goes well, you will end up with the following message:

Kernel: arch/x86_64/boot/bzImage is ready

You can now install the kernel as usual. Keep your old 32bit kernel in the 
lilo/grub configuration, so you can switch back if something went wrong. Be 
sure to load the initrd only with your old debian-installer kernel, if you 
installed that way. If everything goes well, you will be running a 32bit 
userland with a 64bit kernel, and can proceed with the installation of pure64 
if you want to.

===

Max


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Building amd64/k8 kernel from 32-bit userspace

2005-10-24 Thread Paul Brook
On Monday 24 October 2005 22:35, Max wrote:
 Dave Ewart wrote:
  Is it because I have a 32-bit i686 userspace and this is
  considered cross-compiling or something??

  From old version of FAQ:

 ===

 *Crosscompiling a 64bit kernel on a 32bit host*

snip

Most of this is obsolete. The Debian i386 gcc-3.4 packages have biarch amd64 
support.

Paul


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Building amd64/k8 kernel from 32-bit userspace

2005-10-24 Thread Max

Paul Brook wrote:


Is it because I have a 32-bit i686 userspace and this is
considered cross-compiling or something??

 From old version of FAQ:

===

*Crosscompiling a 64bit kernel on a 32bit host*


snip

Most of this is obsolete. The Debian i386 gcc-3.4 packages have biarch amd64 
support.


Shouldn't that be included in the FAQ?

Thanks,
Max


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]