diff --git a/BLFS/TODO b/BLFS/TODO index 9f1a956..39a7b63 100644 --- a/BLFS/TODO +++ b/BLFS/TODO @@ -19,13 +19,18 @@ What remains to do: c. Run the packages.sh script. 2. - To develop the XSL code needed to create the build scripts. - Work in progress. + Almost done. A lot of book-versus-scripts and testing is needed. + We need yet to figure out how to handle Perl modules installation and + other pages that have commands to install more that one package + (e.g., Gnat in GCC Java-bin in Java, sane-backends and sane-frontends + in Sane, etc) 3. - To develop the code to create the Makefile. Should be a separate script to be run manually after the user has review and edited the target build scripts. Must make the build scripts executables and set the SRC_ARCHIVE and FTP_SERVER envars. + Work in progress. 4. - To find a way to track already installed packages by previous runs, to can skip them when creating the book/scripts/Makefile for a new target. diff --git a/CLFS/clfs.xsl b/CLFS/clfs.xsl index d7bc2b5..ec4a4ce 100644 --- a/CLFS/clfs.xsl +++ b/CLFS/clfs.xsl @@ -230,6 +230,10 @@ + + + **EDITME diff --git a/CLFS/config b/CLFS/config index 1e20ebc..64aff76 100644 --- a/CLFS/config +++ b/CLFS/config @@ -22,16 +22,16 @@ TARGET= #-------------------------------- # >>>> 64-64 BUILD <<<< # ARCH=x86_64-64 ; TARGET="x86_64-unknown-linux-gnu" -# ARCH=mips64-64 ; TARGET="mipsel-unknown-linux-gnu" -# ARCH=mips64-64 ; TARGET="mips-unknown-linux-gnu" +# ARCH=mips64-64 ; TARGET="mips64el-unknown-linux-gnu" +# ARCH=mips64-64 ; TARGET="mips64-unknown-linux-gnu" # ARCH=sparc64-64 ; TARGET="sparc64-unknown-linux-gnu" # ARCH=alpha ; TARGET="alpha-unknown-linux-gnu" #-------------------------------- # >>>> MULTILIB 32/64 <<<< # ARCH=x86_64 ; TARGET="x86_64-unknown-linux-gnu" ; TARGET32="i686-pc-linux-gnu" -# ARCH=mips64 ; TARGET="mipsel-unknown-linux-gnu" ; TARGET32="mipsel-unknown-linux-gnu" -# ARCH=mips64 ; TARGET="mips-unknown-linux-gnu" ; TARGET32="mips-unknown-linux-gnu" -# ARCH=sparc64 ; TARGET="sparc64-unknown-linux-gnu" ; TARGET32="sparcv9-unknown-linux-gnu" +# ARCH=mips64 ; TARGET="mips64el-unknown-linux-gnu" ; TARGET32="mipsel-unknown-linux-gnu" +# ARCH=mips64 ; TARGET="mips64-unknown-linux-gnu" ; TARGET32="mips-unknown-linux-gnu" +# ARCH=sparc64 ; TARGET="sparc64-unknown-linux-gnu" ; TARGET32="sparc-unknown-linux-gnu" # ARCH=ppc64 ; TARGET="powerpc64-unknown-linux-gnu" ; TARGET32="powerpc-unknown-linux-gnu" #--- What build method should be used chroot/boot @@ -68,6 +68,7 @@ XSL=clfs.xsl #--- Book version LFSVRS=development +TREE=trunk/BOOK #--- Name of the makefile MKFILE=$JHALFSDIR/Makefile diff --git a/CLFS/master.sh b/CLFS/master.sh index d99f14d..48f55b6 100755 --- a/CLFS/master.sh +++ b/CLFS/master.sh @@ -10,12 +10,12 @@ #----------------------------# host_prep_Makefiles() { # Initialization of the system #----------------------------# - local LFS_HOST + local CLFS_HOST echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files${R_arrow}" # defined here, only for ease of reading - LFS_HOST="`echo ${MACHTYPE} | sed -e 's/unknown/cross/g' -e 's/-pc-/-cross-/g'`" + CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")" ( cat << EOF 023-creatingtoolsdir: @@ -41,43 +41,43 @@ cat << EOF 025-addinguser: 024-creatingcrossdir @\$(call echo_message, Building) - @if [ ! -d /home/lfs ]; then \\ - groupadd lfs; \\ - useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\ + @if [ ! -d /home/clfs ]; then \\ + groupadd clfs; \\ + useradd -s /bin/bash -g clfs -m -k /dev/null clfs; \\ else \\ - touch user-lfs-exist; \\ + touch user-clfs-exist; \\ fi; - @chown lfs \$(MOUNT_PT) && \\ - chown lfs \$(MOUNT_PT)/tools && \\ - chown lfs \$(MOUNT_PT)/cross-tools && \\ - chown lfs \$(MOUNT_PT)/sources && \\ + @chown clfs \$(MOUNT_PT) && \\ + chown clfs \$(MOUNT_PT)/tools && \\ + chown clfs \$(MOUNT_PT)/cross-tools && \\ + chown clfs \$(MOUNT_PT)/sources && \\ touch \$@ && \\ echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ echo --------------------------------------------------------------------------------\$(WHITE) 026-settingenvironment: 025-addinguser @\$(call echo_message, Building) - @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\ - mv /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\ + @if [ -f /home/clfs/.bashrc -a ! -f /home/clfs/.bashrc.XXX ]; then \\ + mv /home/clfs/.bashrc /home/clfs/.bashrc.XXX; \\ fi; - @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\ - mv /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\ + @if [ -f /home/clfs/.bash_profile -a ! -f /home/clfs/.bash_profile.XXX ]; then \\ + mv /home/clfs/.bash_profile /home/clfs/.bash_profile.XXX; \\ fi; - @echo "set +h" > /home/lfs/.bashrc && \\ - echo "umask 022" >> /home/lfs/.bashrc && \\ - echo "LFS=\$(MOUNT_PT)" >> /home/lfs/.bashrc && \\ - echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\ - echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\ - echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\ - echo "" >> /home/lfs/.bashrc && \\ - echo "unset CFLAGS" >> /home/lfs/.bashrc && \\ - echo "unset CXXFLAGS" >> /home/lfs/.bashrc && \\ - echo "" >> /home/lfs/.bashrc && \\ - echo "export LFS_HOST=\"${LFS_HOST}\"" >> /home/lfs/.bashrc && \\ - echo "export LFS_TARGET=\"${TARGET}\"" >> /home/lfs/.bashrc && \\ - echo "export LFS_TARGET32=\"${TARGET32}\"" >> /home/lfs/.bashrc && \\ - echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc - @chown lfs:lfs /home/lfs/.bashrc && \\ + @echo "set +h" > /home/clfs/.bashrc && \\ + echo "umask 022" >> /home/clfs/.bashrc && \\ + echo "CLFS=\$(MOUNT_PT)" >> /home/clfs/.bashrc && \\ + echo "LC_ALL=POSIX" >> /home/clfs/.bashrc && \\ + echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/clfs/.bashrc && \\ + echo "export CLFS LC_ALL PATH" >> /home/clfs/.bashrc && \\ + echo "" >> /home/clfs/.bashrc && \\ + echo "unset CFLAGS" >> /home/clfs/.bashrc && \\ + echo "unset CXXFLAGS" >> /home/clfs/.bashrc && \\ + echo "" >> /home/clfs/.bashrc && \\ + echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/clfs/.bashrc && \\ + echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/clfs/.bashrc && \\ + echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/clfs/.bashrc && \\ + echo "source $JHALFSDIR/envars" >> /home/clfs/.bashrc + @chown clfs:clfs /home/clfs/.bashrc && \\ touch envars && \\ touch \$@ && \\ echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ @@ -117,17 +117,9 @@ cross_tools_Makefiles() { # name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \ -e 's@-static@@' \ -e 's@-final@@' \ - -e 's@-headers@@' \ - -e 's@-64@@' \ + -e 's@-64@@' \ -e 's@-n32@@'` - # Adjust 'name' and patch a few scripts on the fly.. - case $name in - linux-libc) name=linux-libc-headers ;; - esac - # - # Find the version of the command files, if it corresponds with the building of a specific package - vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` - + pkg_tarball=$(get_package_tarball_name $name) #--------------------------------------------------------------------# # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # @@ -137,13 +129,13 @@ cross_tools_Makefiles() { # # as a dependency. Also call the echo_message function. wrt_target "${this_script}" "$PREV" # - # If $vrs isn't empty, we've got a package... + # If $pkg_tarball isn't empty, we've got a package... # - [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" + [[ "$pkg_tarball" != "" ]] && wrt_unpack_clfs "$pkg_tarball" # - wrt_run_as_su "${this_script}" "${file}" + wrt_run_as_clfs_su "${this_script}" "${file}" # - [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}" + [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" # # Include a touch of the target name so make can check if it's already been made. wrt_touch @@ -167,6 +159,15 @@ temptools_Makefiles() { # for file in temp-system/* ; do # Keep the script file name this_script=`basename $file` + # + # Deal with any odd scripts.. + case $this_script in + *choose) # The choose script will fail if you cannot enter the new environment + # If the 'boot' build method was chosen don't run the script + [[ $METHOD = "boot" ]] && continue; ;; + *) ;; + esac + # # First append each name of the script files to a list (this will become # the names of the targets in the Makefile @@ -176,9 +177,7 @@ temptools_Makefiles() { # # Grab the name of the target, strip id number, XXX-script name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'` # - # Find the version of the command files, if it corresponds with the building of a specific package - vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` - + pkg_tarball=$(get_package_tarball_name $name) #--------------------------------------------------------------------# # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # @@ -188,15 +187,15 @@ temptools_Makefiles() { # # as a dependency. Also call the echo_message function. wrt_target "${this_script}" "$PREV" # - # If $vrs isn't empty, we've got a package... + # If $pkg_tarball isn't empty, we've got a package... # Insert instructions for unpacking the package and to set the PKGDIR variable. # - [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" - [[ "$vrs" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name" + [[ "$pkg_tarball" != "" ]] && wrt_unpack_clfs "$pkg_tarball" + [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name" # - wrt_run_as_su "${this_script}" "${file}" + wrt_run_as_clfs_su "${this_script}" "${file}" # - [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}" + [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" # # Include a touch of the target name so make can check if it's already been made. wrt_touch @@ -249,8 +248,8 @@ boot_Makefiles() { # *lilo-build) name=lilo ;; *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;; esac - - vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` + # Identify the unique version naming scheme for the clfs bootscripts..(bad boys) + pkg_tarball=$(get_package_tarball_name $name) #--------------------------------------------------------------------# # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # @@ -260,27 +259,27 @@ boot_Makefiles() { # # as a dependency. Also call the echo_message function. wrt_target "${this_script}" "$PREV" # - # If $vrs isn't empty, we've got a package... + # If $pkg_tarball isn't empty, we've got a package... # Insert instructions for unpacking the package and changing directories # - [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" - [[ "$vrs" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name" + [[ "$pkg_tarball" != "" ]] && wrt_unpack_clfs "$pkg_tarball" + [[ "$pkg_tarball" != "" ]] && [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name" # # Select a script execution method case $this_script in - *changingowner*) wrt_run_as_root "${this_script}" "${file}" ;; - *devices*) wrt_run_as_root "${this_script}" "${file}" ;; + *changingowner*) wrt_run_as_clfs_root "${this_script}" "${file}" ;; + *devices*) wrt_run_as_clfs_root "${this_script}" "${file}" ;; *fstab*) if [[ -n "$FSTAB" ]]; then wrt_copy_fstab "${this_script}" else - wrt_run_as_su "${this_script}" "${file}" + wrt_run_as_clfs_su "${this_script}" "${file}" fi ;; - *) wrt_run_as_su "${this_script}" "${file}" ;; + *) wrt_run_as_clfs_su "${this_script}" "${file}" ;; esac # # Housekeeping...remove any build directory(ies) except if the package build fails. - [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}" + [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" # # Include a touch of the target name so make can check if it's already been made. wrt_touch @@ -317,7 +316,8 @@ chroot_Makefiles() { # # Grab the name of the target, strip id number, XXX-script name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'` - vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` + + pkg_tarball=$(get_package_tarball_name $name) #--------------------------------------------------------------------# # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # @@ -327,26 +327,26 @@ chroot_Makefiles() { # # as a dependency. Also call the echo_message function. wrt_target "${this_script}" "$PREV" # - # If $vrs isn't empty, we've got a package... + # If $pkg_tarball isn't empty, we've got a package... # Insert instructions for unpacking the package and changing directories # - if [ "$vrs" != "" ] ; then + if [ "$pkg_tarball" != "" ] ; then case $this_script in - *util-linux) wrt_unpack "$name-$vrs.tar.*" ;; - *) wrt_unpack2 "$name-$vrs.tar.*" ;; + *util-linux) wrt_unpack_clfs "$pkg_tarball" ;; + *) wrt_unpack2 "$pkg_tarball" ;; esac [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name" fi # # Select a script execution method case $this_script in - *kernfs) wrt_run_as_root "${this_script}" "${file}" ;; - *util-linux) wrt_run_as_su "${this_script}" "${file}" ;; - *) wrt_run_as_chroot1 "${this_script}" "${file}" ;; + *kernfs) wrt_run_as_clfs_root "${this_script}" "${file}" ;; + *util-linux) wrt_run_as_clfs_su "${this_script}" "${file}" ;; + *) wrt_run_as_chroot1 "${this_script}" "${file}" ;; esac # # Housekeeping...remove the build directory(ies), except if the package build fails. - [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}" + [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" # # Include a touch of the target name so make can check if it's already been made. wrt_touch @@ -382,7 +382,7 @@ testsuite_tools_Makefiles() { # -e 's@64@@' \ -e 's@n32@@'` - vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` + pkg_tarball=$(get_package_tarball_name $name) #--------------------------------------------------------------------# # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # @@ -392,10 +392,7 @@ testsuite_tools_Makefiles() { # # as a dependency. Also call the echo_message function. wrt_target "${this_script}" "$PREV" # - case $name in - tcl) wrt_unpack2 "$name$vrs-src.tar.*" ;; - *) wrt_unpack2 "$name-$vrs.tar.*" ;; - esac + wrt_unpack2 "$pkg_tarball" [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name" # wrt_run_as_chroot1 "${this_script}" "${file}" @@ -437,7 +434,7 @@ bm_testsuite_tools_Makefiles() { # -e 's@64@@' \ -e 's@n32@@'` - vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` + pkg_tarball=$(get_package_tarball_name $name) #--------------------------------------------------------------------# # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # @@ -445,12 +442,9 @@ bm_testsuite_tools_Makefiles() { # # # Drop in the name of the target on a new line, and the previous target # as a dependency. Also call the echo_message function. - wrt_target "${this_script}" "$PREV" + wrt_target_boot "${this_script}" "$PREV" # - case $name in - tcl) wrt_unpack3 "$name$vrs-src.tar.*" ;; - *) wrt_unpack3 "$name-$vrs.tar.*" ;; - esac + wrt_unpack3 "$pkg_tarball" [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name" # wrt_run_as_root2 "${this_script}" "${file}" @@ -519,9 +513,9 @@ final_system_Makefiles() { # # Find the version of the command files, if it corresponds with the building of # a specific package. We need this here to can skip scripts not needed for # iterations rebuilds - vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` + pkg_tarball=$(get_package_tarball_name $name) - if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then + if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then case "${this_script}" in *stripping*) ;; *) continue ;; @@ -544,10 +538,9 @@ final_system_Makefiles() { # # as a dependency. Also call the echo_message function. wrt_target "${this_script}${N}" "$PREV" - # If $vrs isn't empty, we've got a package... - if [ "$vrs" != "" ] ; then - FILE="$name-$vrs.tar.*" - wrt_unpack2 "$FILE" + # If $pkg_tarball isn't empty, we've got a package... + if [ "$pkg_tarball" != "" ] ; then + wrt_unpack2 "$pkg_tarball" # If the testsuites must be run, initialize the log file case $name in binutils | gcc | glibc ) @@ -563,7 +556,7 @@ final_system_Makefiles() { # # wrt_run_as_chroot1 "${this_script}" "${file}" # - [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}" + [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" # # Include a touch of the target name so make can check if it's already been made. wrt_touch @@ -630,9 +623,10 @@ bm_final_system_Makefiles() { # # Find the version of the command files, if it corresponds with the building of # a specific package. We need this here to can skip scripts not needed for # iterations rebuilds - vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` - if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then + pkg_tarball=$(get_package_tarball_name $name) + + if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then case "${this_script}" in *stripping*) ;; *) continue ;; @@ -653,11 +647,11 @@ bm_final_system_Makefiles() { # # # Drop in the name of the target on a new line, and the previous target # as a dependency. Also call the echo_message function. - wrt_target "${this_script}${N}" "$PREV" + wrt_target_boot "${this_script}${N}" "$PREV" - # If $vrs isn't empty, we've got a package... - if [ "$vrs" != "" ] ; then - FILE="$name-$vrs.tar.*" + # If $pkg_tarball isn't empty, we've got a package... + if [ "$pkg_tarball" != "" ] ; then + FILE="$pkg_tarball" wrt_unpack3 "$FILE" # If the testsuites must be run, initialize the log file case $name in @@ -674,7 +668,7 @@ bm_final_system_Makefiles() { # # wrt_run_as_root2 "${this_script}" "${file}" # - [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}" + [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}" # # Include a touch of the target name so make can check if it's already been made. wrt_touch @@ -720,7 +714,8 @@ bootscripts_Makefiles() { # *bootscripts*) name=bootscripts-cross-lfs ;; *udev-rules) name=udev-cross-lfs ;; esac - vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` + + pkg_tarball=$(get_package_tarball_name $name) #--------------------------------------------------------------------# # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # @@ -730,13 +725,13 @@ bootscripts_Makefiles() { # # as a dependency. Also call the echo_message function. wrt_target "${this_script}" "$PREV" # - # If $vrs isn't empty, we've got a package... + # If $pkg_tarball isn't empty, we've got a package... # - [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*" + [[ "$pkg_tarball" != "" ]] && wrt_unpack2 "$pkg_tarball" # wrt_run_as_chroot1 "${this_script}" "${file}" # - [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}" + [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" # # Include a touch of the target name so make can check if it's already been made. wrt_touch @@ -781,7 +776,8 @@ bm_bootscripts_Makefiles() { # *bootscripts*) name=bootscripts-cross-lfs ;; esac - vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` + + pkg_tarball=$(get_package_tarball_name $name) #--------------------------------------------------------------------# # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # @@ -789,15 +785,15 @@ bm_bootscripts_Makefiles() { # # # Drop in the name of the target on a new line, and the previous target # as a dependency. Also call the echo_message function. - wrt_target "${this_script}" "$PREV" + wrt_target_boot "${this_script}" "$PREV" # - # If $vrs isn't empty, we've got a package... + # If $pkg_tarball isn't empty, we've got a package... # - [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*" + [[ "$pkg_tarball" != "" ]] && wrt_unpack3 "$pkg_tarball" # wrt_run_as_root2 "${this_script}" "${file}" # - [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}" + [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}" # # Include a touch of the target name so make can check if it's already been made. wrt_touch @@ -844,7 +840,8 @@ bootable_Makefiles() { # *kernel*) name=linux ;; esac - vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` + + pkg_tarball=$(get_package_tarball_name $name) #--------------------------------------------------------------------# # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # @@ -854,10 +851,10 @@ bootable_Makefiles() { # # as a dependency. Also call the echo_message function. wrt_target "${this_script}" "$PREV" # - # If $vrs isn't empty, we've got a package... + # If $pkg_tarball isn't empty, we've got a package... # Insert instructions for unpacking the package and changing directories # - [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*" + [[ "$pkg_tarball" != "" ]] && wrt_unpack2 "$pkg_tarball" # # Select a script execution method case $this_script in @@ -871,7 +868,7 @@ bootable_Makefiles() { # esac # # Housekeeping...remove any build directory(ies) except if the package build fails. - [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}" + [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" # # Include a touch of the target name so make can check if it's already been made. wrt_touch @@ -917,12 +914,11 @@ bm_bootable_Makefiles() { # # # Grab the name of the target, strip id number and misc words. case $this_script in - *kernel) name=linux - ;; + *kernel) name=linux ;; *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;; esac - vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` + pkg_tarball=$(get_package_tarball_name $name) #--------------------------------------------------------------------# # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # @@ -930,12 +926,12 @@ bm_bootable_Makefiles() { # # # Drop in the name of the target on a new line, and the previous target # as a dependency. Also call the echo_message function. - wrt_target "${this_script}" "$PREV" + wrt_target_boot "${this_script}" "$PREV" # - # If $vrs isn't empty, we've got a package... + # If $pkg_tarball isn't empty, we've got a package... # Insert instructions for unpacking the package and changing directories # - [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*" + [[ "$pkg_tarball" != "" ]] && wrt_unpack3 "$pkg_tarball" # # Select a script execution method case $this_script in @@ -951,7 +947,7 @@ bm_bootable_Makefiles() { # esac # # Housekeeping...remove any build directory(ies) except if the package build fails. - [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}" + [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs2 "${name}" # # Include a touch of the target name so make can check if it's already been made. wrt_touch @@ -1031,7 +1027,7 @@ EOF -e 's|\\$|&&|g' \ -e 's|exit||g' \ -e 's|$| -c|' \ - -e 's|"$$LFS"|$(MOUNT_PT)|'\ + -e 's|"$$CLFS"|$(MOUNT_PT)|'\ -e 's|set -e||'` echo -e "CHROOT1= $chroot\n" >> $MKFILE fi @@ -1063,21 +1059,24 @@ clean-all: clean clean: clean-chapter4 clean-chapter3 clean-chapter2 +restart: + @echo "This feature does not exist for the CLFS makefile. (yet)" + clean-chapter2: - -if [ ! -f user-lfs-exist ]; then \\ - userdel lfs; \\ - rm -rf /home/lfs; \\ + -if [ ! -f user-clfs-exist ]; then \\ + userdel clfs; \\ + rm -rf /home/clfs; \\ fi; rm -rf \$(MOUNT_PT)/tools rm -f /tools rm -rf \$(MOUNT_PT)/cross-tools rm -f /cross-tools - rm -f envars user-lfs-exist + rm -f envars user-clfs-exist rm -f 02* logs/02*.log clean-chapter3: rm -rf \$(MOUNT_PT)/tools/* - rm -f $cross_tools restore-lfs-env sources-dir + rm -f $cross_tools restore-clfs-env sources-dir cd logs && rm -f $cross_tools && cd .. clean-chapter4: @@ -1091,15 +1090,15 @@ clean-chapter4: cd logs && rm -f $temptools && cd .. -restore-lfs-env: +restore-clfs-env: @\$(call echo_message, Building) - @if [ -f /home/lfs/.bashrc.XXX ]; then \\ - mv -f /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\ + @if [ -f /home/clfs/.bashrc.XXX ]; then \\ + mv -f /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\ fi; - @if [ -f /home/lfs/.bash_profile.XXX ]; then \\ - mv /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\ + @if [ -f /home/clfs/.bash_profile.XXX ]; then \\ + mv /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\ fi; - @chown lfs:lfs /home/lfs/.bash* && \\ + @chown clfs:clfs /home/clfs/.bash* && \\ touch \$@ && \\ echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ echo --------------------------------------------------------------------------------\$(WHITE) @@ -1110,9 +1109,9 @@ do-housekeeping: @-umount \$(MOUNT_PT)/dev @-umount \$(MOUNT_PT)/sys @-umount \$(MOUNT_PT)/proc - @-if [ ! -f user-lfs-exist ]; then \\ - userdel lfs; \\ - rm -rf /home/lfs; \\ + @-if [ ! -f user-clfs-exist ]; then \\ + userdel clfs; \\ + rm -rf /home/clfs; \\ fi; EOF @@ -1142,22 +1141,25 @@ clean-all: clean clean: clean-makesys clean-makeboot clean-jhalfs +restart: + @echo "This feature does not exist for the CLFS makefile. (yet)" + clean-jhalfs: - -if [ ! -f user-lfs-exist ]; then \\ - userdel lfs; \\ - rm -rf /home/lfs; \\ + -if [ ! -f user-clfs-exist ]; then \\ + userdel clfs; \\ + rm -rf /home/clfs; \\ fi; rm -rf \$(MOUNT_PT)/tools rm -f /tools rm -rf \$(MOUNT_PT)/cross-tools rm -f /cross-tools - rm -f envars user-lfs-exist + rm -f envars user-clfs-exist rm -f 02* logs/02*.log clean-makeboot: rm -rf /tools/* rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools - rm -f restore-lfs-env sources-dir + rm -f restore-clfs-env sources-dir cd logs && rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools && cd .. clean-makesys: @@ -1173,15 +1175,15 @@ clean-makesys: cd logs && rm -f $basicsystem && rm -f $bootscripttools && rm -f $bootabletools && cd .. -restore-lfs-env: +restore-clfs-env: @\$(call echo_message, Building) - @if [ -f /home/lfs/.bashrc.XXX ]; then \\ - mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\ + @if [ -f /home/clfs/.bashrc.XXX ]; then \\ + mv -fv /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\ fi; - @if [ -f /home/lfs/.bash_profile.XXX ]; then \\ - mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\ + @if [ -f /home/clfs/.bash_profile.XXX ]; then \\ + mv -v /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\ fi; - @chown lfs:lfs /home/lfs/.bash* && \\ + @chown clfs:clfs /home/clfs/.bash* && \\ touch \$@ && \\ echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ echo --------------------------------------------------------------------------------\$(WHITE) diff --git a/CLFS2/clfs2.xsl b/CLFS2/clfs2.xsl new file mode 100644 index 0000000..44752ab --- /dev/null +++ b/CLFS2/clfs2.xsl @@ -0,0 +1,243 @@ + + + %general-entities; +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 00 + + + + 0 + + + + + + + + + + + + #!/tools/bin/bash set -e + + + #!/bin/sh + + + #!/bin/sh set -e + + + + cd $PKGDIR + + tar -xvf ../vim-&vim-version;-lang.* --strip-components=1 + + + + exit + + + + + + + + + + + + + + + + make -k + + >> $TEST_LOG 2>&1 || true + + + + + + + + + tar.* + + + + + + + patch -Z + + + + + + + export LANG= + + + + + + + + + make mrproper + + cp -v ../bootkernel-config .config + + + cp -v ../kernel-config .config + + + + + + + + + + + + >> $TEST_LOG 2>&1 || true + + + + + + + + + + make -k check >> $TEST_LOG 2>&1 || true + + + + + + + + >> $TEST_LOG 2>&1 || true + + + + + + + + + >> $TEST_LOG + + + + + + + + + || true + + + + + + + + + + + + + + + + + + + + + + **EDITME + + EDITME** + + + + + diff --git a/CLFS2/config b/CLFS2/config new file mode 100644 index 0000000..8f65f02 --- /dev/null +++ b/CLFS2/config @@ -0,0 +1,54 @@ +##### +# +# Configuration file for the CLFS module +# +# $Id$ +# +##### + +#--- Which target architecture you want to build for, +# used to select proper book and set TARGETS +#-------------------------------- +TARGET= +TARGET32= +# >>>> 32-32 BUILD <<<< + ARCH=x86 ; TARGET="i486-pc-linux-gnu" +# ARCH=x86 ; TARGET="i586-pc-linux-gnu" +# ARCH=x86 ; TARGET="i686-pc-linux-gnu" +# ARCH=arm ; TARGET="arm-unknown-linux-gnu" +#-------------------------------- +# >>>> 64-64 BUILD <<<< +#-------------------------------- +# >>>> MULTILIB 32/64 <<<< + +#--- Location of fstab file (if empty, a template is created) +FSTAB= + +#--- Fully qualified path to a kernel config file +# If no config file is specified the kernel is NOT compiled +CONFIG= + +# Get the kernel package and patches even if no configutation file +# has been supplied? 0(no)/1(yes) +GETKERNEL=0 + +#--- Book's sources directory +# If you have previously checked out the book from the repository +BOOK= + +#==== INTERNAL VARIABLES ==== +# Don't edit it unless you know what you are doing + +#--- Extra files that need be copied to $JHALFSDIR +FILES="" + +#--- Default stylesheet +XSL=clfs2.xsl + +#--- Book version +LFSVRS=development +TREE=branches/clfs-2.0/BOOK + +#--- Name of the makefile +MKFILE=$JHALFSDIR/Makefile + diff --git a/CLFS2/master.sh b/CLFS2/master.sh new file mode 100755 index 0000000..a2a8383 --- /dev/null +++ b/CLFS2/master.sh @@ -0,0 +1,557 @@ +#!/bin/sh +# $Id$ + +################################### +### FUNCTIONS ### +################################### + +#----------------------------------# +wrt_ExecuteAsUser() { # Execute the file ($3) under the users account ($1), log in $2 +#----------------------------------# + local this_user=$1 + local this_script=$2 + local file=$3 +( +cat << EOF + @( time { su - ${this_user} -c "source /home/${this_user}/.bashrc && $JHALFSDIR/${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 +} + + +#----------------------------------# +wrt_Unpack_SetOwner() { # Unpack and set owner. Assign 'ROOT' var +#----------------------------------# + local USER_ACCT=$1 + local FILE=$2 + local optSAVE_PREVIOUS=$3 + + if [ "${optSAVE_PREVIOUS}" != "1" ]; then + wrt_remove_existing_dirs "$FILE" + fi +( +cat << EOF + @\$(call unpack,$FILE) + @ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\ + echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\ + chown -R ${USER_ACCT} \$(MOUNT_PT)\$(SRC)/\$\$ROOT +EOF +) >> $MKFILE.tmp +} + + +#----------------------------# +host_prep_Makefiles() { # Initialization of the system +#----------------------------# + local CLFS_HOST + + echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files${R_arrow}" + + # defined here, only for ease of reading + CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")" +( +cat << EOF +023-creatingtoolsdir: + @\$(call echo_message, Building) + @mkdir \$(MOUNT_PT)/tools && \\ + rm -f /tools && \\ + ln -s \$(MOUNT_PT)/tools / + @if [ ! -d \$(MOUNT_PT)/sources ]; then \\ + mkdir \$(MOUNT_PT)/sources; \\ + fi; + @chmod a+wt \$(MOUNT_PT)/sources + @touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) + +025-addinguser: 023-creatingtoolsdir + @\$(call echo_message, Building) + @if [ ! -d /home/clfs ]; then \\ + groupadd clfs; \\ + useradd -s /bin/bash -g clfs -m -k /dev/null clfs; \\ + else \\ + touch user-clfs-exist; \\ + fi; + @chown clfs \$(MOUNT_PT) && \\ + chown clfs \$(MOUNT_PT)/tools && \\ + chown clfs \$(MOUNT_PT)/sources + @touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) + +026-settingenvironment: 025-addinguser + @\$(call echo_message, Building) + @if [ -f /home/clfs/.bashrc -a ! -f /home/clfs/.bashrc.XXX ]; then \\ + mv /home/clfs/.bashrc /home/clfs/.bashrc.XXX; \\ + fi; + @if [ -f /home/clfs/.bash_profile -a ! -f /home/clfs/.bash_profile.XXX ]; then \\ + mv /home/clfs/.bash_profile /home/clfs/.bash_profile.XXX; \\ + fi; + @echo "set +h" > /home/clfs/.bashrc && \\ + echo "umask 022" >> /home/clfs/.bashrc && \\ + echo "CLFS=\$(MOUNT_PT)" >> /home/clfs/.bashrc && \\ + echo "LC_ALL=POSIX" >> /home/clfs/.bashrc && \\ + echo "PATH=\$(MOUNT_PT)/cross-tools/bin:/bin:/usr/bin" >> /home/clfs/.bashrc && \\ + echo "export CLFS LC_ALL PATH" >> /home/clfs/.bashrc && \\ + echo "" >> /home/clfs/.bashrc && \\ + echo "unset CFLAGS" >> /home/clfs/.bashrc && \\ + echo "unset CXXFLAGS" >> /home/clfs/.bashrc && \\ + echo "" >> /home/clfs/.bashrc && \\ + echo "export CLFS_HOST=\"${CLFS_HOST}\"" >> /home/clfs/.bashrc && \\ + echo "export CLFS_TARGET=\"${TARGET}\"" >> /home/clfs/.bashrc && \\ + echo "export CLFS_TARGET32=\"${TARGET32}\"" >> /home/clfs/.bashrc && \\ + echo "source $JHALFSDIR/envars" >> /home/clfs/.bashrc + @chown clfs:clfs /home/clfs/.bashrc && \\ + touch envars + @touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) + +027-create-directories: 026-settingenvironment + @\$(call echo_message, Building) + + @mkdir -p \$(MOUNT_PT)/{bin,boot,dev,{etc/,}opt,home,lib,mnt} + @mkdir -p \$(MOUNT_PT)/{proc,media/{floppy,cdrom},sbin,srv,sys} + @mkdir -p \$(MOUNT_PT)/var/{lock,log,mail,run,spool} + @mkdir -p \$(MOUNT_PT)/var/{opt,cache,lib/{misc,locate},local} + @install -d -m 0750 \$(MOUNT_PT)/root + @install -d -m 1777 \$(MOUNT_PT){/var,}/tmp + @mkdir -p \$(MOUNT_PT)/usr/{,local/}{bin,include,lib,sbin,src} + @mkdir -p \$(MOUNT_PT)/usr/{,local/}share/{doc,info,locale,man} + @mkdir -p \$(MOUNT_PT)/usr/{,local/}share/{misc,terminfo,zoneinfo} + @mkdir -p \$(MOUNT_PT)/usr/{,local/}share/man/man{1,2,3,4,5,6,7,8} + @for dir in \$(MOUNT_PT)/usr{,/local}; do \\ + ln -s share/{man,doc,info} \$\$dir ; \\ + done + + @touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) + +028-creating-sysfile: 027-create-directories + @\$(call echo_message, Building) + + @touch \$(MOUNT_PT)/etc/mtab + @echo "root::0:0:root:/root:/bin/bash" >> \$(MOUNT_PT)/etc/passwd + @echo "root:x:0:" >> \$(MOUNT_PT)/etc/group + @echo "bin:x:1:" >> \$(MOUNT_PT)/etc/group + @echo "sys:x:2:" >> \$(MOUNT_PT)/etc/group + @echo "kmem:x:3" >> \$(MOUNT_PT)/etc/group + @echo "tty:x:4:" >> \$(MOUNT_PT)/etc/group + @echo "tape:x:5:" >> \$(MOUNT_PT)/etc/group + @echo "daemon:x:6:" >> \$(MOUNT_PT)/etc/group + @echo "floppy:x:7:" >> \$(MOUNT_PT)/etc/group + @echo "disk:x:8:" >> \$(MOUNT_PT)/etc/group + @echo "lp:x:9:" >> \$(MOUNT_PT)/etc/group + @echo "dialout:x:10:" >> \$(MOUNT_PT)/etc/group + @echo "audio:x:11:" >> \$(MOUNT_PT)/etc/group + @echo "video:x:12:" >> \$(MOUNT_PT)/etc/group + @echo "utmp:x:13:" >> \$(MOUNT_PT)/etc/group + @echo "usb:x:14:" >> \$(MOUNT_PT)/etc/group + @echo "cdrom:x:15:" >> \$(MOUNT_PT)/etc/group + + @touch \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/{btmp,lastlog,wtmp} + @chmod 664 \$(MOUNT_PT)/var/run/utmp \$(MOUNT_PT)/var/log/lastlog + @chown -R clfs \$(MOUNT_PT) + + @touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) + +EOF +) >> $MKFILE.tmp +} + + + +#-----------------------------# +cross_tools_Makefiles() { # +#-----------------------------# + echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools${R_arrow}" + + for file in cross-tools/* ; do + # Keep the script file name + this_script=`basename $file` + # + # Skip this script... + case $this_script in + *cflags* | *variables* ) # work done in host_prep_Makefiles + continue; ;; + *) ;; + esac + # + # Set the dependency for the first target. + if [ -z $PREV ] ; then PREV=026-settingenvironment ; fi + + # First append each name of the script files to a list (this will become + # the names of the targets in the Makefile + cross_tools="$cross_tools $this_script" + + # Grab the name of the target (minus the -headers or -cross in the case of gcc + # and binutils in chapter 5) + name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \ + -e 's@-static@@' \ + -e 's@-final@@' \ + -e 's@-64@@' \ + -e 's@-n32@@'` + case $name in + glibc-headers) name="glibc" ;; + esac + pkg_tarball=$(get_package_tarball_name $name) + + #--------------------------------------------------------------------# + # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Drop in the name of the target on a new line, and the previous target + # as a dependency. Also call the echo_message function. + wrt_target "${this_script}" "$PREV" + # + # If $pkg_tarball isn't empty, we've got a package... + if [ "$pkg_tarball" != "" ] ; then + wrt_Unpack_SetOwner "clfs" "$pkg_tarball" + # If using optimizations, write the instructions + [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name" + fi + # + wrt_ExecuteAsUser "clfs" "${this_script}" "${file}" + # + [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" + # + # Include a touch of the target name so make can check if it's already been made. + wrt_touch + # + #--------------------------------------------------------------------# + # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Keep the script file name for Makefile dependencies. + PREV=$this_script + + done # for file in .... +} + + + +#-----------------------------# +final_system_Makefiles() { # +#-----------------------------# + # Set envars and scripts for iteration targets + LOGS="" # Start with an empty global LOGS envar + if [[ -z "$1" ]] ; then + local N="" + else + local N=-build_$1 + local basicsystem="" + mkdir final-system$N + cp final-system/* final-system$N + for script in final-system$N/* ; do + # Overwrite existing symlinks, files, and dirs + sed -e 's/ln -sv/&f/g' \ + -e 's/mv -v/&f/g' \ + -e 's/mkdir -v/&p/g' -i ${script} + done + # Remove Bzip2 binaries before make install + sed -e 's@make install@rm -vf /usr/bin/bz*\n&@' -i final-system$N/*-bzip2 + # Delete *old Readline libraries just after make install + sed -e 's@make install@&\nrm -v /lib/lib{history,readline}*old@' -i final-system$N/*-readline + fi + + echo "${tab_}${GREEN}Processing... ${L_arrow}final system$N${R_arrow}" + + for file in final-system$N/* ; do + # Keep the script file name + this_script=`basename $file` + + # Test if the stripping phase must be skipped. + # Skip alsp temp-perl for iterative runs + case $this_script in + *stripping*) [[ "$STRIP" = "0" ]] && continue ;; + esac + + # Grab the name of the target, strip id number, XXX-script + name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \ + -e 's@temp-@@' \ + -e 's@-64bit@@' \ + -e 's@-64@@' \ + -e 's@64@@' \ + -e 's@n32@@'` + + # Find the version of the command files, if it corresponds with the building of + # a specific package. We need this here to can skip scripts not needed for + # iterations rebuilds + pkg_tarball=$(get_package_tarball_name $name) + + if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then + case "${this_script}" in + *stripping*) ;; + *) continue ;; + esac + fi + + # Append each name of the script files to a list (this will become + # the names of the targets in the Makefile + basicsystem="$basicsystem ${this_script}${N}" + + # Append each name of the script files to a list (this will become + # the names of the logs to be moved for each iteration) + LOGS="$LOGS ${this_script}" + + #--------------------------------------------------------------------# + # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Drop in the name of the target on a new line, and the previous target + # as a dependency. Also call the echo_message function. + wrt_target "${this_script}${N}" "$PREV" + # + # If $pkg_tarball isn't empty, we've got a package... + if [ "$pkg_tarball" != "" ] ; then + wrt_Unpack_SetOwner "clfs" "$pkg_tarball" + # If using optimizations, write the instructions + [[ "$OPTIMIZE" != "0" ]] && wrt_optimize "$name" && wrt_makeflags "$name" + fi + # + wrt_ExecuteAsUser "clfs" "${this_script}" "${file}" + # + [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" + # + # Include a touch of the target name so make can check if it's already been made. + wrt_touch + # + #--------------------------------------------------------------------# + # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Keep the script file name for Makefile dependencies. + PREV=${this_script}${N} + # Set system_build envar for iteration targets + system_build=$basicsystem + done # for file in final-system/* ... +} + + + +#-----------------------------# +bootscripts_Makefiles() { # +#-----------------------------# + echo "${tab_}${GREEN}Processing... ${L_arrow}bootscripts${R_arrow}" + + for file in bootscripts/* ; do + # Keep the script file name + this_script=`basename $file` + + case $this_script in + *udev) continue ;; # This is not a script but a commentary, we want udev-rules + *console*) continue ;; # Use the files that came with the bootscripts + *) ;; + esac + + # First append each name of the script files to a list (this will become + # the names of the targets in the Makefile + bootscripttools="$bootscripttools $this_script" + + # Grab the name of the target, strip id number, XXX-script + name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\ + -e 's@-64bit@@' \ + -e 's@-64@@' \ + -e 's@64@@' \ + -e 's@n32@@'` + case $name in + *bootscripts*) name=bootscripts-cross-lfs ;; + *udev-rules) name=udev-cross-lfs ;; + esac + + pkg_tarball=$(get_package_tarball_name $name) + + #--------------------------------------------------------------------# + # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Drop in the name of the target on a new line, and the previous target + # as a dependency. Also call the echo_message function. + wrt_target "${this_script}" "$PREV" + # + # If $pkg_tarball isn't empty, we've got a package... + [[ "$pkg_tarball" != "" ]] && wrt_Unpack_SetOwner "clfs" "$pkg_tarball" + # + wrt_ExecuteAsUser "clfs" "${this_script}" "${file}" + # + [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" + # + # Include a touch of the target name so make can check if it's already been made. + wrt_touch + # + #--------------------------------------------------------------------# + # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Keep the script file name for Makefile dependencies. + PREV=$this_script + + done # for file in bootscripts/* ... + +} + + +#-----------------------------# +bootable_Makefiles() { # +#-----------------------------# + echo "${tab_}${GREEN}Processing... ${L_arrow}make bootable${R_arrow}" + + for file in bootable/* ; do + # Keep the script file name + this_script=`basename $file` + + # A little housekeeping on the scripts + case $this_script in + *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;; + *kernel) # if there is no kernel config file do not build the kernel + [[ -z $CONFIG ]] && continue + # Copy the config file to /sources with a standardized name + cp $CONFIG $BUILDDIR/sources/kernel-config + ;; + esac + # + # First append each name of the script files to a list (this will become + # the names of the targets in the Makefile + bootable="$bootable $this_script" + # + # Grab the name of the target, strip id number and misc words. + name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` + case $this_script in + *kernel*) name=linux + ;; + esac + + pkg_tarball=$(get_package_tarball_name $name) + + #--------------------------------------------------------------------# + # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Drop in the name of the target on a new line, and the previous target + # as a dependency. Also call the echo_message function. + wrt_target "${this_script}" "$PREV" + # + # If $pkg_tarball isn't empty, we've got a package... + [[ "$pkg_tarball" != "" ]] && wrt_Unpack_SetOwner "clfs" "$pkg_tarball" + # + # Select a script execution method + case $this_script in + *fstab*) if [[ -n "$FSTAB" ]]; then + wrt_copy_fstab "${this_script}" + else + wrt_ExecuteAsUser "clfs" "${this_script}" "${file}" + fi + ;; + *) wrt_ExecuteAsUser "clfs" "${this_script}" "${file}" + ;; + esac + # + # Housekeeping...remove any build directory(ies) except if the package build fails. + [[ "$pkg_tarball" != "" ]] && wrt_remove_build_dirs "${name}" + # + # Include a touch of the target name so make can check if it's already been made. + wrt_touch + # + #--------------------------------------------------------------------# + # >>>>>>>> END OF Makefile ENTRY <<<<<<<< # + #--------------------------------------------------------------------# + # + # Keep the script file name for Makefile dependencies. + PREV=$this_script + + done + + # Add SBU-disk_usage report target if required + if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi + +} + + +#-----------------------------# +build_Makefile() { # Construct a Makefile from the book scripts +#-----------------------------# + echo "Creating Makefile... ${BOLD}START${OFF}" + + cd $JHALFSDIR/${PROGNAME}-commands + # Start with a clean Makefile.tmp file + >$MKFILE.tmp + + host_prep_Makefiles + cross_tools_Makefiles # $cross_tools + final_system_Makefiles # $basicsystem + bootscripts_Makefiles # $bootscripttools + bootable_Makefiles # $bootable + + # Add a header, some variables and include the function file + # to the top of the real Makefile. +( + cat << EOF +$HEADER + +SRC= /sources +MOUNT_PT= $BUILDDIR +PKG_LST= $PKG_LST + +include makefile-functions + +EOF +) > $MKFILE + + # Drop in the main target 'all:' and the chapter targets with each sub-target + # as a dependency. +( + cat << EOF +all: chapter2 chapter3 chapter4 chapter5 chapter6 do-housekeeping + @\$(call echo_finished,$VERSION) + +chapter2: 023-creatingtoolsdir 025-addinguser 026-settingenvironment 027-create-directories 028-creating-sysfile + +chapter3: chapter2 $cross_tools + +chapter4: chapter3 $basicsystem + +chapter5: chapter4 $bootscripttools + +chapter6: chapter5 $bootable + +clean-all: clean + rm -rf ./{clfs2-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches} + +clean: + +restart: + @echo "This feature does not exist for the CLFS makefile. (yet)" + +restore-clfs-env: + @\$(call echo_message, Building) + @if [ -f /home/clfs/.bashrc.XXX ]; then \\ + mv -f /home/clfs/.bashrc.XXX /home/clfs/.bashrc; \\ + fi; + @if [ -f /home/clfs/.bash_profile.XXX ]; then \\ + mv /home/clfs/.bash_profile.XXX /home/clfs/.bash_profile; \\ + fi; + @chown clfs:clfs /home/clfs/.bash* && \\ + touch \$@ && \\ + echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ + echo --------------------------------------------------------------------------------\$(WHITE) + +do-housekeeping: + @-if [ ! -f user-clfs-exist ]; then \\ + userdel clfs; \\ + rm -rf /home/clfs; \\ + fi; + +EOF +) >> $MKFILE + + # Bring over the items from the Makefile.tmp + cat $MKFILE.tmp >> $MKFILE + rm $MKFILE.tmp + echo "Creating Makefile... ${BOLD}DONE${OFF}" + +} + diff --git a/HLFS/config b/HLFS/config index cb34228..378b7c0 100644 --- a/HLFS/config +++ b/HLFS/config @@ -38,6 +38,7 @@ XSL=hlfs.xsl #--- Book version LFSVRS=development +TREE=trunk/BOOK #--- Name of the makefile MKFILE=$JHALFSDIR/Makefile diff --git a/HLFS/master.sh b/HLFS/master.sh index c6d91cc..1c83f08 100755 --- a/HLFS/master.sh +++ b/HLFS/master.sh @@ -119,13 +119,14 @@ chapter5_Makefiles() { # Bootstrap or temptools phase # Adjust 'name' case $name in - linux-libc) name=linux-libc-headers ;; + linux-libc) name="linux-libc-headers" ;; + gcc) name="gcc-core" ;; + uclibc) name="uClibc" ;; esac # Set the dependency for the first target. if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi - #--------------------------------------------------------------------# # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # #--------------------------------------------------------------------# @@ -136,22 +137,13 @@ chapter5_Makefiles() { # Bootstrap or temptools phase # Find the version of the command files, if it corresponds with the building of # a specific package - vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` - # If $vrs isn't empty, we've got a package... - if [ "$vrs" != "" ] ; then - # Deal with non-standard names - case $name in - tcl) FILE="$name$vrs-src.tar.*" ;; - uclibc) FILE="uClibc-$vrs.tar.*" ;; - gcc) FILE="gcc-core-$vrs.tar.*" ;; - *) FILE="$name-$vrs.tar.*" ;; - esac + pkg_tarball=$(get_package_tarball_name $name) + # If $pkg_tarball isn't empty, we've got a package... + if [ "$pkg_tarball" != "" ] ; then # Insert instructions for unpacking the package and to set the PKGDIR variable. case $this_script in - *binutils* ) - wrt_unpack "$FILE" 1 ;; # Do not delete an existing package directories - *) - wrt_unpack "$FILE" ;; + *binutils* ) wrt_unpack "$pkg_tarball" 1 ;; # Do not delete an existing package directories + *) wrt_unpack "$pkg_tarball" ;; esac # If the testsuites must be run, initialize the log file [[ "$TEST" = "3" ]] && wrt_test_log "${this_script}" @@ -180,12 +172,11 @@ EOF # Remove the build directory(ies) except if the package build fails # (so we can review config.cache, config.log, etc.) # For Binutils the sources must be retained for some time. - if [ "$vrs" != "" ] ; then + if [ "$pkg_tarball" != "" ] ; then case "${this_script}" in - *binutils*) : # do NOTHING - ;; - *) wrt_remove_build_dirs "$name" - ;; + *binutils*) : ;; # do NOTHING + *gcc*) wrt_remove_build_dirs "gcc" ;; + *) wrt_remove_build_dirs "$name" ;; esac fi @@ -271,11 +262,25 @@ chapter6_Makefiles() { # sysroot or chroot build phase # Grab the name of the target name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'` + # + # Sed replacement to fix some rm command that could fail. + # That should be fixed in the book sources. + # + case $name in + glibc) sed 's/rm /rm -f /' -i chapter06$N/$this_script ;; + gcc) sed 's/rm /rm -f /' -i chapter06$N/$this_script ;; + esac + + case $name in + gcc) name="gcc-core" ;; + uclibc) name="uClibc" ;; + esac + # Find the version of the command files, if it corresponds with the building of # a specific package - vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` + pkg_tarball=$(get_package_tarball_name $name) - if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then + if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then case "${this_script}" in *stripping*) ;; *) continue ;; @@ -290,42 +295,23 @@ chapter6_Makefiles() { # sysroot or chroot build phase # the names of the logs to be moved for each iteration) LOGS="$LOGS ${this_script}" - # - # Sed replacement to fix some rm command that could fail. - # That should be fixed in the book sources. - # - case $name in - glibc) - sed 's/rm /rm -f /' -i chapter06$N/$this_script - ;; - gcc) - sed 's/rm /rm -f /' -i chapter06$N/$this_script - ;; - esac #--------------------------------------------------------------------# # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< # #--------------------------------------------------------------------# # # Drop in the name of the target on a new line, and the previous target - # as a dependency. Also call the echo_message function. + # as a dependency. Also call the echo_message function. wrt_target "${this_script}${N}" "$PREV" - # If $vrs isn't empty, we've got a package... + # If $pkg_tarball isn't empty, we've got a package... # Insert instructions for unpacking the package and changing directories - if [ "$vrs" != "" ] ; then - # Deal with non-standard names - case $name in - tcl) FILE="$name$vrs-src.tar.*" ;; - uclibc) FILE="uClibc-$vrs.tar.*" ;; - gcc) FILE="gcc-core-$vrs.tar.*" ;; - *) FILE="$name-$vrs.tar.*" ;; - esac - wrt_unpack2 "$FILE" + if [ "$pkg_tarball" != "" ] ; then + wrt_unpack2 "$pkg_tarball" wrt_target_vars # If the testsuites must be run, initialize the log file case $name in - binutils | gcc | glibc ) + binutils | gcc-core | glibc ) [[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}" ;; * ) @@ -353,7 +339,7 @@ chapter6_Makefiles() { # sysroot or chroot build phase esac # # Remove the build directory(ies) except if the package build fails. - if [ "$vrs" != "" ] ; then + if [ "$pkg_tarball" != "" ] ; then wrt_remove_build_dirs "$name" fi # @@ -427,11 +413,9 @@ chapter7_Makefiles() { # Create a bootable system.. kernel, bootscripts..e case "${this_script}" in *bootscripts*) - vrs=`grep "^lfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` - FILE="lfs-bootscripts-$vrs.tar.*" - wrt_unpack2 "$FILE" - vrs=`grep "^blfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` - echo -e "\t@echo \"\$(MOUNT_PT)\$(SRC)/blfs-bootscripts-$vrs\" >> sources-dir" >> $MKFILE.tmp + wrt_unpack2 $(get_package_tarball_name "lfs-bootscripts") + blfs_bootscripts=$(get_package_tarball_name "blfs-bootscripts" | sed -e 's/.tar.*//' ) + echo -e "\t@echo \"\$(MOUNT_PT)\$(SRC)/$blfs_bootscripts\" >> sources-dir" >> $MKFILE.tmp ;; esac @@ -546,6 +530,8 @@ clean-all: clean clean: clean-chapter7 clean-chapter6 clean-chapter5 clean-chapter3 +restart: restart_code all + clean-chapter3: -if [ ! -f user-lfs-exist ]; then \\ userdel lfs; \\ @@ -599,6 +585,47 @@ do-housekeeping: rm -rf /home/lfs; \\ fi; +restart_code: + @echo ">>> This feature is experimental, BUGS may exist" + + @if [ ! -L /tools ]; then \\ + echo -e "\\nERROR::\\n /tools is NOT a symlink.. /tools must point to \$(MOUNT_PT)/tools\\n" && false;\\ + fi; + + @if [ ! -e /tools ]; then \\ + echo -e "\\nERROR::\\nThe target /tools points to does not exist.\\nVerify the target.. \$(MOUNT_PT)/tools\\n" && false;\\ + fi; + + @if ! stat -c %N /tools | grep "\$(MOUNT_PT)/tools" >/dev/null ; then \\ + echo -e "\\nERROR::\\nThe symlink \\"/tools\\" does not point to \\"\$(MOUNT_PT)/tools\\".\\nCorrect the problem and rerun\\n" && false;\\ + fi; + + @if [ -f ???-kernfs ]; then \\ + mkdir -pv \$(MOUNT_PT)/{proc,sys};\\ + if ! mount -l | "\$(MOUNT_PT)/dev" >/dev/null ; then \\ + mount -vt ramfs ramfs \$(MOUNT_PT)/dev;\\ + fi;\\ + if [ ! -e \$(MOUNT_PT)/dev/console ]; then \\ + mknod -m 600 \$(MOUNT_PT)/dev/console c 5 1;\\ + fi;\\ + if [ ! -e \$(MOUNT_PT)/dev/null ]; then \\ + mknod -m 666 \$(MOUNT_PT)/dev/null c 1 3;\\ + fi;\\ + if ! mount -l | grep "\$(MOUNT_PT)/dev/pts" >/dev/null ; then \\ + mount -vt devpts -o gid=4,mode=620 devpts \$(MOUNT_PT)/dev/pts;\\ + fi;\\ + if ! mount -l | grep "\$(MOUNT_PT)/dev/shm" >/dev/null ; then \\ + mount -vt tmpfs shm \$(MOUNT_PT)/dev/shm;\\ + fi;\\ + if ! mount -l | grep "\$(MOUNT_PT)/proc" >/dev/null ; then \\ + mount -vt proc proc \$(MOUNT_PT)/proc;\\ + fi;\\ + if ! mount -l | grep "\$(MOUNT_PT)/sys" >/dev/null ; then \\ + mount -vt sysfs sysfs \$(MOUNT_PT)/sys;\\ + fi;\\ + fi; + + EOF ) >> $MKFILE diff --git a/LFS/config b/LFS/config index a1388c0..ec59b08 100644 --- a/LFS/config +++ b/LFS/config @@ -10,10 +10,10 @@ FSTAB= #--- Fully qualified path to a kernel config file -# If no config file is specified the kernel is NOT compiled +# If no config file is specified the kernel is NOT compiled CONFIG= -# Get the kernel package and patches even if no configutation file +# Get the kernel package and patches even if no configuration file # has been supplied? 0(no)/1(yes) GETKERNEL=0 @@ -32,6 +32,7 @@ XSL=lfs.xsl #--- Book version LFSVRS=development +TREE=trunk/BOOK #--- Name of the makefile MKFILE=$JHALFSDIR/Makefile diff --git a/LFS/master.sh b/LFS/master.sh index d6e0bb0..43c8d88 100755 --- a/LFS/master.sh +++ b/LFS/master.sh @@ -106,18 +106,12 @@ chapter5_Makefiles() { # Find the version of the command files, if it corresponds with the building of # a specific package - vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` - - # If $vrs isn't empty, we've got a package... - if [ "$vrs" != "" ] ; then - if [ "$name" = "tcl" ] ; then - FILE="$name$vrs-src.tar.*" - else - FILE="$name-$vrs.tar.*" - fi + pkg_tarball=$(get_package_tarball_name $name) + # If $pkg_tarball isn't empty, we've got a package... + if [ "$pkg_tarball" != "" ] ; then # Insert instructions for unpacking the package and to set the PKGDIR variable. - wrt_unpack "$FILE" + wrt_unpack "$pkg_tarball" # If the testsuites must be run, initialize the log file [[ "$TEST" = "3" ]] && wrt_test_log "${this_script}" # If using optimizations, write the instructions @@ -134,7 +128,7 @@ chapter5_Makefiles() { # Remove the build directory(ies) except if the package build fails # (so we can review config.cache, config.log, etc.) - if [ "$vrs" != "" ] ; then + if [ "$pkg_tarball" != "" ] ; then wrt_remove_build_dirs "$name" fi @@ -195,9 +189,9 @@ chapter6_Makefiles() { # Find the version of the command files, if it corresponds with the building of # a specific package. We need this here to can skip scripts not needed for # iterations rebuilds - vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` + pkg_tarball=$(get_package_tarball_name $name) - if [[ "$vrs" = "" ]] && [[ -n "$N" ]] ; then + if [[ "$pkg_tarball" = "" ]] && [[ -n "$N" ]] ; then case "${this_script}" in *stripping*) ;; *) continue ;; @@ -220,11 +214,10 @@ chapter6_Makefiles() { # as a dependency. Also call the echo_message function. wrt_target "${this_script}${N}" "$PREV" - # If $vrs isn't empty, we've got a package... + # If $pkg_tarball isn't empty, we've got a package... # Insert instructions for unpacking the package and changing directories - if [ "$vrs" != "" ] ; then - FILE="$name-$vrs.tar.*" - wrt_unpack2 "$FILE" + if [ "$pkg_tarball" != "" ] ; then + wrt_unpack2 "$pkg_tarball" # If the testsuites must be run, initialize the log file case $name in binutils | gcc | glibc ) @@ -246,7 +239,7 @@ chapter6_Makefiles() { esac # Remove the build directory(ies) except if the package build fails. - if [ "$vrs" != "" ] ; then + if [ "$pkg_tarball" != "" ] ; then wrt_remove_build_dirs "$name" fi @@ -304,14 +297,14 @@ chapter789_Makefiles() { # Find the bootscripts and kernel package names case "${this_script}" in *bootscripts) - vrs=`grep "^lfs-bootscripts-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` - FILE="lfs-bootscripts-$vrs.tar.*" - wrt_unpack2 "$FILE" + name="lfs-bootscripts" + pkg_tarball=$(get_package_tarball_name $name) + wrt_unpack2 "$pkg_tarball" ;; *kernel) - vrs=`grep "^linux-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'` - FILE="linux-$vrs.tar.*" - wrt_unpack2 "$FILE" + name="linux" + pkg_tarball=$(get_package_tarball_name $name) + wrt_unpack2 "$pkg_tarball" ;; esac @@ -502,7 +495,7 @@ restart_code: if ! mount -l | grep "\$(MOUNT_PT)/proc" >/dev/null ; then \\ mount -vt proc proc \$(MOUNT_PT)/proc;\\ fi;\\ - if ! mount -l | grep "$\(MOUNT_PT)/sys" >/dev/null ; then \\ + if ! mount -l | grep "\$(MOUNT_PT)/sys" >/dev/null ; then \\ mount -vt sysfs sysfs \$(MOUNT_PT)/sys;\\ fi;\\ fi; diff --git a/README b/README index 2c7a98e..c17878a 100644 --- a/README +++ b/README @@ -4,7 +4,7 @@ $Id$ This collection of scripts, known as jhalfs-X, strives to create accurate makefiles from the Linux From Scratch book series XML files. - This software is an evolution of the original "jhalfs" code. + This software is an evolution of the original "jhalfs-0.2" code. The usage of this script assumes you have read and are familiar with the book(s) and, therefore, the configuration variables found in config @@ -33,7 +33,16 @@ $Id$ The script master.sh cannot be invoked directly but only via the supplied symlinks. After editing the config file for the project you wish to build, run the script. - + + IMPORTANT: + If you use the switch -M (automatically run the generated makefile) you + must be 'root' or you can run the scripts using 'sudo' + i.e. sudo ./lfs -G -M + + If you want to run make manually you can only do so if you are 'root' or + via 'sudo' + i.e (from within the jhalfs directory) sudo make + The term refers to the 1 of 3 package symlinks, lfs,hlfs,clfs. Replace with your choice of packages; i.e.: ./lfs @@ -50,12 +59,52 @@ $Id$ ./ --help eg: ./lfs --help will give you a context sensitive list of command line switches. + >>>> an expanded example + + export SRC_ARCHIVE=/mnt/SourceFiles + + ./lfs -D /mnt/partition4 \ + -K ~/jhalfs_configs/linux-2.6.16.19-LFS.config \ + -F ~/jhalfs-configs/fstab-sda3 \ + -G -T 0 -M + + explanation::: + + export SRC_ARCHIVE=/mnt/SourceFiles + # This points to a local archive of existing packages. If the version in + the archive is incorrect jhalfs will access the net and download the + necessary version and store it here for later use. DO NOT set this to + $BUILDDIR/sources. If you do not set this variable to a valid directory + ALL package tarballs will be downloaded from the 'net. + + -D /mnt/partition4 + # where everything takes place. ..NOTE it must already exist and be mounted + + -K ~/jhalfs_configs/linux-2.6.16.19-LFS.config + # If you want to automatically build a the kernel you MUST supply a valid + kernel configuration file. The file you supply will be copied and renamed. + + -F ~/jhalfs-configs/fstab-sda3 + # If you have a fstab file you wish to use it will be copied and renamed + + -G # Retrieve the package files. You MUST enable this flag at least once if you + wish to do a build or whenever you update the book. + + -T 0 # don't run any testsuites + + -M # automatically run make against Makefile once jhalfs finishes its work. + + 5. LAYOUT:: /CLFS/config /master.sh /xxxx.xsl + /CLFS2/config + /master.sh + /xxxx.xsl + /HLFS/config /master.sh /xxxx.xsl @@ -83,18 +132,30 @@ $Id$ TODO ./clfs ---| + ./clfs2 ---| ./hlfs ---|+---> master.sh ./lfs ---| 6. FAQ:: + Q. "This 'help' file is very sparse" + A. Yes, it is. This tool, jhalfs, is for those who understand the LFS books + and wish to automate the build. 99% of any problems that arise can be + solved by reading the book(s). + Q. "It doesn't work!" A. Yes it does, try ./lfs --help + Q. "It still doesn't work" + A. jhalfs was designed to work against the developement versions of the LFS + series of books. Consequently changes in a book(s) sometimes breaks older + versions of jhalfs. Before you start pulling out your hair download the + latest version of jhalfs to see if that solves your problem. + Q. "How do I specify the build location?" - A. The original LFS document worked against the well know location /mnt/lfs. + A. The original LFS document worked against the well known location /mnt/lfs. This script automates the build of all of the LFS series of books and uses - a generic location $BUILDDIR with a default value a /mnt/build_dir. + a generic location $BUILDDIR with a default value of /mnt/build_dir. You may change this value to suit your needs. The layout below $BUILDDIR is as follows. @@ -109,23 +170,39 @@ $Id$ Q. "What is the function of the SRC_ARCHIVE variable?" A. When then symlinked master.sh runs it creates a local copy of the - necessary packages in BUILDDIR/sources by downloading the files. If - the variable SRC_ARCHIVE is defined the software will first look in + necessary packages in BUILDDIR/sources by downloading the files. If + the variable SRC_ARCHIVE is defined the software will first look in this location for the file and, if found, will copy it to BUILDDIR/sources. - If the files are not found in SRC_ARCHIVE _and_ you have write priv to + If the files are not found in SRC_ARCHIVE _and_ you have write priv to the directory any downloaded files will be mirrored there. Q. "How do I set the SRC_ARCHIVE location?" A. The best way to set the value of SRC_ARCHIVE is export SRC_ARCHIVE=/wherever/you/store/downloaded/packages OR - you can change the setting in .common/config. + you can change the setting in common/config. Q. "Why have 2 copies of the files?" - A. The package files must be visible during the chroot phase and this is a + A. The package files must be visible during the chroot phase and this is a simple and reliable method of doing so. This method also handles the CLFS build method where the final build may be done on a separate machine. + Q. "When I try to build 'xxx' with clfs the makefile fails at the mid-point" + A. There could be numerous reasons for the failure but the most likely reason + is you are doing a cross-build using the 'chroot' method and the target is + not compatible with the host. If you choose to build using the chroot + method a test is performed at the end of the temptools phase. If the test + succeeds the build continues inside a chroot jail. However if the test fails + it means the host and target are not compatible an you should use the + 'boot' method to create your target code. + As an extreme example: You can build a sparc target on a x86 platform but + only the temptools phase. You must run ./clfs using the 'boot' method and + not the 'chroot.' You must transfer the toolchain to a sparc platform, reboot + the sparc box and continue the build. + Of all the LFS series of books Cross-LFS requires the greatest + understanding of host/target hardware combination. Please read the book + carefully and don't skip the easy parts (there are none..) + Authors: George Boudreau Manuel Canales Esparcia diff --git a/common/common-functions b/common/common-functions index 3eea3dc..30484dd 100644 --- a/common/common-functions +++ b/common/common-functions @@ -52,8 +52,12 @@ ${BOLD} -V, --version${OFF} ${BOLD} -B, --book VER${OFF} use VER version of the book as the system to build. - Supported versions are: dev*, trunk, SVN - These are aliases for the Development version of {C,H}LFS + Supported VER values are: + dev*, trunk, SVN = aliases for the Development version of {C,H}LFS + branch-NAME = a branch of name NAME + VERSION = the version of a stable released book + To know what branches and stable books work with this version of jhalfs + please see http://wiki.linuxfromscratch.org/alfs/wiki/SupportedBooks ${BOLD} -D --directory DIR${OFF} use DIR directory for building ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF}; all files jhalfs-X produces @@ -83,14 +87,14 @@ ${BOLD} -T, --testsuites N ${OFF} ${BOLD} -W, --working-copy DIR${OFF} use the local working copy placed in DIR as the $(echo $PROGNAME | tr [a-z] [A-Z]) book -${BOLD} -C, --comparasion TYPE${OFF} +${BOLD} -C, --comparison TYPE${OFF} do iterative comparison analysis. This extends the total build time considerably because the entire final system will rebuild itself the number of times specified by ITERATIONS in common/config. Types allowed are: ICA = do ICA as designed by Greg Schafer farce = do the farce analysis designed by Ken Moffat - both = perfom both ICA and farce analysis + both = perform both ICA and farce analysis ${BOLD} -F, --fstab FILE${OFF} use FILE as the /etc/fstab file for the ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF} system. If not specified, @@ -104,7 +108,7 @@ ${BOLD} -M, --run-make${OFF} run make on the generated Makefile ${BOLD} -R --rebuild${OFF} - clean the build directory before perfoming any other task. The directory + clean the build directory before performing any other task. The directory is cleaned only if it was populated by a previous jhalfs-X run. -EOF- @@ -127,6 +131,18 @@ ${BOLD} --method BUILDMETHOD ${OFF} Select the build method, chroot or boot -EOF- +[[ ${PROGNAME} = "clfs2" ]] && +cat <<- -EOF- + +${BOLD} -A, --arch ARCH ${OFF} + Select the TARGET architecture, valid selections are: + 32bit builds + arm + 64bit builds + + 64bit multi-lib +-EOF- + [[ ${PROGNAME} = "hlfs" ]] && cat <<- -EOF- @@ -208,6 +224,41 @@ EOF } +#----------------------------------# +wrt_target_boot() { # Create target and initialize log file +#----------------------------------# + local i=$1 + local PREV=$2 + case $i in + iteration* ) local LOGFILE=$this_script.log ;; + * ) local LOGFILE=$this_script ;; + esac +( +cat << EOF + +$i: $PREV + @\$(call echo_message, Building) + @./progress_bar.sh \$@ & + @echo -e "\n\`date\`\n\nKB: \`du -skx --exclude=${SCRIPT_ROOT}\`\n" >logs/$LOGFILE +EOF +) >> $MKFILE.tmp +} + +#----------------------------# +get_package_tarball_name() { # +#----------------------------# + local script_name=$1 + + # The use of 'head' is necessary to limit the return value to the FIRST match.. + # hopefully this will not cause problems. + # + case $script_name in + tcl) echo $(grep "^tcl" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;; + *) echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 ) ;; + esac + +} + #----------------------------------# wrt_remove_existing_dirs() { # #----------------------------------# @@ -264,6 +315,26 @@ EOF } +#----------------------------------# +wrt_unpack_clfs() { # Unpack and set 'ROOT' var +#----------------------------------# + local FILE=$1 + local optSAVE_PREVIOUS=$2 + + if [ "${optSAVE_PREVIOUS}" != "1" ]; then + wrt_remove_existing_dirs "$FILE" + fi +( +cat << EOF + @\$(call unpack,$FILE) + @ROOT=\`head -n1 \$(MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\ + echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)/\$\$ROOT" > envars && \\ + chown -R clfs \$(MOUNT_PT)\$(SRC)/\$\$ROOT +EOF +) >> $MKFILE.tmp +} + + #----------------------------------# wrt_unpack2() { # #----------------------------------# @@ -366,6 +437,34 @@ EOF } +#----------------------------------# +wrt_run_as_clfs_su() { # Execute script inside time { }, footer to log file +#----------------------------------# + local this_script=$1 + local file=$2 +( +cat << EOF + @( time { su - clfs -c "source /home/clfs/.bashrc && $JHALFSDIR/${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 +} + + +#----------------------------------# +wrt_run_as_clfs_root() { # Some scripts must be run as root.. +#----------------------------------# + local this_script=$1 + local file=$2 +( +cat << EOF + @( time { export CLFS=\$(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 +} + + #----------------------------------# wrt_run_as_root2() { # #----------------------------------# @@ -535,7 +634,7 @@ clean_builddir() { # echo -ne "Cleaning $BUILDDIR...\n" rm -rf $BUILDDIR/{bin,boot,dev,etc,home,lib,media,mnt,opt,proc,root,sbin,srv,sys,tmp,tools,cross-tools,usr,var} echo -ne "Cleaning $JHALFSDIR...\n" - rm -rf $JHALFSDIR/{0*,1*,envars,sources-dir,*commands,logs,Makefile,*.xsl,makefile-functions,packages,patches} + rm -rf $JHALFSDIR/{0*,1*,envars,sources-dir,*commands,*logs,Makefile,*.xsl,makefile-functions,pkg_tarball_list,*.config,*.sh} echo -ne "Cleaning remainig extracted sources in $BUILDDIR/sources...\n" rm -rf `find $BUILDDIR/sources/* -maxdepth 0 -type d` echo -ne "done\n" @@ -558,6 +657,7 @@ get_book() { # lfs) svn_root="LFS" ;; hlfs) svn_root="HLFS" ;; clfs) svn_root="cross-lfs" ;; + clfs2) svn_root="cross-lfs" ;; *) echo "BOOK not defined in function " exit 1 ;; esac @@ -566,38 +666,34 @@ get_book() { # # sources. if [ -d ${PROGNAME}-$LFSVRS ] ; then cd ${PROGNAME}-$LFSVRS - if LC_ALL=C svn up | grep -q At && test -d $JHALFSDIR/${PROGNAME}-commands && \ - test -f $JHALFSDIR/packages ; then - echo -ne "done\n" + if LC_ALL=C svn up | grep -q At && \ + test -d $JHALFSDIR/${PROGNAME}-commands && \ + test -f $JHALFSDIR/pkg_tarball_list ; then # Set the canonical book version + echo -ne "done\n" cd $JHALFSDIR - VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'` + case $PROGNAME in + clfs | clfs2) + VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;; + *) + VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;; + esac get_sources else echo -ne "done\n" - # Set the canonical book version - cd $JHALFSDIR - VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'` extract_commands fi else - case $LFSVRS in - development) - svn co $SVN/${svn_root}/trunk/BOOK ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 ;; - esac + svn co $SVN/${svn_root}/${TREE} ${PROGNAME}-$LFSVRS >>$LOGDIR/$LOG 2>&1 echo -ne "done\n" - # Set the canonical book version - cd $JHALFSDIR - VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'` extract_commands fi + else echo -ne "Using $BOOK as book's sources ...\n" - # Set the canonical book version - cd $JHALFSDIR - VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'` extract_commands fi + echo -ne " Document version ${L_arrow}${BOLD}${VERSION}${R_arrow}\n" } #----------------------------# @@ -609,7 +705,12 @@ extract_commands() { # exit 1" cd $JHALFSDIR - VERSION=`grep "ENTITY version " $BOOK/general.ent | sed 's@@@'` + case $PROGNAME in + clfs | clfs2 ) + VERSION=$(xmllint --noent $BOOK/prologue/$ARCH/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;; + *) + VERSION=$(xmllint --noent $BOOK/prologue/bookinfo.xml 2>/dev/null | grep subtitle | sed -e 's/^.*ion //' -e 's/<\/.*//') ;; + esac # Start clean if [ -d ${PROGNAME}-commands ]; then @@ -633,6 +734,19 @@ extract_commands() { # --stringparam keymap $KEYMAP \ -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 ;; + + clfs2) + echo -n " ${L_arrow}${BOLD}$ARCH${R_arrow} target architecture" + xsltproc --nonet \ + --xinclude \ + --stringparam testsuite $TEST \ + --stringparam vim-lang $VIMLANG \ + --stringparam timezone $TIMEZONE \ + --stringparam page $PAGE \ + --stringparam lang $LANG \ + --stringparam keymap $KEYMAP \ + -o ./${PROGNAME}-commands/ $XSL $BOOK/$ARCH-index.xml >>$LOGDIR/$LOG 2>&1 + ;; hlfs) echo -n " ${L_arrow}${BOLD}$MODEL${R_arrow} HLFS libc implementation" xsltproc --nonet \ @@ -667,16 +781,38 @@ extract_commands() { # chmod -R +x $JHALFSDIR/${PROGNAME}-commands # Create the packages file. We need it for proper Makefile creation - rm -f packages - echo -n "Creating <${PROGNAME}> specific packages file" - grep "\-version " $BOOK/packages.ent | sed -e 's@@"@' > packages - echo " ...OK" + create_package_list # Done. Moving on... get_sources } +#----------------------------# +create_package_list() { # +#----------------------------# + + # Create the packages file. We need it for proper Makefile creation + rm -f pkg_tarball_list + echo -n "Creating <${PROGNAME}> list of tarball names for $BOOK $ARCH" + case ${PROGNAME} in + clfs | clfs2) + xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \ + $BOOK/materials/${ARCH}-chapter.xml >>$LOGDIR/$LOG 2>&1 + ;; + hlfs) + xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \ + $BOOK/chapter04/chapter04.xml >>$LOGDIR/$LOG 2>&1 + ;; + lfs) + xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \ + $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1 + ;; + esac + echo " ...OK" + +} + + #----------------------------# get_sources() { # Download file, write name to MISSING_FILES.DMP if an error #----------------------------# @@ -793,14 +929,13 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if done if [[ -s MISSING_FILES.DMP ]]; then - echo -e "\n\n${tab_}${RED} One or more files were not retrieved or have a bad MD5SUMS chechsum.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n" - # Do not allow the automatic exection of the Makefile. + echo -e "\n\n${tab_}${RED} One or more files were not retrieved or have bad MD5SUMS.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n" + # Do not allow the automatic execution of the Makefile. echo "${tab_}${BOLD}${RED}*** ${YELLOW}Automatic execution of the generated makefile has been inhibited. ${RED}***${OFF}${nl_}" RUNMAKE=0 fi } - #----------------------------# create_urls() { # #----------------------------# @@ -815,6 +950,14 @@ create_urls() { # $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1 echo " ...OK" ;; + clfs2) + echo -n "Creating CLFS2 <${ARCH}> specific URLs file" + xsltproc --nonet --xinclude \ + --stringparam server $SERVER \ + -o $BUILDDIR/sources/urls.lst urls.xsl \ + $BOOK/materials/$ARCH-chapter.xml >>$LOGDIR/$LOG 2>&1 + echo " ...OK" + ;; hlfs) echo -n "Creating HLFS <${MODEL}> specific URLs file" xsltproc --nonet --xinclude \ diff --git a/common/config b/common/config index 74bb55e..415345c 100644 --- a/common/config +++ b/common/config @@ -16,6 +16,8 @@ BUILDDIR=/mnt/build_dir REPORT=1 #=== Getting packages === +# Files will be retrieved from the local archive SRC_ARCHIVE +# (if defined) or the 'net and will be stored in $BUILDDIR/sources #--- Download the source packages 0(no)/1(yes) GETPKG=0 @@ -30,7 +32,7 @@ SRC_ARCHIVE=$SRC_ARCHIVE SERVER=ftp://ftp.lfs-matrix.net #=== Build options === -#--- Run the makefile at the end 0(no)/1(yes) +#--- Automatically run the makefile once it has been created 0(no)/1(yes) RUNMAKE=0 #--- Optimize the build [0-2] diff --git a/common/func_compare.sh b/common/func_compare.sh index 5f988c8..9559dfd 100644 --- a/common/func_compare.sh +++ b/common/func_compare.sh @@ -34,8 +34,6 @@ wrt_system_build() { # fi echo -e "\nsystem_build_$RUN: $PREV_IT $system_build" >> $MKFILE.tmp - PREV=system_build_$RUN - } #----------------------------------# @@ -112,6 +110,7 @@ wrt_logs() { # mv ${LOGS} $ITERATION && \\ popd 1> /dev/null @touch \$@ && \\ + sleep .25 && \\ echo " "\$(BOLD)Target \$(BLUE)\$@ \$(BOLD)OK && \\ echo --------------------------------------------------------------------------------\$(WHITE) EOF diff --git a/common/func_validate_configs.sh b/common/func_validate_configs.sh index e9c4a3f..33755b5 100644 --- a/common/func_validate_configs.sh +++ b/common/func_validate_configs.sh @@ -36,8 +36,8 @@ validate_target() { # ;; "x86_64-64") [[ "${TARGET}" = "x86_64-unknown-linux-gnu" ]] && return ;; - "mips64-64") [[ "${TARGET}" = "mipsel-unknown-linux-gnu" ]] && return - [[ "${TARGET}" = "mips-unknown-linux-gnu" ]] && return + "mips64-64") [[ "${TARGET}" = "mips64el-unknown-linux-gnu" ]] && return + [[ "${TARGET}" = "mips64-unknown-linux-gnu" ]] && return ;; "sparc64-64") [[ "${TARGET}" = "sparc64-unknown-linux-gnu" ]] && return ;; @@ -46,18 +46,20 @@ validate_target() { # "x86_64") [[ "${TARGET}" = "x86_64-unknown-linux-gnu" ]] && [[ "${TARGET32}" = "i686-pc-linux-gnu" ]] && return ;; - "mips64") [[ "${TARGET}" = "mipsel-unknown-linux-gnu" ]] && + "mips64") [[ "${TARGET}" = "mips64el-unknown-linux-gnu" ]] && [[ "${TARGET32}" = "mipsel-unknown-linux-gnu" ]] && return - [[ "${TARGET}" = "mips-unknown-linux-gnu" ]] && + [[ "${TARGET}" = "mips64-unknown-linux-gnu" ]] && [[ "${TARGET32}" = "mips-unknown-linux-gnu" ]] && return ;; "sparc64") [[ "${TARGET}" = "sparc64-unknown-linux-gnu" ]] && - [[ "${TARGET32}" = "sparcv9-unknown-linux-gnu" ]] && return + [[ "${TARGET32}" = "sparc-unknown-linux-gnu" ]] && return ;; "ppc64") [[ "${TARGET}" = "powerpc64-unknown-linux-gnu" ]] && [[ "${TARGET32}" = "powerpc-unknown-linux-gnu" ]] && return ;; + "arm") [[ "${TARGET}" = "arm-unknown-linux-gnu" ]] && return + ;; *) write_error_and_die ;; esac @@ -84,9 +86,10 @@ validate_config() { # Are the config values sane (within reason) inline_doc # First internal variables, then the ones that change the book's flavour, and lastly system configuration variables - local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL KEYMAP PAGE TIMEZONE LANG LC_ALL" - local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG" - local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG" + local -r hlfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE MODEL GRSECURITY_HOST TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL KEYMAP PAGE TIMEZONE LANG LC_ALL" + local -r clfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE METHOD ARCH TARGET TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB BOOT_CONFIG CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG" + local -r clfs2_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE ARCH TARGET OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL KEYMAP VIMLANG PAGE TIMEZONE LANG" + local -r lfs_PARAM_LIST="BOOK BUILDDIR SRC_ARCHIVE GETPKG RUNMAKE TEST OPTIMIZE REPORT COMPARE RUN_ICA RUN_FARCE ITERATIONS STRIP FSTAB CONFIG GETKERNEL VIMLANG PAGE TIMEZONE LANG" local -r ERROR_MSG_pt1='The variable \"${L_arrow}${config_param}${R_arrow}\" value ${L_arrow}${BOLD}${!config_param}${R_arrow} is invalid,' local -r ERROR_MSG_pt2=' check the config file ${BOLD}${GREEN}\<$(echo $PROGNAME | tr [a-z] [A-Z])/config\> or \${OFF}' @@ -208,7 +211,7 @@ inline_doc MODEL) validate_against_str "xglibcx xuclibcx" ;; PAGE) validate_against_str "xletterx xA4x" ;; METHOD) validate_against_str "xchrootx xbootx" ;; - ARCH) validate_against_str "xx86x xx86_64x xx86_64-64x xsparcx xsparc64x xsparc64-64x xmipsx xmips64x xmips64-64x xppcx xppc64x xalphax" ;; + ARCH) validate_against_str "xx86x xx86_64x xx86_64-64x xsparcx xsparc64x xsparc64-64x xmipsx xmips64x xmips64-64x xppcx xppc64x xalphax xarmx" ;; TARGET) validate_target ;; GRSECURITY_HOST) validate_against_str "x0x x1x" ;; @@ -216,7 +219,7 @@ inline_doc BOOK) if [[ "${WC}" = "1" ]] ; then validate_dir -z -d else - validate_against_str "x${PROGNAME}-developmentx" + validate_against_str "x${PROGNAME}-${LFSVRS}x" fi ;; # Validate directories, testable states: diff --git a/common/makefile-functions b/common/makefile-functions index ac183bb..6649e1b 100644 --- a/common/makefile-functions +++ b/common/makefile-functions @@ -54,22 +54,22 @@ define echo_finished @echo @echo -e \\t- Enter to the chroot using the command found @echo -e \\tin the section -Entering the Chroot Environment- - @echo -e \\texcept if building CLFS with METHOO=boot. + @echo -e \\texcept if building CLFS with METHOD=boot. @echo @echo -e \\t- Set a password for the root user. @echo - @echo -e \\t- Edit /etc/fstab, /etc/hosts, /etc/sysconfig/clock, + @echo -e \\t- Edit or create /etc/fstab, /etc/hosts, /etc/sysconfig/clock, @echo -e \\t/etc/sysconfig/console, /etc/sysconfig/network, @echo -e \\t/etc/sysconfig//network-devices/ifconfig.eth0/ipv4 and @echo -e \\tany other configuration file required to suit your needs. @echo @echo -e \\t- Exit from the chroot. @echo - @echo -e \\t- Set-up the boot loader, except if building CLFS with METHOO=boot. + @echo -e \\t- Set-up the boot loader, except if building CLFS with METHOD=boot. @echo -e \\tYou can set-up the host bootloader or the new boot-loader @echo -e \\tinstalled on the new system. @echo -e \\tIf the last, you must to mount the virtual filesystems, re-enter - @echo -e \\tto the chroot and be sure that /dev is populated with the + @echo -e \\tthe chroot and be sure that /dev is populated with the @echo -e \\trequired devices before configure the boot-loader. When ready, @echo -e \\texit from the chroot and umount the filesystems @echo @@ -92,7 +92,7 @@ define echo_boot_finished @echo @echo The build is not complete. Follow the next steps:$(WHITE) @echo - @echo -e \\t- Edit $(MOUNT_PT)/etc/fstab + @echo -e \\t- Edit or create $(MOUNT_PT)/etc/fstab @echo -e \\t and any other configuration file required to suit your needs. @echo $(BOLD) @echo $(BOLD)$(YELLOW) diff --git a/common/packages.xsl b/common/packages.xsl new file mode 100644 index 0000000..4ca007b --- /dev/null +++ b/common/packages.xsl @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/progress_bar.sh b/common/progress_bar.sh index aaa1af1..fb0dc00 100755 --- a/common/progress_bar.sh +++ b/common/progress_bar.sh @@ -21,14 +21,16 @@ declare -a GRAPHIC_STR="| / - \\ + " declare -i SEC=0 # Seconds accumulator declare -i PREV_SEC=0 +makePID=$(fuser -v . 2>&1 | grep make) +makePID=$(echo $makePID | cut -d" " -f2) write_or_exit() { # make has been killed or failed or run to completion, leave - if ! fuser -v . 2>&1 | grep make >/dev/null ; then - echo -n "${CURSOR_ON}" && exit - fi + [[ ! -e /proc/$makePID ]] && echo -n "${CURSOR_ON}" && exit + # Target build complete, leave. [[ -f ${TARGET} ]] && echo -n "${CURSOR_ON}" && exit + # It is safe to write to the screen echo -n "$1" } diff --git a/master.sh b/master.sh index ff9118c..0d3a230 100755 --- a/master.sh +++ b/master.sh @@ -105,22 +105,23 @@ while test $# -gt 0 ; do case $1 in dev* | SVN | trunk ) LFSVRS=development + TREE=trunk/BOOK ;; - *) if [[ "$PROGNAME" = "lfs" ]]; then - case $1 in - 6.1.1 ) - echo "For stable 6.1.1 book, please use jhalfs-0.2." - exit 0 - ;; - * ) - echo "$1 is an unsupported version at this time." - exit 0 - ;; - esac - else - echo "The requested version, ${L_arrow} ${BOLD}$1${OFF} ${R_arrow}, is undefined in the ${BOLD}$(echo $PROGNAME | tr [a-z] [A-Z])${OFF} series." - exit 0 - fi + branch-* ) + LFSVRS=$1 + TREE=branches/${1#branch-}/BOOK + ;; + * ) + case $PROGNAME in + lfs | hlfs ) + LFSVRS=$1 + TREE=tags/$1/BOOK + ;; + clfs ) + LFSVRS=$1 + TREE=tags/$1 + ;; + esac ;; esac ;; @@ -192,7 +193,7 @@ while test $# -gt 0 ; do WC=1 BOOK=$1 else - echo -e "\nLooks like $1 isn't a LFS working copy." + echo -e "\nLooks like $1 isn't an LFS working copy." exit 1 fi ;; @@ -210,14 +211,14 @@ while test $# -gt 0 ; do WC=1 BOOK=$1 else - echo -e "\nLooks like $1 isn't a HLFS working copy." + echo -e "\nLooks like $1 isn't an HLFS working copy." exit 1 fi ;; esac ;; - --comparasion | -C ) + --comparison | -C ) test $# = 1 && eval "$exit_missing_arg" shift case $1 in @@ -262,7 +263,7 @@ while test $# -gt 0 ; do fi ;; - --make | -M ) RUNMAKE=1 ;; + --run-make | -M ) RUNMAKE=1 ;; --rebuild | -R ) CLEAN=1 ;; @@ -271,6 +272,10 @@ while test $# -gt 0 ; do test $# = 1 && eval "$exit_missing_arg" shift case $1 in + arm ) + ARCH=arm + TARGET="arm-unknown-linux-gnu" + ;; x86 ) ARCH=x86 TARGET="i686-pc-linux-gnu" @@ -345,7 +350,7 @@ while test $# -gt 0 ; do TARGET32="powerpc-unknown-linux-gnu" ;; * ) - echo -e "\n$1 is an unknown or unsopported arch." + echo -e "\n$1 is an unknown or unsupported arch." exit 1 ;; esac @@ -410,7 +415,7 @@ BOOK=${BOOK:=$PROGNAME-$LFSVRS} #=================================================== -# Check for minumum gcc and kernel versions +# Check for minimum gcc and kernel versions #check_requirements 1 # 0/1 0-do not display values. echo check_version "2.6.2" "`uname -r`" "KERNEL" @@ -493,7 +498,7 @@ if [[ "$PWD" != "$JHALFSDIR" ]]; then fi # if [[ -n "$FILES" ]]; then - # pushd/popd necessary to deal with mulitiple files + # pushd/popd necessary to deal with multiple files pushd $PACKAGE_DIR 1> /dev/null cp $FILES $JHALFSDIR/ popd 1> /dev/null @@ -501,13 +506,15 @@ if [[ "$PWD" != "$JHALFSDIR" ]]; then # if [[ "$REPORT" = "1" ]]; then cp $COMMON_DIR/create-sbu_du-report.sh $JHALFSDIR/ - # After be sure that all look sane, dump the settings to a file + # After being sure that all looks sane, dump the settings to a file # This file will be used to create the REPORT header validate_config > $JHALFSDIR/jhalfs.config fi # [[ "$GETPKG" = "1" ]] && cp $COMMON_DIR/urls.xsl $JHALFSDIR/ # + cp $COMMON_DIR/packages.xsl $JHALFSDIR/ + # sed 's,FAKEDIR,'$BOOK',' $PACKAGE_DIR/$XSL > $JHALFSDIR/${XSL} export XSL=$JHALFSDIR/${XSL} fi