running 64-bit kernel on 32-bit distro

2 views
Skip to first unread message

Robert P. J. Day

unread,
Apr 30, 2007, 1:42:55 PM4/30/07
to Kernel Newbies

before i try this, i want to verify that it should (theoretically)
work. i want to run a 64-bit kernel (with 32-bit emulation mode) on
my 32-bit install of fedora core.

as i understand it, i can use my (currently building) x86-64
toolchain to cross-compile the kernel for 64 bits, plus the 32-bit
emulation, after which i should just be able to boot the new 64-bit
kernel, is that right?

am i missing anything critical there? thanks.

rday

--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to eca...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ

Mike Frysinger

unread,
Apr 30, 2007, 2:02:44 PM4/30/07
to Robert P. J. Day, Kernel Newbies
On 4/30/07, Robert P. J. Day <rpj...@mindspring.com> wrote:
> before i try this, i want to verify that it should (theoretically)
> work. i want to run a 64-bit kernel (with 32-bit emulation mode) on
> my 32-bit install of fedora core.

it works just fine

> as i understand it, i can use my (currently building) x86-64
> toolchain to cross-compile the kernel for 64 bits, plus the 32-bit
> emulation, after which i should just be able to boot the new 64-bit
> kernel, is that right?

yes
-mike

Robert P. J. Day

unread,
Apr 30, 2007, 4:31:00 PM4/30/07
to Mike Frysinger, Kernel Newbies
On Mon, 30 Apr 2007, Mike Frysinger wrote:

> On 4/30/07, Robert P. J. Day <rpj...@mindspring.com> wrote:
> > before i try this, i want to verify that it should (theoretically)
> > work. i want to run a 64-bit kernel (with 32-bit emulation mode) on
> > my 32-bit install of fedora core.
>
> it works just fine
>
> > as i understand it, i can use my (currently building) x86-64
> > toolchain to cross-compile the kernel for 64 bits, plus the 32-bit
> > emulation, after which i should just be able to boot the new 64-bit
> > kernel, is that right?
>
> yes

ok, i'm almost there. so far, i've:

1) built an (apparently) working x86_64 toolchain using crosstool
2) used that toolchain to build and install a 64-bit kernel
3) booted (successfully) under the new 64-bit kernel, verifying that
it's 64-bit with "uname -a"
4) used the aforementioned toolchain to compile "hello, world"

but here's where i run into trouble -- when i try to run the
resulting a.out for "hello, world", i get "No such file or directory".

i'm running it in the current directory with:

$ ./a.out

but still no luck. the "file" command shows me that it's there, with
type "ELF 64-bit LSB executable, AMD x86-64 ..." but every attempt to
run it gives me that error message.

i'm sure i'm forgetting something trivial. ideas?

rday

Mike Frysinger

unread,
Apr 30, 2007, 4:36:58 PM4/30/07
to Robert P. J. Day, Kernel Newbies
On 4/30/07, Robert P. J. Day <rpj...@mindspring.com> wrote:
> but here's where i run into trouble -- when i try to run the
> resulting a.out for "hello, world", i get "No such file or directory".

you're assuming too much ... you have a 32bit install, not a 64bit
install, so unless you build that hello world statically, it's going
to require the 64bit ldso and shared libraries from glibc in the
proper lib directories in /

the no such file or directory is because the kernel could not execute
the associated ELF interpreter for that binary
-mike

Robert P. J. Day

unread,
Apr 30, 2007, 4:40:36 PM4/30/07
to Mike Frysinger, Kernel Newbies
On Mon, 30 Apr 2007, Mike Frysinger wrote:

> On 4/30/07, Robert P. J. Day <rpj...@mindspring.com> wrote:
> > but here's where i run into trouble -- when i try to run the
> > resulting a.out for "hello, world", i get "No such file or directory".
>
> you're assuming too much ... you have a 32bit install, not a 64bit
> install, so unless you build that hello world statically, it's going
> to require the 64bit ldso and shared libraries from glibc in the
> proper lib directories in /
>
> the no such file or directory is because the kernel could not
> execute the associated ELF interpreter for that binary -mike

sigh ... i realized that seconds after i posted. it's been a long
day.

rday

--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
========================================================================

--

Octavian Purdila

unread,
Apr 30, 2007, 4:34:03 PM4/30/07
to kernel...@nl.linux.org, Robert P. J. Day, Mike Frysinger
On Monday 30 April 2007 23:31, Robert P. J. Day wrote:

>
> ok, i'm almost there. so far, i've:
>
> 1) built an (apparently) working x86_64 toolchain using crosstool
> 2) used that toolchain to build and install a 64-bit kernel
> 3) booted (successfully) under the new 64-bit kernel, verifying that
> it's 64-bit with "uname -a"
> 4) used the aforementioned toolchain to compile "hello, world"
>
> but here's where i run into trouble -- when i try to run the
> resulting a.out for "hello, world", i get "No such file or directory".
>
> i'm running it in the current directory with:
>
> $ ./a.out
>
> but still no luck. the "file" command shows me that it's there, with
> type "ELF 64-bit LSB executable, AMD x86-64 ..." but every attempt to
> run it gives me that error message.
>
> i'm sure i'm forgetting something trivial. ideas?
>

