Compilation question 64bit, 32 bit

Alexander Leidinger Alexander at Leidinger.net
Fri Oct 17 14:28:11 UTC 2008


Quoting Miroslav Lachman <000.fbsd at quip.cz> (from Fri, 17 Oct 2008  
11:48:03 +0200):

> Alexander Leidinger wrote:
>> Quoting Jose Amengual <jose.amengual at gmail.com> (from Thu, 16 Oct  
>> 2008  08:43:15 -0300):
>>
>>> Hi Guys.
>>>
>>> The other day I install a server with jails with FreeBSD 7 32 bit  
>>> in  a 64 bit capable processor.
>>>
>>> After I install I start wondering some things that I point out here :
>>>
>>> Any benefit to install 64 bit vs 32 bit with the purpose of use jails ?
>>
>>
>> It depends. If you want to use more than 4G: yes.
>>
>>> Can I install a 32 bit FreeBSD and create 64 bit jails ? ( using   
>>> ezjail or downloading the full 64 bit source to create the jail ).
>>
>>
>> No.
>>
>>> Can I install 32 bit FreeBSD and then made a make world and change  
>>>  it to 64 bit ? ( is recommended ?)
>>
>>
>> IIRC this depends upon your FreeBSD version. I think in CURRENT   
>> there's code which supports that now. No guarantees.
>>
>>> Can I install a FreeBSD 64 bit and create 32 bit jails ?
>>
>>
>> Sort of. You can install a 32bit world into the jail and make sure   
>> 32bit support is activated in the kernel. The 32bit programs will  
>> then  run just fine in the jail (but 64bit ones should run fine  
>> too). It's  the same way as you can run linux programs in a jail.
>
> Do you mean installing whole 32bit world instead of 64bit, for  
> example from  
> ftp.freebsd.cz:/pub/FreeBSD/releases/i386/7.0-RELEASE/base/ or just  
> /lib32 /usr/lib32 libraries?

I haven't tested it myself. I know that it is possible. It may need  
some twiddling. I haven't carefully looked at the kernel code, but as  
it uses the same infrastructure as the linuxulator (see  
compat/ia32/ia32_sysvec.c), it should be able to run with a plain i386  
world (maybe you have to make a link /libexec/ld-elf32.so.1 ->  
/libexec/ld-elf.so.1 as the compat32 stuff is trying to access this...  
or maybe even moving ld-elf.so.1 to a different name and linking to  
the new name, in case this may cause some kind of loop in the kernel).

> Will it be possible in this (32bit) jail to install ports marked as  
> arch i386 only, or some voodoo is needed to trick the ports system?

As the compiler is responsible to create the XXbit stuff, and you are  
using the 32bit compiler, it should be possible. Investigate the stuff  
which is used to change the uname output on the ports build cluster.  
This will be needed. Not all ports may work, in this case either fix  
the port, or use a package. Some ports will never be able to work (use  
of features which are not available in compat32).

> What do you mean by "32bit support in kernel"? Is it just options    
> COMPAT_IA32 as is in amd64 GENERIC or anything else?

COMPAT_IA32

> I am interested in running 32bit ports on amd64 bit machine.

If you mean 64bit jail instead of machine: should be possible. If not:  
mixing without restrictions is not possible. It's an all or nothing  
approach for the userland.

Bye,
Alexander.

-- 
If society fits you comfortably enough, you call it freedom.
		-- Robert Frost

http://www.Leidinger.net    Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID = 72077137


More information about the freebsd-jail mailing list