Tweaking the hlfs code.. stomping on bugs

This commit is contained in:
George Boudreau 2006-07-28 03:55:40 +00:00
parent 65a2be6b24
commit 21dab8363a
2 changed files with 46 additions and 26 deletions

View file

@ -281,6 +281,13 @@ depends on BOOK_HLFS
help help
#--- Automatically run the makefile once it has been created #--- Automatically run the makefile once it has been created
config CONFIG_REBUILD
bool "Rebuild files"
default n
help
Clean the build directory before performing any other task. The directory
is cleaned only if it was populated by a previous JHALFS run.
config CONFIG_STRIP config CONFIG_STRIP
bool "Strip Installed Binaries/Libraries" bool "Strip Installed Binaries/Libraries"
default y default y
@ -387,7 +394,7 @@ depends on BOOK_HLFS
endchoice endchoice
config TEST config TEST
int int
default "0" if !CONFIG_TEST default "0" if !CONFIG_TESTS
default "1" if TST_1 default "1" if TST_1
default "2" if TST_2 default "2" if TST_2
default "3" if TST_3 default "3" if TST_3
@ -432,9 +439,6 @@ depends on BOOK_HLFS
default "letter" if PAGE_LETTER default "letter" if PAGE_LETTER
default "A4" if PAGE_A4 default "A4" if PAGE_A4
config BUILDDIR config BUILDDIR
string "Build Directory" string "Build Directory"
default "/mnt/build_dir" default "/mnt/build_dir"
@ -524,3 +528,7 @@ depends on BOOK_HLFS
default 0 if !CONFIG_FARCE default 0 if !CONFIG_FARCE
default 1 if CONFIG_FARCE default 1 if CONFIG_FARCE
config CLEAN
int
default 0 if !CONFIG_REBUILD
default 1 if CONFIG_REBUILD

View file

@ -43,6 +43,22 @@ EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
} }
#----------------------------------#
wrt_RunAsRoot() { # Some scripts must be run as root..
#----------------------------------#
local user_ACCT=$(echo $1 | tr [a-z] [A-Z])
local this_script=$2
local file=$3
(
cat << EOF
@( time { export ${user_ACCT}=\$(MOUNT_PT) && ${PROGNAME}-commands/$file >>logs/$this_script 2>&1 ; } ) 2>>logs/$this_script && \\
echo -e "\nKB: \`du -skx --exclude=${SCRIPT_ROOT} \$(MOUNT_PT)\`\n" >>logs/$this_script
EOF
) >> $MKFILE.tmp
}
#----------------------------# #----------------------------#
process_toolchain() { # embryo,cocoon and butterfly need special handling process_toolchain() { # embryo,cocoon and butterfly need special handling
#----------------------------# #----------------------------#
@ -58,43 +74,40 @@ process_toolchain() { # embryo,cocoon and butterfly need special handling
wrt_Unpack_SetOwner "hlfs" "$pkg_tarball" 1 wrt_Unpack_SetOwner "hlfs" "$pkg_tarball" 1
pkg_tarball=$(get_package_tarball_name "gcc-g++") pkg_tarball=$(get_package_tarball_name "gcc-g++")
wrt_Unpack_SetOwner "hlfs" "$pkg_tarball" 1 wrt_Unpack_SetOwner "hlfs" "$pkg_tarball" 1
case ${toolchain} in
*butterfly*)
[[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
(
cat << EOF
@echo "export PKGDIR=\$(SRC)" > envars
EOF
) >> $MKFILE.tmp
wrt_run_as_chroot1 "$toolchain" "$this_script"
;;
*)
( (
cat << EOF cat << EOF
@echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)" > envars @echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)" > envars
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
if [[ ${toolchain} = "butterfly-toolchain" ]]; then
[[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}"
wrt_run_as_chroot1 "$toolchain" "$this_script"
else
wrt_ExecuteAsUser "hlfs" "$toolchain" "$this_script" wrt_ExecuteAsUser "hlfs" "$toolchain" "$this_script"
fi ;;
esac
pkg_tarball=$(get_package_tarball_name "binutils") pkg_tarball=$(get_package_tarball_name "binutils")
wrt_remove_existing_dirs "$pkg_tarball" wrt_remove_existing_dirs "$pkg_tarball"
pkg_tarball=$(get_package_tarball_name "gcc-core") pkg_tarball=$(get_package_tarball_name "gcc-core")
wrt_remove_existing_dirs "$pkg_tarball" wrt_remove_existing_dirs "$pkg_tarball"
#
# Manually remove the toolchain directories.. # Manually remove the toolchain directories..
tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'` tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'`
case $tc_phase in
embryo | cocoon) # toolchain phase
( (
cat << EOF cat << EOF
@rm -r \$(MOUNT_PT)\$(SRC)/${tc_phase}-toolchain && \\ @rm -r \$(MOUNT_PT)\$(SRC)/${tc_phase}-toolchain && \\
rm -r \$(MOUNT_PT)\$(SRC)/${tc_phase}-build rm -r \$(MOUNT_PT)\$(SRC)/${tc_phase}-build
EOF EOF
) >> $MKFILE.tmp ) >> $MKFILE.tmp
;;
butterfly ) # system phase
(
cat << EOF
@rm -r \$(SRC)/butterfly-toolchain && \\
rm -r \$(SRC)/butterfly-build
EOF
) >> $MKFILE.tmp
;;
esac
} }
@ -376,7 +389,7 @@ chapter6_Makefiles() { # sysroot or chroot build phase
# In the mount of kernel filesystems we need to set LFS and not to use chroot. # In the mount of kernel filesystems we need to set LFS and not to use chroot.
case "${this_script}" in case "${this_script}" in
*kernfs*) *kernfs*)
wrt_run_as_root "${this_script}" "${file}" wrt_RunAsRoot "hlfs" "${this_script}" "${file}"
;; ;;
*) # The rest of Chapter06 *) # The rest of Chapter06
wrt_run_as_chroot1 "${this_script}" "${file}" wrt_run_as_chroot1 "${this_script}" "${file}"
@ -421,7 +434,6 @@ chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..e
case $this_script in case $this_script in
*usage) continue ;; # Contains example commands *usage) continue ;; # Contains example commands
*grub) continue ;; *grub) continue ;;
*reboot) continue ;;
*console) continue ;; # Use the file generated by lfs-bootscripts *console) continue ;; # Use the file generated by lfs-bootscripts
*kernel) *kernel)