(Created page with "==Preparing clean environment== We now test if the tool-suite is working in a clean environment As root run the following commands mkdir /newsystem cp -R /tools /newsystem ...") |
No edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Preparing clean environment== | ==Preparing clean environment== | ||
We now test if the tool-suite is working in a clean environment | We now test if the tool-suite is working in a clean environment | ||
As root run the following commands | As root run the following commands. We need the symbolic links to satisfy programs like ldd, that needs the path /bin/bash | ||
With the symbolic link from /tools to /newsystem/tools its still possible to build more tools from outside the newsystem | |||
mkdir /newsystem | mkdir /newsystem | ||
mv /tools /newsystem | |||
ln -s /newsystem/tools /tools | |||
cd /newsystem | cd /newsystem | ||
mkdir -v {bin,dev,proc,sys,tmp,etc,lib,usr,include} | mkdir -v {bin,dev,proc,sys,tmp,etc,lib,usr,include} | ||
Line 11: | Line 13: | ||
ln -s /tools/bin/bash /newsystem/bin/sh | ln -s /tools/bin/bash /newsystem/bin/sh | ||
ln -s /tools/bin/pwd /newsystem/bin/ | ln -s /tools/bin/pwd /newsystem/bin/ | ||
ln -s /tools/bin/ /newsystem/usr/bin | |||
touch /newsystem/etc/ld.so.conf | touch /newsystem/etc/ld.so.conf | ||
Line 27: | Line 30: | ||
mount -vt sysfs sysfs $LFS/sys | mount -vt sysfs sysfs $LFS/sys | ||
Line 39: | Line 42: | ||
If it complains that it cannot find the file, it usually means there are some unsatisfied library links. For example if bash needs /lib64/ld-linux-x86-64.so.2 which is not present in the clean environment. This can easily be checked by running the following command in the normal environment | If it complains that it cannot find the file, it usually means there are some unsatisfied library links. For example if bash needs /lib64/ld-linux-x86-64.so.2 which is not present in the clean environment. This can easily be checked by running the following command in the normal environment | ||
ldd /tools/bin/bash | ldd /tools/bin/bash | ||
Note: This seems broken in current version of ldd | |||
If it works, it should look something like this: | If it works, it should look something like this: |
Latest revision as of 12:50, 9 May 2013
Preparing clean environment
We now test if the tool-suite is working in a clean environment As root run the following commands. We need the symbolic links to satisfy programs like ldd, that needs the path /bin/bash With the symbolic link from /tools to /newsystem/tools its still possible to build more tools from outside the newsystem
mkdir /newsystem mv /tools /newsystem ln -s /newsystem/tools /tools cd /newsystem mkdir -v {bin,dev,proc,sys,tmp,etc,lib,usr,include} mknod -m 666 /dev/null c 1 3 ln -s /include/ /usr/ ln -s /tools/bin/bash /newsystem/bin/ ln -s /tools/bin/bash /newsystem/bin/sh ln -s /tools/bin/pwd /newsystem/bin/ ln -s /tools/bin/ /newsystem/usr/bin touch /newsystem/etc/ld.so.conf
To make arrow keys work right in the new terminal, we need to copy a file from the current system
cp /etc/inputrc /newsystem/etc/
Changing to new environment with chroot
To have access to system folders you need to run the following commands. If you dont run these some programs like java will fail
mkdir dev/pts mkdir dev/shm export LFS="/newsystem" mount -vt devpts devpts $LFS/dev/pts mount -vt tmpfs shm $LFS/dev/shm mount -vt proc proc $LFS/proc mount -vt sysfs sysfs $LFS/sys
We can now test the new environment by running
chroot /newsystem /tools/bin/env -i \ HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \ /tools/bin/bash --login +h
If it complains that it cannot find the file, it usually means there are some unsatisfied library links. For example if bash needs /lib64/ld-linux-x86-64.so.2 which is not present in the clean environment. This can easily be checked by running the following command in the normal environment
ldd /tools/bin/bash
Note: This seems broken in current version of ldd
If it works, it should look something like this:
# chroot /newsystem /tools/bin/env -i HOME=/root TERM="$TERM" PS1='\u:\w\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h I have no name!:/# I have no name!:/# ldd /tools/bin/bash linux-vdso.so.1 => (0x00007fffb65ff000) libtinfo.so.5 => /tools/lib/libtinfo.so.5 (0x00007ff698741000) libdl.so.2 => /tools/lib/libdl.so.2 (0x00007ff69853d000) libc.so.6 => /tools/lib/libc.so.6 (0x00007ff6981b5000) /tools/lib/ld-linux-x86-64.so.2 (0x00007ff698968000)
After you confirmed it works, you can exit the chroot environment and continue building the tools