Google Группы больше не поддерживают новые публикации и подписки в сети Usenet. Опубликованный ранее контент останется доступен.

[gentoo-user] chroot: cannot run command `bin/bash': Exec format error

972 просмотра
Перейти к первому непрочитанному сообщению

Bo Andresen

не прочитано,
22 февр. 2006 г., 18:10:1922.02.2006
Hi

I have just purchased a new computer with a AMD Semphron 2800+ 64 bit
processor. I am installing it following the gentoo handbook of the amd64
architecture - only I am using the x86 minimal livecd (2005-r1) and the
stage3-amd64-2005.1-r1.tar.bz2 tarball. Shouldn that be a problem?

When I get to step 6a (chrooting)
http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=1&chap=6#doc_chap1
I get the following error:

livecd gentoo # chroot /mnt/gentoo bin/bash
chroot: cannot run command `bin/bash': Exec format error

I did use LVM2 for partitioning but other than that I have followed the
handbook very throughly. I hope someone has a solution. Please feel free to
ask for any information that may be helpful.

--
Bo Andresen
--
gento...@gentoo.org mailing list

John Jolet

не прочитано,
22 февр. 2006 г., 18:20:1222.02.2006


On 2/22/06 5:03 PM, "Bo Andresen" <bo.an...@gmail.com> wrote:

> Hi
>
> I have just purchased a new computer with a AMD Semphron 2800+ 64 bit
> processor. I am installing it following the gentoo handbook of the amd64
> architecture - only I am using the x86 minimal livecd (2005-r1) and the
> stage3-amd64-2005.1-r1.tar.bz2 tarball. Shouldn that be a problem?
>
> When I get to step 6a (chrooting)
> http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=1&chap=6#doc_cha
> p1
> I get the following error:
>
> livecd gentoo # chroot /mnt/gentoo bin/bash
> chroot: cannot run command `bin/bash': Exec format error

I've seen that when chrooting into 64-bit environment from a 32-bit kernel.
You cannot boot from the x86 minimal and use an amd64 stage file. You need
the amd64 boot cd.


>
> I did use LVM2 for partitioning but other than that I have followed the
> handbook very throughly. I hope someone has a solution. Please feel free to
> ask for any information that may be helpful.


--
gento...@gentoo.org mailing list

Boris Fersing

не прочитано,
22 февр. 2006 г., 18:30:1222.02.2006
2006/2/23, Bo Andresen <bo.an...@gmail.com>:
> Hi
>
Hi,

> I have just purchased a new computer with a AMD Semphron 2800+ 64 bit
> processor. I am installing it following the gentoo handbook of the amd64
> architecture - only I am using the x86 minimal livecd (2005-r1) and the
> stage3-amd64-2005.1-r1.tar.bz2 tarball. Shouldn that be a problem?
>
> When I get to step 6a (chrooting)
> http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=1&chap=6#doc_chap1
> I get the following error:
>
> livecd gentoo # chroot /mnt/gentoo bin/bash
> chroot: cannot run command `bin/bash': Exec format error

You'll have to boot on a 64bits liveCD if you want to chroot into a
64bits environment.

Regards,

Boris.


> --
> Bo Andresen
> --
> gento...@gentoo.org mailing list
>
>
>


--
Quiconque me parle de Dieu en veut à ma bourse ou à ma liberté.

--
gento...@gentoo.org mailing list

Mick

не прочитано,
22 февр. 2006 г., 18:40:0522.02.2006
John Jolet wrote:

At the same time when you run a command you need to type the path to it
correctly. In this case the path is preceded by /, as in:
============================
/bin/bash
============================

You really need to double check commands before you hit return as it is easy
to miss a character and the whole sequence goes to pot.
--
Regards,
Mick

--
gento...@gentoo.org mailing list

Bo Andresen

не прочитано,
22 февр. 2006 г., 18:50:1322.02.2006
On Thursday 23 February 2006 00:28, Mick wrote:
> At the same time when you run a command you need to type the path to it
> correctly. In this case the path is preceded by /, as in:
> ============================
> /bin/bash
> ============================
>
> You really need to double check commands before you hit return as it is
> easy to miss a character and the whole sequence goes to pot.

At first I ran:
chroot /mnt/gentoo /bin/bash