You are probably missing 64bit libraries since you mentioned that you are using 32bit userspace. Try compiling it with -static and see if it works.

Regards.
tavi

Robert P. J. Day

unread,
Apr 30, 2007, 4:46:42 PM4/30/07
to Mike Frysinger, Kernel Newbies
On Mon, 30 Apr 2007, Mike Frysinger wrote:

> On 4/30/07, Robert P. J. Day <rpj...@mindspring.com> wrote:
> > but here's where i run into trouble -- when i try to run the
> > resulting a.out for "hello, world", i get "No such file or directory".
>
> you're assuming too much ... you have a 32bit install, not a 64bit
> install, so unless you build that hello world statically, it's going
> to require the 64bit ldso and shared libraries from glibc in the
> proper lib directories in /

another option being building those 64-bit libs and installing them
elsewhere and playing games with "rpath" and the like, right?

rday

Robert P. J. Day

unread,
Apr 30, 2007, 4:44:55 PM4/30/07
to Octavian Purdila, kernel...@nl.linux.org, Mike Frysinger
On Mon, 30 Apr 2007, Octavian Purdila wrote:

> On Monday 30 April 2007 23:31, Robert P. J. Day wrote:
>
> >
> > ok, i'm almost there. so far, i've:
> >
> > 1) built an (apparently) working x86_64 toolchain using crosstool
> > 2) used that toolchain to build and install a 64-bit kernel
> > 3) booted (successfully) under the new 64-bit kernel, verifying that
> > it's 64-bit with "uname -a"
> > 4) used the aforementioned toolchain to compile "hello, world"
> >
> > but here's where i run into trouble -- when i try to run the
> > resulting a.out for "hello, world", i get "No such file or directory".
> >
> > i'm running it in the current directory with:
> >
> > $ ./a.out
> >
> > but still no luck. the "file" command shows me that it's there, with
> > type "ELF 64-bit LSB executable, AMD x86-64 ..." but every attempt to
> > run it gives me that error message.
> >
> > i'm sure i'm forgetting something trivial. ideas?
> >
>
> You are probably missing 64bit libraries since you mentioned that
> you are using 32bit userspace. Try compiling it with -static and see
> if it works.

naturally, that works. thanks.

rday

p.s. i'm assuming that, until i cross-compile and install the 64-bit
libs, there's really nothing else i can do with this 64-bit kernel
other than run static 64-bit binaries, right?


--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
========================================================================

--

Mike Frysinger

unread,
Apr 30, 2007, 4:52:07 PM4/30/07
to Robert P. J. Day, Kernel Newbies
On 4/30/07, Robert P. J. Day <rpj...@mindspring.com> wrote:
> On Mon, 30 Apr 2007, Mike Frysinger wrote:
> > On 4/30/07, Robert P. J. Day <rpj...@mindspring.com> wrote:
> > > but here's where i run into trouble -- when i try to run the
> > > resulting a.out for "hello, world", i get "No such file or directory".
> >
> > you're assuming too much ... you have a 32bit install, not a 64bit
> > install, so unless you build that hello world statically, it's going
> > to require the 64bit ldso and shared libraries from glibc in the
> > proper lib directories in /
>
> another option being building those 64-bit libs and installing them
> elsewhere and playing games with "rpath" and the like, right?

off the top of my head, you'd just need to override -rpath and -dynamic-linker
-mike

Robert P. J. Day

unread,
Apr 30, 2007, 5:01:07 PM4/30/07
to Mike Frysinger, Kernel Newbies
On Mon, 30 Apr 2007, Mike Frysinger wrote:

> On 4/30/07, Robert P. J. Day <rpj...@mindspring.com> wrote:
> > On Mon, 30 Apr 2007, Mike Frysinger wrote:
> > > On 4/30/07, Robert P. J. Day <rpj...@mindspring.com> wrote:
> > > > but here's where i run into trouble -- when i try to run the
> > > > resulting a.out for "hello, world", i get "No such file or directory".
> > >
> > > you're assuming too much ... you have a 32bit install, not a 64bit
> > > install, so unless you build that hello world statically, it's going
> > > to require the 64bit ldso and shared libraries from glibc in the
> > > proper lib directories in /
> >
> > another option being building those 64-bit libs and installing them
> > elsewhere and playing games with "rpath" and the like, right?
>
> off the top of my head, you'd just need to override -rpath and
> -dynamic-linker

actually, it's "--dynamic-linker" but i think i have enough to play
with and this is getting pretty far afield from kernel topics.
thanks.

rday

p.s. if there's a more appropriate place to discuss this topic, by
all means, let me know. i suspect i'm going to be digging into this
in some detail.

--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://fsdev.net/wiki/index.php?title=Main_Page
========================================================================

--

Reply all
Reply to author
Forward
0 new messages