[lfs-dev] A method to build 32bits lfs on pure 64bits host

xinglp xinglp at gmail.com
Thu Dec 22 09:25:43 PST 2016

Since there's fewer and fewer linux distro that has 32bits support,
and also we rarely use it.
But there's one situation for me to use 32bits linux: use wine to run
32bits win apps (64bits wine need multilib(lfs don't have) to run
32bits win apps).
Because 32bits kernel has many limitations, use 64bits kernel and
32bits userspace is a better way.
By coping 64bits system's /boot/* and /lib/modules/ to a 32bits
system, I got a hybrid system, and it works very well for me.

Then when I build lfs on this hybrid system(64bits kernel + 32bits
userspace), I got a pure 64bits system, and finally I find out the
'uname -m' outputs x86_64 on this hybrid system.

This's very interesting. And by hacking uname (in coreutils) I can
build pure 32bits system on this hybrid system.
I think everytihngs can be controlled by uname when building lfs with
a IA32_EMULATION  enabled 64bits kernel host.

So here is the step to build 32bits lfs on pure 64bits host.
1. hack host's uname.
  cd coreutils-...
  patch -Np1 -i  coreutils-uname_m.patch
  ./configure && make -j$(nproc --all)
  cp src/uname $(which uname)  #no big deal to overwrite host's uname.

2. patch jhalfs and run jhalfs like below:
  _UNAME_M=i686 ./jhalfs run

Then you will get a 32bits lfs.

I also skip the build of 32bit kernel, since it has no use for me.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: coreutils-uname_m.patch
Type: application/octet-stream
Size: 665 bytes
Desc: not available
URL: <http://lists.linuxfromscratch.org/pipermail/lfs-dev/attachments/20161223/148cad08/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jhalfs-uname_m.patch
Type: application/octet-stream
Size: 638 bytes
Desc: not available
URL: <http://lists.linuxfromscratch.org/pipermail/lfs-dev/attachments/20161223/148cad08/attachment-0001.obj>

More information about the lfs-dev mailing list