When I got the error message I tried without the first slash since it couldn't
do any damage to test it. Same error. By mistake it was the last command that
went in the mail.

I guess I have to burn yet another cd then. :( Well, as longs as it works. Did
suspect that was the problem. Wanted to be sure though.

Boyd Stephen Smith Jr.

не прочитано,
22 февр. 2006 г., 18:50:1522.02.2006
On Wednesday 22 February 2006 17:03, Bo Andresen <bo.an...@gmail.com>
wrote about '[gentoo-user] chroot: cannot run command `bin/bash': Exec
format error':

> I have just purchased a new computer with a AMD Semphron 2800+ 64 bit
> processor. I am installing it following the gentoo handbook of the amd64
> architecture - only I am using the x86 minimal livecd (2005-r1) and the
> stage3-amd64-2005.1-r1.tar.bz2 tarball. Shouldn that be a problem?

Definitely a problem.

> livecd gentoo # chroot /mnt/gentoo bin/bash
> chroot: cannot run command `bin/bash': Exec format error

Your 32-but kernel can't run the 64-bit bash. You'll have to use a 64-bit
kernel (or as 32-bit stage3, and then gradually recompile)

> I did use LVM2 for partitioning but other than that I have followed the
> handbook very throughly. I hope someone has a solution. Please feel
> free to ask for any information that may be helpful.

If you have a little bit of free space, do a 32-bit install to a separate
LV. No need to really do a full install, just enough so you can compile a
64-bit kernel and install and configure your bootloader to load the 64-bit
kernel.

That should be as easy as lvcreate, format, mount, extract 32-bit stage3,
cp over /etc/resolv.conf, chroot, emerge <your_favorite>-sources,
cd /usr/src/<whatever>, zcat /proc/config.gz > .config, make oldconfig,
make, emerge grub, mount /boot, grub-install, make install, umount boot,
shutdown -r now.

(Maybe a few steps I'm missing, and I don't mess with (e)lilo.)

--
Boyd Stephen Smith Jr.
bs...@volumehost.com
ICQ: 514984 YM/AIM: DaTwinkDaddy
--
gento...@gentoo.org mailing list

Bo Andresen

не прочитано,
22 февр. 2006 г., 19:00:2322.02.2006
On Thursday 23 February 2006 00:42, Boyd Stephen Smith Jr. wrote:
> Your 32-but kernel can't run the 64-bit bash. You'll have to use a 64-bit
> kernel (or as 32-bit stage3, and then gradually recompile)

Thanks for explaining that.

> If you have a little bit of free space, do a 32-bit install to a separate
> LV. No need to really do a full install, just enough so you can compile a
> 64-bit kernel and install and configure your bootloader to load the 64-bit
> kernel.
>
> That should be as easy as lvcreate, format, mount, extract 32-bit stage3,
> cp over /etc/resolv.conf, chroot, emerge <your_favorite>-sources,
> cd /usr/src/<whatever>, zcat /proc/config.gz > .config, make oldconfig,
> make, emerge grub, mount /boot, grub-install, make install, umount boot,
> shutdown -r now.

Is that all it takes? I'll definitely try that then. Thanks again.

Boyd Stephen Smith Jr.

не прочитано,
23 февр. 2006 г., 17:00:3323.02.2006
On Thursday 23 February 2006 15:31, Bo Andresen <bo.an...@gmail.com>
wrote about 'Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec
format error':

> On Thursday 23 February 2006 00:42, Boyd Stephen Smith Jr. wrote:
> > > livecd gentoo # chroot /mnt/gentoo bin/bash
> > > chroot: cannot run command `bin/bash': Exec format error
> >
> > Your 32-but kernel can't run the 64-bit bash. You'll have to use a
> > 64-bit kernel (or as 32-bit stage3, and then gradually recompile)
>
> Will a 64 bit kernel be able to run a 32 bit bash?

A 64-bit kernel will run 32-bit binaries fine... Um, there may be a needed
kernel option though... CONFIG_IA32_EMUL? Anyone?

> In order to get a 64
> bit kernel a have to set CFLAGS=-march=k8

Your CFLAGS in make.conf don't affect your kernel, normally. I don't use
genkernel maybe it does some crazy magic like that.

> and set the processor type to
> K8 in the kernel configuration, right?

Just setting the proper processor type should build your kernel as 64-bit.

Bo Andresen

не прочитано,
23 февр. 2006 г., 17:00:5223.02.2006
On Thursday 23 February 2006 00:42, Boyd Stephen Smith Jr. wrote:
> > livecd gentoo # chroot /mnt/gentoo bin/bash
> > chroot: cannot run command `bin/bash': Exec format error
>
> Your 32-but kernel can't run the 64-bit bash. You'll have to use a 64-bit
> kernel (or as 32-bit stage3, and then gradually recompile)

Will a 64 bit kernel be able to run a 32 bit bash? In order to get a 64 bit
kernel a have to set CFLAGS=-march=k8 and set the processor type to K8 in the
kernel configuration, right?

--

Bo Andresen

не прочитано,
23 февр. 2006 г., 17:00:5623.02.2006
On Thursday 23 February 2006 22:40, Boyd Stephen Smith Jr. wrote:
> On Thursday 23 February 2006 15:31, Bo Andresen <bo.an...@gmail.com>
> wrote about 'Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec
>
> format error':
> > On Thursday 23 February 2006 00:42, Boyd Stephen Smith Jr. wrote:
> > > > livecd gentoo # chroot /mnt/gentoo bin/bash
> > > > chroot: cannot run command `bin/bash': Exec format error
[SNIP]

> > Will a 64 bit kernel be able to run a 32 bit bash?
>
> A 64-bit kernel will run 32-bit binaries fine... Um, there may be a needed
> kernel option though... CONFIG_IA32_EMUL? Anyone?

I cannot seem to find any such kernel config option.

> > In order to get a 64
> > bit kernel a have to set CFLAGS=-march=k8
>
> Your CFLAGS in make.conf don't affect your kernel, normally.

Didn't really think so either. It's just that I still get the Exec format
error when I try to chroot. Is there a way to very that I really am running a
64 kernel?

> I don't use
> genkernel maybe it does some crazy magic like that.

I don't either.

> > and set the processor type to
> > K8 in the kernel configuration, right?
>
> Just setting the proper processor type should build your kernel as 64-bit.

Did do that.

Thanks for your replies..

Boyd Stephen Smith Jr.

не прочитано,
23 февр. 2006 г., 17:40:2023.02.2006
On Thursday 23 February 2006 15:56, Bo Andresen <bo.an...@gmail.com>
wrote about 'Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec
format error':
> > > Will a 64 bit kernel be able to run a 32 bit bash?
> >
> > A 64-bit kernel will run 32-bit binaries fine... Um, there may be a
> > needed kernel option though... CONFIG_IA32_EMUL? Anyone?
>
> I cannot seem to find any such kernel config option.

I think these are relevant:
$ zgrep -i ia32 /proc/config.gz
CONFIG_IA32_EMULATION=y
CONFIG_IA32_AOUT=y

> > > In order to get a 64
> > > bit kernel a have to set CFLAGS=-march=k8
> >
> > Your CFLAGS in make.conf don't affect your kernel, normally.
>
> Didn't really think so either. It's just that I still get the Exec
> format error when I try to chroot. Is there a way to very that I really
> am running a 64 kernel?

I believe this tells you:
$ uname -m
x86_64

> > > and set the processor type to
> > > K8 in the kernel configuration, right?
> >
> > Just setting the proper processor type should build your kernel as
> > 64-bit.
>
> Did do that.

The only thing I can't think of at this point is something from the gentoo
cross compile howto from vapier that may or may not apply:

"If you want to cross compile a kernel, do this:
make ARCH=hppa CROSS_COMPILE=hppa2.0-unknown-linux-gnu-"

So, you may want to configure, make, and install your kernel like:
make ARCH=x86_64 menuconfig
make ARCH=x86_64
make ARCH=x86_64 install

(You don't need a CROSS_COMPILE prefix since gcc should work fine.)

Bo Andresen

не прочитано,
23 февр. 2006 г., 18:30:1523.02.2006
On Thursday 23 February 2006 23:33, Boyd Stephen Smith Jr. wrote:
> On Thursday 23 February 2006 15:56, Bo Andresen <bo.an...@gmail.com>
> > > A 64-bit kernel will run 32-bit binaries fine... Um, there may be a
> > > needed kernel option though... CONFIG_IA32_EMUL? Anyone?
> >
> > I cannot seem to find any such kernel config option.
>
> I think these are relevant:
> $ zgrep -i ia32 /proc/config.gz
> CONFIG_IA32_EMULATION=y
> CONFIG_IA32_AOUT=y

I cannot find those options.

~ # zcat /proc/config.gz | grep -i '32\|k8'
CONFIG_X86_32=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_MK8=y
# CONFIG_SCSI_QLA2322 is not set
# CONFIG_SCSI_NSP32 is not set
# CONFIG_PCNET32 is not set
# CONFIG_USB_SERIAL_MCT_U232 is not set
# CONFIG_NLS_CODEPAGE_932 is not set
CONFIG_CRYPTO_CRC32C=m
CONFIG_CRC32=y
CONFIG_LIBCRC32C=m

I notice CONFIG_X86_32=y but cannot figure out where to change that in make
menuconfig. Typing /X86_32 just gives this as a search result:

Symbol: X86_32 [=y]

> > Is there a way to verify that I really


> > am running a 64 kernel?
>
> I believe this tells you:
> $ uname -m
> x86_64

~ # uname -m
i686

> So, you may want to configure, make, and install your kernel like:
> make ARCH=x86_64 menuconfig
> make ARCH=x86_64
> make ARCH=x86_64 install
>
> (You don't need a CROSS_COMPILE prefix since gcc should work fine.)

Should I ignore all these warnings?

# make ARCH=x86_64 menuconfig
scripts/kconfig/mconf arch/x86_64/Kconfig
#
# using defaults found in .config
#
.config:90:warning: trying to assign nonexistent symbol X86_ELAN
.config:91:warning: trying to assign nonexistent symbol X86_VOYAGER
.config:93:warning: trying to assign nonexistent symbol X86_SUMMIT
.config:94:warning: trying to assign nonexistent symbol X86_BIGSMP
.config:96:warning: trying to assign nonexistent symbol X86_GENERICARCH
.config:97:warning: trying to assign nonexistent symbol X86_ES7000
.config:98:warning: trying to assign nonexistent symbol M386
.config:99:warning: trying to assign nonexistent symbol M486
.config:100:warning: trying to assign nonexistent symbol M586
.config:101:warning: trying to assign nonexistent symbol M586TSC
.config:102:warning: trying to assign nonexistent symbol M586MMX
.config:103:warning: trying to assign nonexistent symbol M686
.config:104:warning: trying to assign nonexistent symbol MPENTIUMII
.config:105:warning: trying to assign nonexistent symbol MPENTIUMIII
.config:106:warning: trying to assign nonexistent symbol MPENTIUMM
.config:107:warning: trying to assign nonexistent symbol MPENTIUM4
.config:108:warning: trying to assign nonexistent symbol MK6
.config:109:warning: trying to assign nonexistent symbol MK7
.config:111:warning: trying to assign nonexistent symbol MCRUSOE
.config:112:warning: trying to assign nonexistent symbol MEFFICEON
.config:113:warning: trying to assign nonexistent symbol MWINCHIPC6
.config:114:warning: trying to assign nonexistent symbol MWINCHIP2
.config:115:warning: trying to assign nonexistent symbol MWINCHIP3D
.config:116:warning: trying to assign nonexistent symbol MGEODEGX1
.config:117:warning: trying to assign nonexistent symbol MCYRIXIII
.config:118:warning: trying to assign nonexistent symbol MVIAC3_2
.config:119:warning: trying to assign nonexistent symbol X86_GENERIC
.config:121:warning: trying to assign nonexistent symbol X86_XADD
.config:125:warning: trying to assign nonexistent symbol X86_WP_WORKS_OK
.config:126:warning: trying to assign nonexistent symbol X86_INVLPG
.config:127:warning: trying to assign nonexistent symbol X86_BSWAP
.config:128:warning: trying to assign nonexistent symbol X86_POPAD_OK
.config:129:warning: trying to assign nonexistent symbol X86_CMPXCHG64
.config:131:warning: trying to assign nonexistent symbol X86_INTEL_USERCOPY
.config:132:warning: trying to assign nonexistent symbol X86_USE_PPRO_CHECKSUM
.config:140:warning: trying to assign nonexistent symbol X86_UP_APIC
.config:141:warning: trying to assign nonexistent symbol X86_UP_IOAPIC
.config:145:warning: trying to assign nonexistent symbol X86_MCE_NONFATAL
.config:146:warning: trying to assign nonexistent symbol X86_MCE_P4THERMAL
.config:147:warning: trying to assign nonexistent symbol TOSHIBA
.config:148:warning: trying to assign nonexistent symbol I8K
.config:149:warning: trying to assign nonexistent symbol X86_REBOOTFIXUPS
.config:160:warning: trying to assign nonexistent symbol NOHIGHMEM
.config:161:warning: trying to assign nonexistent symbol HIGHMEM4G
.config:174:warning: trying to assign nonexistent symbol REGPARM
.config:220:warning: trying to assign nonexistent symbol APM
.config:231:warning: trying to assign nonexistent symbol PCI_GOBIOS
.config:232:warning: trying to assign nonexistent symbol PCI_GOMMCONFIG
.config:233:warning: trying to assign nonexistent symbol PCI_GODIRECT
.config:234:warning: trying to assign nonexistent symbol PCI_GOANY
.config:1405:warning: trying to assign nonexistent symbol X86_FIND_SMP_CONFIG
.config:1406:warning: trying to assign nonexistent symbol X86_MPPARSE
.config:1459:warning: trying to assign nonexistent symbol X86_BIOS_REBOOT

Boyd Stephen Smith Jr.

не прочитано,
23 февр. 2006 г., 19:00:1523.02.2006
On Thursday 23 February 2006 17:25, Bo Andresen <bo.an...@gmail.com>
wrote about 'Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec
format error':
> On Thursday 23 February 2006 23:33, Boyd Stephen Smith Jr. wrote:
> > On Thursday 23 February 2006 15:56, Bo Andresen
> > <bo.an...@gmail.com>
> >
> > > > A 64-bit kernel will run 32-bit binaries fine... Um, there may be
> > > > a needed kernel option though...
> >
> > I think these are relevant:
> > $ zgrep -i ia32 /proc/config.gz
> > CONFIG_IA32_EMULATION=y
> > CONFIG_IA32_AOUT=y
>
> I cannot find those options.

[See below]

> ~ # uname -m
> i686

So, that's definitely not a 64-bit kernel.

> > So, you may want to configure, make, and install your kernel like:
> > make ARCH=x86_64 menuconfig
> > make ARCH=x86_64
> > make ARCH=x86_64 install
> >
> > (You don't need a CROSS_COMPILE prefix since gcc should work fine.)
>
> Should I ignore all these warnings?

I think yes. The first 2 dozen or so are definitely x86 specific and not
applicable to x86_64. I'm going to bet the others are too. Notice this
line:

> # using defaults found in .config

So, it's starting from your i686 config, and trying to use it to assign as
many symbols as possible to the new x86_64 kernel. Some of the symbols
just won't exist.

When you 'make ARCH=x86_64 menuconfig', can you find the IA32 configuration
options?

Bo Andresen

не прочитано,
23 февр. 2006 г., 19:20:1223.02.2006
On Friday 24 February 2006 00:52, Boyd Stephen Smith Jr. wrote:
> So, it's starting from your i686 config, and trying to use it to assign as
> many symbols as possible to the new x86_64 kernel. Some of the symbols
> just won't exist.
>
> When you 'make ARCH=x86_64 menuconfig', can you find the IA32 configuration
> options?

Indeed I can. Thanks. :)

Bo Andresen

не прочитано,
23 февр. 2006 г., 19:20:2223.02.2006
On Friday 24 February 2006 01:12, Bo Andresen wrote:
> On Friday 24 February 2006 00:52, Boyd Stephen Smith Jr. wrote:
> > So, it's starting from your i686 config, and trying to use it to assign
> > as many symbols as possible to the new x86_64 kernel. Some of the
> > symbols just won't exist.
> >
> > When you 'make ARCH=x86_64 menuconfig', can you find the IA32
> > configuration options?
>
> Indeed I can. Thanks. :)

Unfortunately, however, it doesn't compile.. :(

# make ARCH=x86_64
CHK include/linux/version.h
SPLIT include/linux/autoconf.h -> include/config/*
CC arch/x86_64/kernel/asm-offsets.s
cc1: error: code model `kernel' not supported in the 32 bit mode
make[1]: *** [arch/x86_64/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2

Going to bed now. Will look at it tomorrow.

Boyd Stephen Smith Jr.

не прочитано,
23 февр. 2006 г., 19:40:0623.02.2006
On Thursday 23 February 2006 18:16, Bo Andresen <bo.an...@gmail.com>
wrote about 'Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec
format error':

Oy, oy, oy. No wonder my friends would rather fsck with the amd64 live cd
(that panics on boot unless the BIOS settings are /really/ special) than
start off in 32-bit land.

Anyway, I think what you probably need to do is append -m64 to your CFLAGS.

Try:
make ARCH=x86_64 CFLAGS=-m64
I'll go fiddle a bit, too. I'm already running a 64-bit userland, but I
have an i686 "cross"-compiler installed, maybe I can iron out think kinks
in the process for ya.

Boyd Stephen Smith Jr.

не прочитано,
23 февр. 2006 г., 20:00:1823.02.2006
On Thursday 23 February 2006 18:32, "Boyd Stephen Smith Jr."
<bs...@volumehost.com> wrote about 'Re: [gentoo-user] chroot: cannot run
command `bin/bash': Exec format error':
> Try:
> make ARCH=x86_64 CFLAGS=-m64

Nah, don't. It won't help, the kernel's Makefile doesn't pay attention to
CFLAGS, it sets up it's own based on your .config.

While I didn't get the same error as you, I see definite "I'm trying to
compile 64-bit assembly into 32-bit binaries"-style errors when compiling
with:
make ARCH=x86_64 CROSS_COMPILE=i686-pc-linux-gnu-
make ARCH=x86_64 CROSS_COMPILE=i686-pc-linux-gnu- CFLAGS="-m32"
make ARCH=x86_64 CROSS_COMPILE=i686-pc-linux-gnu- CFLAGS="-m64"
and
make ARCH=x86_64 CROSS_COMPILE=i686-pc-linux-gnu- CC="gcc -m32"

However, I /was/ able to convince the kernel to build with
make ARCH=x86_64 CROSS_COMPILE=i686-pc-linux-gnu- CC="gcc -m64"
although I didn't see if that would boot.

So, why don't you give it a go with:
make ARCH=x86_64 CC="gcc -m64" menuconfig
make ARCH=x86_64 CC="gcc -m64"
make ARCH=x86_64 CC="gcc -m64" modules_install
make ARCH=x86_64 CC="gcc -m64" install

and let me know how it goes.

Bo Andresen

не прочитано,
23 февр. 2006 г., 20:10:1923.02.2006
On Friday 24 February 2006 01:56, Boyd Stephen Smith Jr. wrote:
> So, why don't you give it a go with:
> make ARCH=x86_64 CC="gcc -m64" menuconfig
> make ARCH=x86_64 CC="gcc -m64"
> make ARCH=x86_64 CC="gcc -m64" modules_install
> make ARCH=x86_64 CC="gcc -m64" install
>
> and let me know how it goes.

linux # make ARCH=x86_64 CC="gcc -m64" clean
CLEAN .tmp_versions

# make ARCH=x86_64 CC="gcc -m64" menuconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/basic/split-include
HOSTCC scripts/basic/docproc
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/kxgettext.o
HOSTCC scripts/kconfig/mconf.o
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/mconf
HOSTCC scripts/lxdialog/checklist.o
HOSTCC scripts/lxdialog/inputbox.o
HOSTCC scripts/lxdialog/lxdialog.o
HOSTCC scripts/lxdialog/menubox.o
HOSTCC scripts/lxdialog/msgbox.o
HOSTCC scripts/lxdialog/textbox.o
HOSTCC scripts/lxdialog/util.o
HOSTCC scripts/lxdialog/yesno.o
HOSTLD scripts/lxdialog/lxdialog
scripts/kconfig/mconf arch/x86_64/Kconfig
#


# using defaults found in .config

#


*** End of Linux kernel configuration.
*** Execute 'make' to build the kernel or try 'make help'.

via linux # make ARCH=x86_64 CC="gcc -m64"
CHK include/linux/version.h
UPD include/linux/version.h


SPLIT include/linux/autoconf.h -> include/config/*
CC arch/x86_64/kernel/asm-offsets.s
cc1: error: code model `kernel' not supported in the 32 bit mode

cc1: sorry, unimplemented: 64-bit mode not compiled in


make[1]: *** [arch/x86_64/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2

# gcc --version
gcc (GCC) 3.3.5-20050130 (Gentoo 3.3.5.20050130-r1, ssp-3.3.5.20050130-1,
pie-8.7.7.1)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Boyd Stephen Smith Jr.

не прочитано,
24 февр. 2006 г., 00:20:2024.02.2006
On Thursday 23 February 2006 19:07, Bo Andresen <bo.an...@gmail.com>
wrote about 'Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec
format error':
> On Friday 24 February 2006 01:56, Boyd Stephen Smith Jr. wrote:
> > So, why don't you give it a go with:
> > make ARCH=x86_64 CC="gcc -m64" menuconfig
> > make ARCH=x86_64 CC="gcc -m64"
> > make ARCH=x86_64 CC="gcc -m64" modules_install
> > make ARCH=x86_64 CC="gcc -m64" install
> >
> > and let me know how it goes.
>
> via linux # make ARCH=x86_64 CC="gcc -m64"
> CHK include/linux/version.h
> UPD include/linux/version.h
> SPLIT include/linux/autoconf.h -> include/config/*
> CC arch/x86_64/kernel/asm-offsets.s
> cc1: error: code model `kernel' not supported in the 32 bit mode
> cc1: sorry, unimplemented: 64-bit mode not compiled in

Blah. I don't really know how to get around this. I generally stay away
from configuring my own gcc and I don't know what, if any, USE flag
controls when 64-bit mode is compiled in. That works in my
i686-pc-linux-gnu-gcc, but maybe that's 'cause it is a "cross"-compiler on
my system.

It may be easier at this point to just find a live cd / live dvd that will
bring you up in a 64-bit kernel. It won't matter much whether it is
gentoo or some other distro [1], as long as it brings up the network and
your drives, because all you'll be doing is chrooting and finishing the
gentoo install.

If you still want to continue down the "cross"-compile and install a kernel
route (what we've been trying to do so far). I suggest you emerge
crossdev in your 32-bit environment, then do crossdev -s1 -t x86_64 to
compile a cross-compiling bin-utils and gcc (C only) [2]. Then, you
should be able to "cross"-compile your kernel with.

make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu-
(menuconfig, all, modules_install, etc.)

Crossdev will take basically no time to install, but compiling gcc make
take a while, even without any language front-ends other than C.

--
Boyd Stephen Smith Jr.
bs...@volumehost.com
ICQ: 514984 YM/AIM: DaTwinkDaddy

[1] I only mention this because the gentoo amd64 live cds were nothing but
problems on my system and it was much easier to bring up (k)ubuntu, as
long as all I needed was 64-bit mode.

[2] Cross dev have 4 stages: (0) bin-utils, (1) gcc, (C only) (2)
linux-headers, (3) libc, and (4) gcc (C/C++) and two "extra" targets
(ex-gcc) gcc (all languages) and (ex-gdb) gdb. You'll only need the first
two to compile the kernel, since it provides it's own headers, can't link
to any library (including libc), and isn't written in any language other
than C.
--
gento...@gentoo.org mailing list

Bo Andresen

не прочитано,
24 февр. 2006 г., 08:00:0924.02.2006
On Friday 24 February 2006 06:18, Boyd Stephen Smith Jr. wrote:
> > via linux # make ARCH=x86_64 CC="gcc -m64"
> > CHK include/linux/version.h
> > UPD include/linux/version.h
> > SPLIT include/linux/autoconf.h -> include/config/*
> > CC arch/x86_64/kernel/asm-offsets.s
> > cc1: error: code model `kernel' not supported in the 32 bit mode
> > cc1: sorry, unimplemented: 64-bit mode not compiled in
>
> Blah. I don't really know how to get around this. I generally stay away
> from configuring my own gcc and I don't know what, if any, USE flag
> controls when 64-bit mode is compiled in. That works in my
> i686-pc-linux-gnu-gcc, but maybe that's 'cause it is a "cross"-compiler on
> my system.

As you saw in my previous post the gcc version is 3.3.5. Wanting to know
whether it was due to the version of gcc I ran the same commands on my laptop
(after copying .config to it). It has gcc version 3.4.5 and it gave exactly
the same result as shown above.

> It may be easier at this point to just find a live cd / live dvd that will
> bring you up in a 64-bit kernel. It won't matter much whether it is
> gentoo or some other distro [1], as long as it brings up the network and
> your drives, because all you'll be doing is chrooting and finishing the
> gentoo install.

Actually I guess I could just download the the amd64 livecd, mount it, copy
its kernel to the harddrive (already did emerge coldplug) and boot on it. I
did, however, find this very interesting so I do wish to compile a 64-bit
kernel and see what it takes.

> If you still want to continue down the "cross"-compile and install a kernel
> route (what we've been trying to do so far). I suggest you emerge
> crossdev in your 32-bit environment, then do crossdev -s1 -t x86_64 to
> compile a cross-compiling bin-utils and gcc (C only) [2]. Then, you
> should be able to "cross"-compile your kernel with.

I've just done that. It seems to be working.

> make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu-
> (menuconfig, all, modules_install, etc.)

At first when typing make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu- it
told me it could not find these files:

arch/x86_64/kernel/asm-offsets.c:12:21: asm/pda.h: No such file or directory
arch/x86_64/kernel/asm-offsets.c:16:22: asm/ia32.h: No such file or directory
[...]


make[1]: *** [arch/x86_64/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2

# ls -ld include/asm
lrwxrwxrwx 1 root root 10 Feb 24 14:27 include/asm -> asm-386

I solved this by:
# ln -sfn include/asm-x86_64 include/asm

Perhaps it would have been solved by reemerging gentoo-sources but this worked
too. make install didn't work either but installing it manually is just
copying 3 files..

This all did solve the problems. The resulting kernel does indeed boot and it
does make it possible to chroot into a 64 bit environment. :D Thanks a lot.
This has been very educating.

> Crossdev will take basically no time to install, but compiling gcc make
> take a while, even without any language front-ends other than C.

Well, it didn't take that long.. At least less than 15 minutes - didn't really
time it.

Boyd Stephen Smith Jr.

не прочитано,
24 февр. 2006 г., 16:20:1524.02.2006
On Friday 24 February 2006 06:56, Bo Andresen <bo.an...@gmail.com> wrote
about 'Re: [gentoo-user] chroot: cannot run command `bin/bash': Exec
format error [SOLVED]':

> Actually I guess I could just download the the amd64 livecd, mount it,
> copy its kernel to the harddrive (already did emerge coldplug) and boot
> on it. I did, however, find this very interesting so I do wish to
> compile a 64-bit kernel and see what it takes.

Well, when you are already running a 64-bit kernel and have a native gcc,
you won't have to use the ARCH and CROSS_COMPILE magic. It just works.

The whole process was also enlightening to me. I've never cross-compiled a
kernel, but now I know how to have my dual-Opteron box compile the kernel
for my Linksys router or my friend's hppa box.

> > make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu-
> > (menuconfig, all, modules_install, etc.)
>
> At first when typing make ARCH=x86_64 CROSS_COMPILE=x86_64-pc-linux-gnu-
> it told me it could not find these files:
>
> arch/x86_64/kernel/asm-offsets.c:12:21: asm/pda.h: No such file or
> directory arch/x86_64/kernel/asm-offsets.c:16:22: asm/ia32.h: No such
> file or directory [...]
> make[1]: *** [arch/x86_64/kernel/asm-offsets.s] Error 1
> make: *** [prepare0] Error 2
>
> # ls -ld include/asm
> lrwxrwxrwx 1 root root 10 Feb 24 14:27 include/asm -> asm-386
>
> I solved this by:
> # ln -sfn include/asm-x86_64 include/asm

I think this could also be solved with a 'make mrproper'.

> make install didn't work either

Weird.

> This all did solve the problems. The resulting kernel does indeed boot
> and it does make it possible to chroot into a 64 bit environment. :D
> Thanks a lot. This has been very educating.

Very good! I'm glad we solved your problem.

--
Boyd Stephen Smith Jr.
bs...@volumehost.com
ICQ: 514984 YM/AIM: DaTwinkDaddy

--
gento...@gentoo.org mailing list

0 новых сообщений