- Timestamp:
- 08/30/2006 02:01:04 AM (18 years ago)
- Branches:
- experimental
- Children:
- 08a4953
- Parents:
- 01b6d52
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
HLFS/master.sh
r01b6d52 r50fb011 8 8 ################################### 9 9 10 10 11 #----------------------------# 11 12 process_toolchain() { # embryo,cocoon and butterfly need special handling … … 13 14 local toolchain=$1 14 15 local this_script=$2 15 local 16 local tc_phase 16 17 local binutil_tarball 17 18 local gcc_core_tarball 19 local TC_MountPT 20 local remove_existing 18 21 19 echo "${tab_}${tab_}${GREEN}toolchain ${L_arrow}${toolchain}${R_arrow}" 22 tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'` 23 case $tc_phase in 24 embryo | \ 25 cocoon) # Vars for LUSER phase 26 remove_existing="remove_existing_dirs" 27 TC_MountPT="\$(MOUNT_PT)\$(SRC)" 28 ;; 29 butterfly) # Vars for CHROOT phase 30 remove_existing="remove_existing_dirs2" 31 TC_MountPT="\$(SRC)" 32 ;; 33 esac 20 34 21 35 # … … 25 39 ( 26 40 cat << EOF 27 @\$(call remove_existing_dirs,$binutil_tarball)28 @\$(call remove_existing_dirs,$gcc_core_tarball)41 @\$(call ${remove_existing},$binutil_tarball) 42 @\$(call ${remove_existing},$gcc_core_tarball) 29 43 EOF 30 44 ) >> $MKFILE.tmp … … 32 46 # 33 47 # Manually remove the toolchain directories.. 34 tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'`35 48 ( 36 49 cat << EOF 37 @rm -rf \$(MOUNT_PT)\$(SRC)/${tc_phase}-toolchain && \\38 rm -rf \$(MOUNT_PT)\$(SRC)/${tc_phase}-build50 @rm -rf ${TC_MountPT}/${tc_phase}-toolchain && \\ 51 rm -rf ${TC_MountPT}/${tc_phase}-build 39 52 EOF 40 53 ) >> $MKFILE.tmp 41 54 42 case ${toolchain} in 43 *butterfly*) 55 44 56 ( 45 57 cat << EOF 46 @echo "export PKGDIR= \$(SRC)" > envars58 @echo "export PKGDIR=${TC_MountPT}" > envars 47 59 EOF 48 60 ) >> $MKFILE.tmp 49 [[ "$TEST" != "0" ]] && wrt_test_log2 "${this_script}" 50 wrt_run_as_chroot1 "$toolchain" "$this_script" 61 62 case ${tc_phase} in 63 butterfly) 64 [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}" 65 CHROOT_wrt_RunAsRoot "$toolchain" "$this_script" 51 66 ;; 52 53 *) 54 ( 55 cat << EOF 56 @echo "export PKGDIR=\$(MOUNT_PT)\$(SRC)" > envars 57 EOF 58 ) >> $MKFILE.tmp 59 wrt_RunAsUser "$toolchain" "$this_script" 67 *) LUSER_wrt_RunAsUser "$toolchain" "$this_script" 60 68 ;; 61 69 esac … … 63 71 ( 64 72 cat << EOF 65 @\$(call remove_existing_dirs,$binutil_tarball)66 @\$(call remove_existing_dirs,$gcc_core_tarball)73 @\$(call ${remove_existing},$binutil_tarball) 74 @\$(call ${remove_existing},$gcc_core_tarball) 67 75 EOF 68 76 ) >> $MKFILE.tmp … … 70 78 # 71 79 # Manually remove the toolchain directories.. 72 tc_phase=`echo $toolchain | sed -e 's@[0-9]\{3\}-@@' -e 's@-toolchain@@'`73 80 ( 74 81 cat << EOF 75 @rm -r \$(MOUNT_PT)\$(SRC)/${tc_phase}-toolchain && \\76 rm -r \$(MOUNT_PT)\$(SRC)/${tc_phase}-build82 @rm -rf ${TC_MountPT}/${tc_phase}-toolchain && \\ 83 rm -rf ${TC_MountPT}/${tc_phase}-build 77 84 EOF 78 85 ) >> $MKFILE.tmp … … 85 92 #----------------------------# 86 93 87 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter3 ${R_arrow}"94 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter3 ( SETUP ) ${R_arrow}" 88 95 89 96 # Define a few model dependant variables … … 91 98 TARGET="pc-linux-gnu"; LOADER="ld-uClibc.so.0" 92 99 else 93 TARGET="pc-linux-gnu"; 100 TARGET="pc-linux-gnu"; LOADER="ld-linux.so.2" 94 101 fi 95 102 … … 152 159 EOF 153 160 ) >> $MKFILE.tmp 154 161 chapter3=" 020-creatingtoolsdir 021-addinguser 022-settingenvironment" 155 162 } 156 163 … … 161 168 local this_script 162 169 163 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5 ${R_arrow}"170 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter5 ( LUSER ) ${R_arrow}" 164 171 165 172 for file in chapter05/* ; do … … 206 213 if [[ ${name} = "embryo-toolchain" ]] || \ 207 214 [[ ${name} = "cocoon-toolchain" ]]; then 208 wrt_target "$this_script" "$PREV"215 LUSER_wrt_target "$this_script" "$PREV" 209 216 process_toolchain "${this_script}" "${file}" 210 217 wrt_touch … … 213 220 fi 214 221 # 215 wrt_target "$this_script" "$PREV"222 LUSER_wrt_target "$this_script" "$PREV" 216 223 # Find the version of the command files, if it corresponds with the building of 217 224 # a specific package … … 220 227 if [ "$pkg_tarball" != "" ] ; then 221 228 # Insert instructions for unpacking the package and to set the PKGDIR variable. 222 wrt_unpack "$pkg_tarball"229 LUSER_wrt_unpack "$pkg_tarball" 223 230 # If using optimizations, write the instructions 224 231 [[ "$OPTIMIZE" = "2" ]] && wrt_optimize "$name" && wrt_makeflags "$name" … … 226 233 # Insert date and disk usage at the top of the log file, the script run 227 234 # and date and disk usage again at the bottom of the log file. 228 wrt_RunAsUser "$this_script""${file}"235 LUSER_wrt_RunAsUser "${file}" 229 236 230 237 # Remove the build directory(ies) except if the package build fails 231 238 # (so we can review config.cache, config.log, etc.) 232 239 if [ "$pkg_tarball" != "" ] ; then 233 wrt_remove_build_dirs "$name"240 LUSER_RemoveBuildDirs "$name" 234 241 fi 235 242 … … 276 283 fi 277 284 278 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ${R_arrow}"285 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter6$N ( CHROOT ) ${R_arrow}" 279 286 280 287 for file in chapter06$N/* ; do … … 325 332 # as a dependency. Also call the echo_message function. 326 333 if [[ ${name} = "butterfly-toolchain" ]]; then 327 wrt_target "${this_script}${N}" "$PREV"334 CHROOT_wrt_target "${this_script}${N}" "$PREV" 328 335 process_toolchain "${this_script}" "${file}" 329 336 wrt_touch … … 332 339 fi 333 340 334 wrt_target "${this_script}${N}" "$PREV"341 CHROOT_wrt_target "${this_script}${N}" "$PREV" 335 342 336 343 # If $pkg_tarball isn't empty, we've got a package... 337 344 # Insert instructions for unpacking the package and changing directories 338 345 if [ "$pkg_tarball" != "" ] ; then 339 wrt_unpack2"$pkg_tarball"346 CHROOT_Unpack "$pkg_tarball" 340 347 # If the testsuites must be run, initialize the log file 341 348 # butterfly-toolchain tests are enabled in 'process_tookchain' function 342 349 case $name in 343 glibc ) [[ "$TEST" != "0" ]] && wrt_test_log2"${this_script}"350 glibc ) [[ "$TEST" != "0" ]] && CHROOT_wrt_test_log "${this_script}" 344 351 ;; 345 * ) [[ "$TEST" > "1" ]] && wrt_test_log2"${this_script}"352 * ) [[ "$TEST" > "1" ]] && CHROOT_wrt_test_log "${this_script}" 346 353 ;; 347 354 esac … … 356 363 ;; 357 364 *) # The rest of Chapter06 358 wrt_run_as_chroot1 "${this_script}""${file}"365 CHROOT_wrt_RunAsRoot "${file}" 359 366 ;; 360 367 esac … … 362 369 # Remove the build directory(ies) except if the package build fails. 363 370 if [ "$pkg_tarball" != "" ] ; then 364 wrt_remove_build_dirs "$name"371 CHROOT_wrt_RemoveBuildDirs "$name" 365 372 fi 366 373 # … … 386 393 local this_script 387 394 388 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7 ${R_arrow}"395 echo "${tab_}${GREEN}Processing... ${L_arrow}Chapter7 ( BOOT ) ${R_arrow}" 389 396 for file in chapter07/*; do 390 397 # Keep the script file name … … 399 406 *grub) continue ;; 400 407 *console) continue ;; # Use the file generated by lfs-bootscripts 401 402 *kernel)403 404 [[ -z $CONFIG ]] && continue405 406 408 *fstab) [[ ! -z ${FSTAB} ]] && cp ${FSTAB} $BUILDDIR/sources/fstab 409 ;; 410 *kernel) # If no .config file is supplied, the kernel build is skipped 411 [[ -z $CONFIG ]] && continue 412 cp $CONFIG $BUILDDIR/sources/kernel-config 413 ;; 407 414 esac 408 415 … … 417 424 # Drop in the name of the target on a new line, and the previous target 418 425 # as a dependency. Also call the echo_message function. 419 wrt_target "$this_script" "$PREV"426 CHROOT_wrt_target "$this_script" "$PREV" 420 427 421 428 case "${this_script}" in 422 429 *bootscripts*) 423 wrt_unpack2$(get_package_tarball_name "lfs-bootscripts")430 CHROOT_Unpack $(get_package_tarball_name "lfs-bootscripts") 424 431 blfs_bootscripts=$(get_package_tarball_name "blfs-bootscripts" | sed -e 's/.tar.*//' ) 425 432 echo -e "\t@echo \"\$(MOUNT_PT)\$(SRC)/$blfs_bootscripts\" >> sources-dir" >> $MKFILE.tmp … … 430 437 *fstab*) # Check if we have a real /etc/fstab file 431 438 if [[ -n "$FSTAB" ]] ; then 432 wrt_copy_fstab "$this_script"433 else # Initialize the log and run the script434 wrt_run_as_chroot2 "${this_script}" "${file}"439 CHROOT_wrt_CopyFstab 440 else 441 CHROOT_wrt_RunAsRoot "$file" 435 442 fi 436 443 ;; 437 444 *) # All other scripts 438 wrt_run_as_chroot2 "${this_script}""${file}"445 CHROOT_wrt_RunAsRoot "${file}" 439 446 ;; 440 447 esac … … 445 452 ( 446 453 cat << EOF 447 @ROOT=\`head -n1 \$( MOUNT_PT)\$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\448 rm -r \$( MOUNT_PT)\$(SRC)/\$\$ROOT454 @ROOT=\`head -n1 \$(SRC)/\$(PKG_LST) | sed 's@^./@@;s@/.*@@'\` && \\ 455 rm -r \$(SRC)/\$\$ROOT 449 456 @rm -r \`cat sources-dir\` && \\ 450 457 rm sources-dir … … 546 553 ( 547 554 cat << EOF 555 556 all: mk_SETUP mk_LUSER mk_CHROOT mk_BOOT 557 @\$(call echo_finished,$VERSION) 558 559 560 mk_SETUP: 561 @\$(call echo_SU_request) 562 @sudo make SETUP 563 @touch \$@ 564 565 mk_LUSER: mk_SETUP 566 @\$(call echo_SULUSER_request) 567 @( \$(SU_LUSER) "source .bashrc && cd \$(MOUNT_PT)/\$(SCRIPT_ROOT) && make LUSER" ) 568 @touch \$@ 569 570 mk_CHROOT: mk_LUSER 057-changingowner 059-kernfs 571 @mkdir \$(MOUNT_PT)/bin && \ 572 cd \$(MOUNT_PT)/bin && \ 573 ln -sf /tools/bin/bash bash; ln -sf bash sh 574 @sed -e 's|^ln -sv|ln -svf|' -i \$(CMDSDIR)/chapter06/064-createfiles 575 @\$(call echo_CHROOT_request) 576 @( sudo \$(CHROOT1) "env && cd \$(SCRIPT_ROOT) && make CHROOT") 577 @touch \$@ 578 579 mk_BOOT: mk_CHROOT 580 @\$(call echo_CHROOT_request) 581 @( sudo \$(CHROOT2) "cd \$(SCRIPT_ROOT) && make BOOT") 582 @touch \$@ 583 584 585 SETUP: $chapter3 586 587 LUSER: $chapter5 588 589 CHROOT: $chapter6 590 591 BOOT: $chapter7 592 593 594 595 548 596 all: chapter3 chapter5 chapter6 chapter7 do-housekeeping 549 597 @\$(call echo_finished,$VERSION)
Note:
See TracChangeset
for help on using the changeset viewer.