configs addition for chroot population

This commit is contained in:
phanes
2023-02-20 22:24:08 -05:00
parent 4668e617e6
commit 37550c04c7
14 changed files with 303 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
#!/bin/bash
APPNAME="CHROOT VFS SETUP"
T_SYSROOT=${dir_sysroot}
set -a
assert_zero() {
if [[ "$1" -eq 0 ]]; then
return
@@ -51,12 +51,15 @@ logprint "mounting proc filesystem from to chroot sysroot..."
is_mounted ${T_SYSROOT}/proc || mount -v -t proc proc ${T_SYSROOT}/proc
assert_zero $?
logprint "mounting shm"
# not a symlink on ubuntu
if [ -h ${T_SYSROOT}/dev/shm ]; then
mkdir -vp ${T_SYSROOT}/$(readlink ${T_SYSROOT})/dev/shm
mkdir -vp ${T_SYSROOT}/$(readlink "${T_SYSROOT}/dev/shm")
assert_zero $?
else
mount -t tmpfs -o nosuid,nodev tmpfs ${T_SYSROOT}/dev/shm
is_mounted ${T_SYSROOT}/dev/shm || mount -t tmpfs -o nosuid,nodev tmpfs ${T_SYSROOT}/dev/shm
fi
logprint "mounting rex_embedded for stage3 capability"
mkdir -p ${T_SYSROOT}/rex_embedded
is_mounted ${T_SYSROOT}/rex_embedded || mount -v --bind ${project_root} ${T_SYSROOT}/rex_embedded

32
make.project/build_stage3.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# fix an issue with open files limit on some hosts
ulimit -l unlimited
#ulimit -n 10240
ulimit -c unlimited
# closely aligns with LFS Ch 5, 6
T_SYSROOT=${dir_sysroot}
project_root=/rex_embedded
echo "Bootstrapping from MAKE to REX..."
dir_rex=/rex_embedded/rex.project
# Executes rex from within the chroot.
/usr/sbin/chroot "${T_SYSROOT}" /usr/bin/env -i \
HOME="/" \
TERM="$TERM" \
COLORTERM=$COLORTERM \
PS1='\n(Dark Horse Linux) [ \u @ \H ] << \w >>\n\n[- ' \
PATH=/usr/bin:/usr/sbin \
project_root="${project_root}" \
dir_rex="${dir_rex}" \
dir_logs="/${project_root}/logs" \
/rex_embedded/stage/rex/rex -v -c ${dir_rex}/x86_64/rex.config -p ${dir_rex}/x86_64/plans/stage3.plan
retVal=$?
echo "Rex exited with error code '$retVal'."

View File

@@ -46,7 +46,10 @@ is_mounted ${T_SYSROOT}/proc && umount -l ${T_SYSROOT}/proc
# not a symlink on ubuntu
logprint "Unmounting ${T_SYSROOT}/dev/shm"
ismounted ${T_SYSROOT}/dev/shm && umount -l {${T_SYSROOT}/dev/shm
is_mounted ${T_SYSROOT}/dev/shm && umount -l ${T_SYSROOT}/dev/shm
logprint "Unmounting pyrois inside of chroot"
is_mounted ${T_SYSROOT}/rex_embedded && umount -l ${T_SYSROOT}/rex_embedded
echo
logprint "You can now safely delete the chroot."