7.5. Enter chroot environment
Enter the target system with a clean environment and a login shell so package work runs inside the target tree.
Goal: start a clean
chroot shell in $LBI_ROOT using the target layout paths and login profile.
Run this as root after completing the previous setup steps in chapter 7.
Enter chroot
chroot "$LBI_ROOT" /system/binaries/env -i \
HOME=/system/charlie \
TERM="$TERM" \
SHELL=/bin/oksh \
PS1='(chroot) %# ' \
PATH=/system/binaries:/system/systembinaries \
/bin/oksh -l
The login shell reads /system/configuration/profile, which is linked to the build variable profile created in the previous section.
Quick verification
pwd
echo "$PATH"
Command Explanations
chroot "$LBI_ROOT": Changes the apparent root directory to the target tree./system/binaries/env -i: Starts with an empty environment so host variables do not leak into the target shell.HOME,TERM,SHELL,PS1, andPATH: Rebuild the minimal environment needed for an interactive target shell./bin/oksh -l: Starts oksh as a login shell so/system/configuration/profileis read.pwd: Confirms that the shell is operating from the target root.echo "$PATH": Confirms that target binary directories are the active command search path.