[0170229] | 1 | #!/bin/sh
|
---|
[1ce084e] | 2 | # $Id$
|
---|
[0170229] | 3 |
|
---|
| 4 | ###################################
|
---|
| 5 | ### FUNCTIONS ###
|
---|
| 6 | ###################################
|
---|
| 7 |
|
---|
| 8 |
|
---|
| 9 |
|
---|
| 10 | #----------------------------#
|
---|
[fcaf131] | 11 | host_prep_Makefiles() { # Initialization of the system
|
---|
[0170229] | 12 | #----------------------------#
|
---|
| 13 | local LFS_HOST
|
---|
| 14 |
|
---|
| 15 | echo "${tab_}${GREEN}Processing... ${L_arrow}host prep files${R_arrow}"
|
---|
| 16 |
|
---|
| 17 | # defined here, only for ease of reading
|
---|
| 18 | LFS_HOST="`echo ${MACHTYPE} | sed -e 's/unknown/cross/g' -e 's/-pc-/-cross-/g'`"
|
---|
| 19 | (
|
---|
| 20 | cat << EOF
|
---|
| 21 | 023-creatingtoolsdir:
|
---|
| 22 | @\$(call echo_message, Building)
|
---|
| 23 | @mkdir -v \$(MOUNT_PT)/tools && \\
|
---|
| 24 | rm -fv /tools && \\
|
---|
| 25 | ln -sv \$(MOUNT_PT)/tools /
|
---|
| 26 | @if [ ! -d \$(MOUNT_PT)/sources ]; then \\
|
---|
| 27 | mkdir \$(MOUNT_PT)/sources; \\
|
---|
| 28 | fi;
|
---|
| 29 | @chmod a+wt \$(MOUNT_PT)/sources && \\
|
---|
| 30 | touch \$@
|
---|
| 31 |
|
---|
| 32 | 024-creatingcrossdir: 023-creatingtoolsdir
|
---|
| 33 | @mkdir -v \$(MOUNT_PT)/cross-tools && \\
|
---|
| 34 | rm -fv /cross-tools && \\
|
---|
| 35 | ln -sv \$(MOUNT_PT)/cross-tools /
|
---|
| 36 | @touch \$@
|
---|
| 37 |
|
---|
| 38 | 025-addinguser: 024-creatingcrossdir
|
---|
| 39 | @\$(call echo_message, Building)
|
---|
| 40 | @if [ ! -d /home/lfs ]; then \\
|
---|
| 41 | groupadd lfs; \\
|
---|
| 42 | useradd -s /bin/bash -g lfs -m -k /dev/null lfs; \\
|
---|
| 43 | else \\
|
---|
| 44 | touch user-lfs-exist; \\
|
---|
| 45 | fi;
|
---|
| 46 | @chown lfs \$(MOUNT_PT) && \\
|
---|
| 47 | chown lfs \$(MOUNT_PT)/tools && \\
|
---|
| 48 | chown lfs \$(MOUNT_PT)/cross-tools && \\
|
---|
| 49 | chown lfs \$(MOUNT_PT)/sources && \\
|
---|
| 50 | touch \$@
|
---|
| 51 |
|
---|
| 52 | 026-settingenvironment: 025-addinguser
|
---|
| 53 | @\$(call echo_message, Building)
|
---|
| 54 | @if [ -f /home/lfs/.bashrc -a ! -f /home/lfs/.bashrc.XXX ]; then \\
|
---|
| 55 | mv -v /home/lfs/.bashrc /home/lfs/.bashrc.XXX; \\
|
---|
| 56 | fi;
|
---|
| 57 | @if [ -f /home/lfs/.bash_profile -a ! -f /home/lfs/.bash_profile.XXX ]; then \\
|
---|
| 58 | mv -v /home/lfs/.bash_profile /home/lfs/.bash_profile.XXX; \\
|
---|
| 59 | fi;
|
---|
| 60 | @echo "set +h" > /home/lfs/.bashrc && \\
|
---|
| 61 | echo "umask 022" >> /home/lfs/.bashrc && \\
|
---|
| 62 | echo "LFS=\$(MOUNT_PT)" >> /home/lfs/.bashrc && \\
|
---|
| 63 | echo "LC_ALL=POSIX" >> /home/lfs/.bashrc && \\
|
---|
| 64 | echo "PATH=/cross-tools/bin:/bin:/usr/bin" >> /home/lfs/.bashrc && \\
|
---|
| 65 | echo "export LFS LC_ALL PATH" >> /home/lfs/.bashrc && \\
|
---|
| 66 | echo "" >> /home/lfs/.bashrc && \\
|
---|
| 67 | echo "unset CFLAGS" >> /home/lfs/.bashrc && \\
|
---|
| 68 | echo "unset CXXFLAGS" >> /home/lfs/.bashrc && \\
|
---|
| 69 | echo "" >> /home/lfs/.bashrc && \\
|
---|
| 70 | echo "export LFS_HOST=\"${LFS_HOST}\"" >> /home/lfs/.bashrc && \\
|
---|
| 71 | echo "export LFS_TARGET=\"${TARGET}\"" >> /home/lfs/.bashrc && \\
|
---|
| 72 | echo "export LFS_TARGET32=\"${TARGET32}\"" >> /home/lfs/.bashrc && \\
|
---|
| 73 | echo "source $JHALFSDIR/envars" >> /home/lfs/.bashrc
|
---|
| 74 | @chown lfs:lfs /home/lfs/.bashrc && \\
|
---|
| 75 | touch envars && \\
|
---|
| 76 | touch \$@
|
---|
| 77 | EOF
|
---|
| 78 | ) >> $MKFILE.tmp
|
---|
| 79 |
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 |
|
---|
| 83 |
|
---|
| 84 | #-----------------------------#
|
---|
| 85 | cross_tools_Makefiles() { #
|
---|
| 86 | #-----------------------------#
|
---|
| 87 | echo "${tab_}${GREEN}Processing... ${L_arrow}cross tools${R_arrow}"
|
---|
| 88 |
|
---|
| 89 | for file in cross-tools/* ; do
|
---|
| 90 | # Keep the script file name
|
---|
| 91 | this_script=`basename $file`
|
---|
| 92 | #
|
---|
| 93 | # Skip this script...
|
---|
| 94 | case $this_script in
|
---|
| 95 | *cflags* | *variables* ) # work done in host_prep_Makefiles
|
---|
| 96 | continue; ;;
|
---|
| 97 | *) ;;
|
---|
| 98 | esac
|
---|
| 99 | #
|
---|
| 100 | # Set the dependency for the first target.
|
---|
| 101 | if [ -z $PREV ] ; then PREV=026-settingenvironment ; fi
|
---|
| 102 |
|
---|
| 103 | # First append each name of the script files to a list (this will become
|
---|
| 104 | # the names of the targets in the Makefile
|
---|
| 105 | cross_tools="$cross_tools $this_script"
|
---|
| 106 |
|
---|
| 107 | # Grab the name of the target (minus the -headers or -cross in the case of gcc
|
---|
| 108 | # and binutils in chapter 5)
|
---|
| 109 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
| 110 | -e 's@-static@@' \
|
---|
| 111 | -e 's@-final@@' \
|
---|
| 112 | -e 's@-headers@@' \
|
---|
| 113 | -e 's@-64@@' \
|
---|
| 114 | -e 's@-n32@@'`
|
---|
| 115 | # Adjust 'name' and patch a few scripts on the fly..
|
---|
| 116 | case $name in
|
---|
| 117 | linux-libc) name=linux-libc-headers ;;
|
---|
| 118 | esac
|
---|
| 119 | #
|
---|
| 120 | # Find the version of the command files, if it corresponds with the building of a specific package
|
---|
| 121 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 122 |
|
---|
| 123 |
|
---|
| 124 | #--------------------------------------------------------------------#
|
---|
| 125 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 126 | #--------------------------------------------------------------------#
|
---|
| 127 | #
|
---|
| 128 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 129 | # as a dependency. Also call the echo_message function.
|
---|
| 130 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 131 | #
|
---|
| 132 | # If $vrs isn't empty, we've got a package...
|
---|
| 133 | #
|
---|
[c3c4e1d] | 134 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" && echo -e '\ttrue' >> $MKFILE.tmp
|
---|
[0170229] | 135 | #
|
---|
[64cc345] | 136 | wrt_run_as_su "${this_script}" "${file}"
|
---|
[0170229] | 137 | #
|
---|
| 138 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 139 | #
|
---|
| 140 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 141 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 142 | #
|
---|
| 143 | #--------------------------------------------------------------------#
|
---|
| 144 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 145 | #--------------------------------------------------------------------#
|
---|
| 146 | #
|
---|
| 147 | # Keep the script file name for Makefile dependencies.
|
---|
| 148 | PREV=$this_script
|
---|
| 149 |
|
---|
| 150 | done # for file in ....
|
---|
| 151 | }
|
---|
| 152 |
|
---|
| 153 |
|
---|
| 154 | #-----------------------------#
|
---|
| 155 | temptools_Makefiles() { #
|
---|
| 156 | #-----------------------------#
|
---|
| 157 | echo "${tab_}${GREEN}Processing... ${L_arrow}temp system${R_arrow}"
|
---|
| 158 |
|
---|
| 159 | for file in temp-system/* ; do
|
---|
| 160 | # Keep the script file name
|
---|
| 161 | this_script=`basename $file`
|
---|
| 162 | #
|
---|
| 163 | # First append each name of the script files to a list (this will become
|
---|
| 164 | # the names of the targets in the Makefile
|
---|
| 165 | temptools="$temptools $this_script"
|
---|
| 166 |
|
---|
| 167 | #
|
---|
| 168 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 169 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
---|
| 170 | #
|
---|
| 171 | # Find the version of the command files, if it corresponds with the building of a specific package
|
---|
| 172 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 173 |
|
---|
| 174 |
|
---|
| 175 | #--------------------------------------------------------------------#
|
---|
| 176 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 177 | #--------------------------------------------------------------------#
|
---|
| 178 | #
|
---|
| 179 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 180 | # as a dependency. Also call the echo_message function.
|
---|
| 181 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 182 | #
|
---|
| 183 | # If $vrs isn't empty, we've got a package...
|
---|
| 184 | # Insert instructions for unpacking the package and to set the PKGDIR variable.
|
---|
| 185 | #
|
---|
[c3c4e1d] | 186 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" && echo -e '\ttrue' >> $MKFILE.tmp
|
---|
[0170229] | 187 | #
|
---|
[64cc345] | 188 | wrt_run_as_su "${this_script}" "${file}"
|
---|
[0170229] | 189 | #
|
---|
| 190 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 191 | #
|
---|
| 192 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 193 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 194 | #
|
---|
| 195 | #--------------------------------------------------------------------#
|
---|
| 196 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 197 | #--------------------------------------------------------------------#
|
---|
| 198 | #
|
---|
| 199 | # Keep the script file name for Makefile dependencies.
|
---|
| 200 | PREV=$this_script
|
---|
| 201 | done # for file in ....
|
---|
| 202 | }
|
---|
| 203 |
|
---|
| 204 |
|
---|
| 205 | #-----------------------------#
|
---|
| 206 | boot_Makefiles() { #
|
---|
| 207 | #-----------------------------#
|
---|
| 208 | echo "${tab_}${GREEN}Processing... ${L_arrow}boot${R_arrow}"
|
---|
| 209 |
|
---|
| 210 | for file in boot/* ; do
|
---|
| 211 | # Keep the script file name
|
---|
| 212 | this_script=`basename $file`
|
---|
| 213 |
|
---|
| 214 | # A little housekeeping on the scripts
|
---|
| 215 | case $this_script in
|
---|
[6d3564b] | 216 | *grub | *aboot | *colo | *silo | *arcload | *lilo ) continue ;;
|
---|
[0170229] | 217 | *whatnext*) continue ;;
|
---|
[0271c0c] | 218 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
[4845f38] | 219 | [[ -z $CONFIG ]] && continue
|
---|
[0271c0c] | 220 | # Copy the config file to /sources with a standardized name
|
---|
[6eef5ef] | 221 | cp $BOOT_CONFIG $BUILDDIR/sources/bootkernel-config
|
---|
[0170229] | 222 | ;;
|
---|
| 223 | esac
|
---|
| 224 | #
|
---|
| 225 | # First append each name of the script files to a list (this will become
|
---|
| 226 | # the names of the targets in the Makefile
|
---|
| 227 | boottools="$boottools $this_script"
|
---|
| 228 | #
|
---|
| 229 | # Grab the name of the target, strip id number and misc words.
|
---|
| 230 | case $this_script in
|
---|
[6d3564b] | 231 | *kernel) name=linux ;;
|
---|
[fcaf131] | 232 | *bootscripts) name="bootscripts-cross-lfs" ;;
|
---|
[9dc8222] | 233 | *udev-rules) name="udev-cross-lfs" ;;
|
---|
[6d3564b] | 234 | *grub-build) name=grub ;;
|
---|
| 235 | *-aboot-build) name=aboot ;;
|
---|
| 236 | *yaboot-build) name=yaboot ;;
|
---|
| 237 | *colo-build) name=colo ;;
|
---|
| 238 | *silo-build) name=silo ;;
|
---|
| 239 | *arcload-build) name=arcload ;;
|
---|
| 240 | *lilo-build) name=lilo ;;
|
---|
[0170229] | 241 | *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
|
---|
| 242 | esac
|
---|
| 243 |
|
---|
| 244 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 245 |
|
---|
| 246 | #--------------------------------------------------------------------#
|
---|
| 247 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 248 | #--------------------------------------------------------------------#
|
---|
| 249 | #
|
---|
| 250 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 251 | # as a dependency. Also call the echo_message function.
|
---|
| 252 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 253 | #
|
---|
| 254 | # If $vrs isn't empty, we've got a package...
|
---|
| 255 | # Insert instructions for unpacking the package and changing directories
|
---|
| 256 | #
|
---|
[9dc8222] | 257 | [[ "$vrs" != "" ]] && wrt_unpack "$name-$vrs.tar.*" && echo -e '\ttrue' >> $MKFILE.tmp
|
---|
[0170229] | 258 | #
|
---|
| 259 | # Select a script execution method
|
---|
| 260 | case $this_script in
|
---|
| 261 | *changingowner*) wrt_run_as_root "${this_script}" "${file}" ;;
|
---|
| 262 | *devices*) wrt_run_as_root "${this_script}" "${file}" ;;
|
---|
| 263 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
| 264 | wrt_copy_fstab "${this_script}"
|
---|
| 265 | else
|
---|
[64cc345] | 266 | wrt_run_as_su "${this_script}" "${file}"
|
---|
[0170229] | 267 | fi
|
---|
| 268 | ;;
|
---|
[64cc345] | 269 | *) wrt_run_as_su "${this_script}" "${file}" ;;
|
---|
[0170229] | 270 | esac
|
---|
| 271 | #
|
---|
| 272 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
| 273 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 274 | #
|
---|
| 275 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 276 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 277 | #
|
---|
| 278 | #--------------------------------------------------------------------#
|
---|
| 279 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 280 | #--------------------------------------------------------------------#
|
---|
| 281 | #
|
---|
| 282 | # Keep the script file name for Makefile dependencies.
|
---|
| 283 | PREV=$this_script
|
---|
| 284 |
|
---|
| 285 | done
|
---|
| 286 | }
|
---|
| 287 |
|
---|
| 288 |
|
---|
| 289 | #-----------------------------#
|
---|
| 290 | chroot_Makefiles() { #
|
---|
| 291 | #-----------------------------#
|
---|
| 292 | echo "${tab_}${GREEN}Processing... ${L_arrow}chroot${R_arrow}"
|
---|
| 293 |
|
---|
| 294 | for file in chroot/* ; do
|
---|
| 295 | # Keep the script file name
|
---|
| 296 | this_script=`basename $file`
|
---|
| 297 | #
|
---|
| 298 | # Skipping scripts is done now and not included in the build tree.
|
---|
[fd5cb46] | 299 | case $this_script in
|
---|
| 300 | *chroot*) continue ;;
|
---|
| 301 | esac
|
---|
[0170229] | 302 |
|
---|
| 303 | #
|
---|
| 304 | # First append each name of the script files to a list (this will become
|
---|
| 305 | # the names of the targets in the Makefile
|
---|
| 306 | chroottools="$chroottools $this_script"
|
---|
| 307 |
|
---|
| 308 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 309 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'`
|
---|
| 310 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 311 |
|
---|
| 312 | #--------------------------------------------------------------------#
|
---|
| 313 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 314 | #--------------------------------------------------------------------#
|
---|
| 315 | #
|
---|
| 316 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 317 | # as a dependency. Also call the echo_message function.
|
---|
| 318 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 319 | #
|
---|
| 320 | # If $vrs isn't empty, we've got a package...
|
---|
| 321 | # Insert instructions for unpacking the package and changing directories
|
---|
| 322 | #
|
---|
| 323 | if [ "$vrs" != "" ] ; then
|
---|
| 324 | case $this_script in
|
---|
[c3c4e1d] | 325 | *util-linux) wrt_unpack "$name-$vrs.tar.*"
|
---|
[7d018d1] | 326 | echo -e '\ttrue' >> $MKFILE.tmp
|
---|
| 327 | ;;
|
---|
| 328 | *) wrt_unpack2 "$name-$vrs.tar.*"
|
---|
| 329 | ;;
|
---|
[0170229] | 330 | esac
|
---|
| 331 | fi
|
---|
| 332 | #
|
---|
| 333 | # Select a script execution method
|
---|
| 334 | case $this_script in
|
---|
| 335 | *kernfs) wrt_run_as_root "${this_script}" "${file}" ;;
|
---|
[64cc345] | 336 | *util-linux) wrt_run_as_su "${this_script}" "${file}" ;;
|
---|
[0170229] | 337 | *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
|
---|
| 338 | esac
|
---|
| 339 | #
|
---|
| 340 | # Housekeeping...remove the build directory(ies), except if the package build fails.
|
---|
| 341 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 342 | #
|
---|
| 343 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 344 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 345 | #
|
---|
| 346 | #--------------------------------------------------------------------#
|
---|
| 347 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 348 | #--------------------------------------------------------------------#
|
---|
| 349 | #
|
---|
| 350 | # Keep the script file name for Makefile dependencies.
|
---|
| 351 | PREV=$this_script
|
---|
| 352 |
|
---|
| 353 | done # for file in...
|
---|
| 354 | }
|
---|
| 355 |
|
---|
| 356 |
|
---|
| 357 | #-----------------------------#
|
---|
| 358 | testsuite_tools_Makefiles() { #
|
---|
| 359 | #-----------------------------#
|
---|
[afd0232] | 360 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) testsuite tools${R_arrow}"
|
---|
[0170229] | 361 |
|
---|
| 362 | for file in testsuite-tools/* ; do
|
---|
| 363 | # Keep the script file name
|
---|
| 364 | this_script=`basename $file`
|
---|
| 365 |
|
---|
| 366 | # First append each name of the script files to a list (this will become
|
---|
| 367 | # the names of the targets in the Makefile
|
---|
| 368 | testsuitetools="$testsuitetools $this_script"
|
---|
| 369 |
|
---|
| 370 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 371 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
| 372 | -e 's@-64bit@@' \
|
---|
| 373 | -e 's@-64@@' \
|
---|
| 374 | -e 's@64@@' \
|
---|
| 375 | -e 's@n32@@'`
|
---|
| 376 |
|
---|
| 377 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 378 |
|
---|
| 379 | #--------------------------------------------------------------------#
|
---|
| 380 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 381 | #--------------------------------------------------------------------#
|
---|
| 382 | #
|
---|
| 383 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 384 | # as a dependency. Also call the echo_message function.
|
---|
| 385 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 386 | #
|
---|
| 387 | case $name in
|
---|
[c3c4e1d] | 388 | tcl) wrt_unpack2 "$name$vrs-src.tar.*" ;;
|
---|
| 389 | *) wrt_unpack2 "$name-$vrs.tar.*" ;;
|
---|
[0170229] | 390 | esac
|
---|
| 391 | #
|
---|
| 392 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
| 393 | #
|
---|
| 394 | wrt_remove_build_dirs "${name}"
|
---|
| 395 | #
|
---|
| 396 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 397 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 398 | #
|
---|
| 399 | #--------------------------------------------------------------------#
|
---|
| 400 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 401 | #--------------------------------------------------------------------#
|
---|
| 402 | #
|
---|
| 403 | # Keep the script file name for Makefile dependencies.
|
---|
| 404 | PREV=$this_script
|
---|
| 405 |
|
---|
| 406 | done
|
---|
| 407 | }
|
---|
| 408 |
|
---|
| 409 |
|
---|
| 410 | #--------------------------------#
|
---|
| 411 | bm_testsuite_tools_Makefiles() { #
|
---|
| 412 | #--------------------------------#
|
---|
[afd0232] | 413 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) testsuite tools${R_arrow}"
|
---|
[0170229] | 414 |
|
---|
| 415 | for file in testsuite-tools/* ; do
|
---|
| 416 | # Keep the script file name
|
---|
| 417 | this_script=`basename $file`
|
---|
| 418 |
|
---|
| 419 | # First append each name of the script files to a list (this will become
|
---|
| 420 | # the names of the targets in the Makefile
|
---|
[39d4d5c] | 421 | PREV=
|
---|
[0170229] | 422 | testsuitetools="$testsuitetools $this_script"
|
---|
| 423 |
|
---|
| 424 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 425 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
| 426 | -e 's@-64bit@@' \
|
---|
| 427 | -e 's@-64@@' \
|
---|
| 428 | -e 's@64@@' \
|
---|
| 429 | -e 's@n32@@'`
|
---|
| 430 |
|
---|
| 431 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 432 |
|
---|
| 433 | #--------------------------------------------------------------------#
|
---|
| 434 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 435 | #--------------------------------------------------------------------#
|
---|
| 436 | #
|
---|
| 437 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 438 | # as a dependency. Also call the echo_message function.
|
---|
| 439 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 440 | #
|
---|
| 441 | case $name in
|
---|
[c3c4e1d] | 442 | tcl) wrt_unpack3 "$name$vrs-src.tar.*" ;;
|
---|
| 443 | *) wrt_unpack3 "$name-$vrs.tar.*" ;;
|
---|
[0170229] | 444 | esac
|
---|
| 445 | #
|
---|
| 446 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
| 447 | #
|
---|
| 448 | wrt_remove_build_dirs2 "${name}"
|
---|
| 449 | #
|
---|
| 450 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 451 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 452 | #
|
---|
| 453 | #--------------------------------------------------------------------#
|
---|
| 454 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 455 | #--------------------------------------------------------------------#
|
---|
| 456 | #
|
---|
| 457 | # Keep the script file name for Makefile dependencies.
|
---|
| 458 | PREV=$this_script
|
---|
| 459 |
|
---|
| 460 | done
|
---|
| 461 | }
|
---|
| 462 |
|
---|
| 463 |
|
---|
| 464 | #-----------------------------#
|
---|
| 465 | final_system_Makefiles() { #
|
---|
| 466 | #-----------------------------#
|
---|
[afd0232] | 467 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) final system${R_arrow}"
|
---|
[0170229] | 468 |
|
---|
| 469 | for file in final-system/* ; do
|
---|
| 470 | # Keep the script file name
|
---|
| 471 | this_script=`basename $file`
|
---|
| 472 |
|
---|
[3fcd63e] | 473 | # Test if the stripping phase must be skipped
|
---|
[fd5cb46] | 474 | case $this_script in
|
---|
| 475 | *stripping*) [[ "$STRIP" = "0" ]] && continue
|
---|
| 476 | ;;
|
---|
| 477 | esac
|
---|
[3fcd63e] | 478 |
|
---|
[0170229] | 479 | # First append each name of the script files to a list (this will become
|
---|
| 480 | # the names of the targets in the Makefile
|
---|
| 481 | basicsystem="$basicsystem $this_script"
|
---|
| 482 |
|
---|
| 483 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 484 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
| 485 | -e 's@temp-@@' \
|
---|
| 486 | -e 's@-64bit@@' \
|
---|
| 487 | -e 's@-64@@' \
|
---|
| 488 | -e 's@64@@' \
|
---|
| 489 | -e 's@n32@@'`
|
---|
| 490 |
|
---|
| 491 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 492 |
|
---|
| 493 | #--------------------------------------------------------------------#
|
---|
| 494 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 495 | #--------------------------------------------------------------------#
|
---|
| 496 | #
|
---|
| 497 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 498 | # as a dependency. Also call the echo_message function.
|
---|
| 499 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 500 |
|
---|
| 501 | # If $vrs isn't empty, we've got a package...
|
---|
| 502 | if [ "$vrs" != "" ] ; then
|
---|
| 503 | case $name in
|
---|
| 504 | temp-perl) wrt_unpack2 "perl-$vrs.tar.*" ;;
|
---|
| 505 | *) wrt_unpack2 "$name-$vrs.tar.*" ;;
|
---|
| 506 | esac
|
---|
| 507 | fi
|
---|
| 508 | #
|
---|
| 509 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
| 510 | #
|
---|
| 511 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 512 | #
|
---|
| 513 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 514 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 515 | #
|
---|
| 516 | #--------------------------------------------------------------------#
|
---|
| 517 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 518 | #--------------------------------------------------------------------#
|
---|
| 519 | #
|
---|
| 520 | # Keep the script file name for Makefile dependencies.
|
---|
| 521 | PREV=$this_script
|
---|
| 522 |
|
---|
| 523 | done # for file in final-system/* ...
|
---|
| 524 | }
|
---|
| 525 |
|
---|
| 526 |
|
---|
| 527 | #-----------------------------#
|
---|
| 528 | bm_final_system_Makefiles() { #
|
---|
| 529 | #-----------------------------#
|
---|
[afd0232] | 530 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) final system${R_arrow}"
|
---|
[0170229] | 531 |
|
---|
[39d4d5c] | 532 | # The makesys phase was initiated in bm_testsuite_tools_makefile
|
---|
| 533 | [[ "$TEST" = 0 ]] && PREV=""
|
---|
| 534 |
|
---|
[0170229] | 535 | for file in final-system/* ; do
|
---|
| 536 | # Keep the script file name
|
---|
| 537 | this_script=`basename $file`
|
---|
| 538 |
|
---|
[3fcd63e] | 539 | # Test if the stripping phase must be skipped
|
---|
[64cc345] | 540 | case $this_script in
|
---|
[fd5cb46] | 541 | *stripping*) [[ "$STRIP" = "0" ]] && continue
|
---|
| 542 | ;;
|
---|
| 543 | esac
|
---|
[0170229] | 544 |
|
---|
| 545 | # First append each name of the script files to a list (this will become
|
---|
| 546 | # the names of the targets in the Makefile
|
---|
| 547 | basicsystem="$basicsystem $this_script"
|
---|
| 548 |
|
---|
| 549 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 550 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' \
|
---|
| 551 | -e 's@temp-@@' \
|
---|
| 552 | -e 's@-64bit@@' \
|
---|
| 553 | -e 's@-64@@' \
|
---|
| 554 | -e 's@64@@' \
|
---|
| 555 | -e 's@n32@@'`
|
---|
| 556 |
|
---|
| 557 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 558 |
|
---|
| 559 | #--------------------------------------------------------------------#
|
---|
| 560 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 561 | #--------------------------------------------------------------------#
|
---|
| 562 | #
|
---|
| 563 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 564 | # as a dependency. Also call the echo_message function.
|
---|
| 565 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 566 |
|
---|
| 567 | # If $vrs isn't empty, we've got a package...
|
---|
| 568 | if [ "$vrs" != "" ] ; then
|
---|
| 569 | case $name in
|
---|
[c3c4e1d] | 570 | temp-perl) wrt_unpack3 "perl-$vrs.tar.*" ;;
|
---|
| 571 | *) wrt_unpack3 "$name-$vrs.tar.*" ;;
|
---|
[0170229] | 572 | esac
|
---|
| 573 | fi
|
---|
| 574 | #
|
---|
| 575 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
| 576 | #
|
---|
| 577 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
| 578 | #
|
---|
| 579 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 580 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 581 | #
|
---|
| 582 | #--------------------------------------------------------------------#
|
---|
| 583 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 584 | #--------------------------------------------------------------------#
|
---|
| 585 | #
|
---|
| 586 | # Keep the script file name for Makefile dependencies.
|
---|
| 587 | PREV=$this_script
|
---|
| 588 |
|
---|
| 589 | done # for file in final-system/* ...
|
---|
| 590 | }
|
---|
| 591 |
|
---|
| 592 |
|
---|
| 593 | #-----------------------------#
|
---|
| 594 | bootscripts_Makefiles() { #
|
---|
| 595 | #-----------------------------#
|
---|
[afd0232] | 596 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) bootscripts${R_arrow}"
|
---|
[0170229] | 597 |
|
---|
| 598 | for file in bootscripts/* ; do
|
---|
| 599 | # Keep the script file name
|
---|
| 600 | this_script=`basename $file`
|
---|
| 601 |
|
---|
| 602 | case $this_script in
|
---|
[eba62c0] | 603 | *udev) continue ;; # This is not a script but a commentary, we want udev-rules
|
---|
[0170229] | 604 | *console*) continue ;; # Use the files that came with the bootscripts
|
---|
| 605 | *) ;;
|
---|
| 606 | esac
|
---|
| 607 |
|
---|
| 608 | # First append each name of the script files to a list (this will become
|
---|
| 609 | # the names of the targets in the Makefile
|
---|
| 610 | bootscripttools="$bootscripttools $this_script"
|
---|
| 611 |
|
---|
| 612 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 613 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
| 614 | -e 's@-64bit@@' \
|
---|
| 615 | -e 's@-64@@' \
|
---|
| 616 | -e 's@64@@' \
|
---|
| 617 | -e 's@n32@@'`
|
---|
[fd5cb46] | 618 | case $name in
|
---|
[eba62c0] | 619 | *bootscripts*) name=bootscripts-cross-lfs ;;
|
---|
| 620 | *udev-rules) name=udev-cross-lfs ;;
|
---|
[fd5cb46] | 621 | esac
|
---|
[0170229] | 622 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 623 |
|
---|
| 624 | #--------------------------------------------------------------------#
|
---|
| 625 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 626 | #--------------------------------------------------------------------#
|
---|
| 627 | #
|
---|
| 628 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 629 | # as a dependency. Also call the echo_message function.
|
---|
| 630 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 631 | #
|
---|
| 632 | # If $vrs isn't empty, we've got a package...
|
---|
| 633 | #
|
---|
| 634 | [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
|
---|
| 635 | #
|
---|
| 636 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
| 637 | #
|
---|
| 638 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 639 | #
|
---|
| 640 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 641 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 642 | #
|
---|
| 643 | #--------------------------------------------------------------------#
|
---|
| 644 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 645 | #--------------------------------------------------------------------#
|
---|
| 646 | #
|
---|
| 647 | # Keep the script file name for Makefile dependencies.
|
---|
| 648 | PREV=$this_script
|
---|
| 649 |
|
---|
| 650 | done # for file in bootscripts/* ...
|
---|
| 651 |
|
---|
| 652 | }
|
---|
| 653 |
|
---|
| 654 | #-----------------------------#
|
---|
| 655 | bm_bootscripts_Makefiles() { #
|
---|
| 656 | #-----------------------------#
|
---|
[afd0232] | 657 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) bootscripts${R_arrow}"
|
---|
[0170229] | 658 |
|
---|
| 659 | for file in bootscripts/* ; do
|
---|
| 660 | # Keep the script file name
|
---|
| 661 | this_script=`basename $file`
|
---|
| 662 |
|
---|
| 663 | case $this_script in
|
---|
| 664 | *udev*) continue ;; # This is not a script but a commentary
|
---|
| 665 | *console*) continue ;; # Use the files that came with the bootscripts
|
---|
| 666 | *) ;;
|
---|
| 667 | esac
|
---|
| 668 |
|
---|
| 669 | # First append each name of the script files to a list (this will become
|
---|
| 670 | # the names of the targets in the Makefile
|
---|
| 671 | bootscripttools="$bootscripttools $this_script"
|
---|
| 672 |
|
---|
| 673 | # Grab the name of the target, strip id number, XXX-script
|
---|
| 674 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@'\
|
---|
| 675 | -e 's@-64bit@@' \
|
---|
| 676 | -e 's@-64@@' \
|
---|
| 677 | -e 's@64@@' \
|
---|
| 678 | -e 's@n32@@'`
|
---|
[fd5cb46] | 679 | case $name in
|
---|
| 680 | *bootscripts*) name=bootscripts-cross-lfs
|
---|
| 681 | ;;
|
---|
| 682 | esac
|
---|
[0170229] | 683 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 684 |
|
---|
| 685 | #--------------------------------------------------------------------#
|
---|
| 686 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 687 | #--------------------------------------------------------------------#
|
---|
| 688 | #
|
---|
| 689 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 690 | # as a dependency. Also call the echo_message function.
|
---|
| 691 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 692 | #
|
---|
| 693 | # If $vrs isn't empty, we've got a package...
|
---|
| 694 | #
|
---|
[c3c4e1d] | 695 | [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
|
---|
[0170229] | 696 | #
|
---|
| 697 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
| 698 | #
|
---|
| 699 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
| 700 | #
|
---|
| 701 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 702 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 703 | #
|
---|
| 704 | #--------------------------------------------------------------------#
|
---|
| 705 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 706 | #--------------------------------------------------------------------#
|
---|
| 707 | #
|
---|
| 708 | # Keep the script file name for Makefile dependencies.
|
---|
| 709 | PREV=$this_script
|
---|
| 710 |
|
---|
| 711 | done # for file in bootscripts/* ...
|
---|
| 712 |
|
---|
| 713 | }
|
---|
| 714 |
|
---|
| 715 |
|
---|
| 716 |
|
---|
| 717 | #-----------------------------#
|
---|
| 718 | bootable_Makefiles() { #
|
---|
| 719 | #-----------------------------#
|
---|
[afd0232] | 720 | echo "${tab_}${GREEN}Processing... ${L_arrow}(chroot) make bootable${R_arrow}"
|
---|
[0170229] | 721 |
|
---|
[7f38b6d] | 722 | for file in {bootable,the-end}/* ; do
|
---|
[0170229] | 723 | # Keep the script file name
|
---|
| 724 | this_script=`basename $file`
|
---|
| 725 |
|
---|
| 726 | # A little housekeeping on the scripts
|
---|
| 727 | case $this_script in
|
---|
[7f38b6d] | 728 | *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
|
---|
[87b93b4] | 729 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
[4845f38] | 730 | [[ -z $CONFIG ]] && continue
|
---|
[0271c0c] | 731 | # Copy the config file to /sources with a standardized name
|
---|
[1917cad] | 732 | cp $CONFIG $BUILDDIR/sources/kernel-config
|
---|
[87b93b4] | 733 | ;;
|
---|
[0170229] | 734 | esac
|
---|
| 735 | #
|
---|
| 736 | # First append each name of the script files to a list (this will become
|
---|
| 737 | # the names of the targets in the Makefile
|
---|
| 738 | bootabletools="$bootabletools $this_script"
|
---|
| 739 | #
|
---|
| 740 | # Grab the name of the target, strip id number and misc words.
|
---|
| 741 | name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' `
|
---|
[fd5cb46] | 742 | case $this_script in
|
---|
| 743 | *kernel*) name=linux
|
---|
| 744 | ;;
|
---|
| 745 | esac
|
---|
[0170229] | 746 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 747 |
|
---|
| 748 | #--------------------------------------------------------------------#
|
---|
| 749 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 750 | #--------------------------------------------------------------------#
|
---|
| 751 | #
|
---|
| 752 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 753 | # as a dependency. Also call the echo_message function.
|
---|
| 754 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 755 | #
|
---|
| 756 | # If $vrs isn't empty, we've got a package...
|
---|
| 757 | # Insert instructions for unpacking the package and changing directories
|
---|
| 758 | #
|
---|
[b88d581] | 759 | [[ "$vrs" != "" ]] && wrt_unpack2 "$name-$vrs.tar.*"
|
---|
[0170229] | 760 | #
|
---|
| 761 | # Select a script execution method
|
---|
| 762 | case $this_script in
|
---|
| 763 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
| 764 | wrt_copy_fstab "${this_script}"
|
---|
| 765 | else
|
---|
[fcaf131] | 766 | wrt_run_as_chroot1 "${this_script}" "${file}"
|
---|
[0170229] | 767 | fi
|
---|
| 768 | ;;
|
---|
[fcaf131] | 769 | *) wrt_run_as_chroot1 "${this_script}" "${file}" ;;
|
---|
[0170229] | 770 | esac
|
---|
| 771 | #
|
---|
| 772 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
| 773 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs "${name}"
|
---|
| 774 | #
|
---|
| 775 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 776 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 777 | #
|
---|
| 778 | #--------------------------------------------------------------------#
|
---|
| 779 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 780 | #--------------------------------------------------------------------#
|
---|
| 781 | #
|
---|
| 782 | # Keep the script file name for Makefile dependencies.
|
---|
| 783 | PREV=$this_script
|
---|
| 784 |
|
---|
| 785 | done
|
---|
| 786 |
|
---|
[9e4b9a1] | 787 | # Add SBU-disk_usage report target if required
|
---|
| 788 | if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi
|
---|
| 789 |
|
---|
[0170229] | 790 | }
|
---|
| 791 |
|
---|
| 792 |
|
---|
| 793 |
|
---|
| 794 | #-----------------------------#
|
---|
| 795 | bm_bootable_Makefiles() { #
|
---|
| 796 | #-----------------------------#
|
---|
[afd0232] | 797 | echo "${tab_}${GREEN}Processing... ${L_arrow}(boot) make bootable${R_arrow}"
|
---|
[0170229] | 798 |
|
---|
[7f38b6d] | 799 | for file in {bootable,the-end}/* ; do
|
---|
[0170229] | 800 | # Keep the script file name
|
---|
| 801 | this_script=`basename $file`
|
---|
| 802 |
|
---|
| 803 | # A little housekeeping on the scripts
|
---|
| 804 | case $this_script in
|
---|
[7f38b6d] | 805 | *grub | *aboot | *colo | *silo | *arcload | *lilo | *reboot* ) continue ;;
|
---|
[b83baf6] | 806 | *kernel) # if there is no kernel config file do not build the kernel
|
---|
[4845f38] | 807 | [[ -z $CONFIG ]] && continue
|
---|
[0271c0c] | 808 | # Copy the named config file to /sources with a standardized name
|
---|
[62033d2] | 809 | cp $CONFIG $BUILDDIR/sources/kernel-config
|
---|
[0170229] | 810 | ;;
|
---|
| 811 | esac
|
---|
| 812 | #
|
---|
| 813 | # First append each name of the script files to a list (this will become
|
---|
| 814 | # the names of the targets in the Makefile
|
---|
| 815 | bootabletools="$bootabletools $this_script"
|
---|
| 816 | #
|
---|
| 817 | # Grab the name of the target, strip id number and misc words.
|
---|
| 818 | case $this_script in
|
---|
| 819 | *kernel) name=linux
|
---|
| 820 | ;;
|
---|
| 821 | *) name=`echo $this_script | sed -e 's@[0-9]\{3\}-@@' -e 's@-build@@' ` ;;
|
---|
| 822 | esac
|
---|
| 823 |
|
---|
| 824 | vrs=`grep "^$name-version" $JHALFSDIR/packages | sed -e 's/.* //' -e 's/"//g'`
|
---|
| 825 |
|
---|
| 826 | #--------------------------------------------------------------------#
|
---|
| 827 | # >>>>>>>> START BUILDING A Makefile ENTRY <<<<<<<< #
|
---|
| 828 | #--------------------------------------------------------------------#
|
---|
| 829 | #
|
---|
| 830 | # Drop in the name of the target on a new line, and the previous target
|
---|
| 831 | # as a dependency. Also call the echo_message function.
|
---|
| 832 | echo -e "\n$this_script: $PREV\n\t@\$(call echo_message, Building)" >> $MKFILE.tmp
|
---|
| 833 | #
|
---|
| 834 | # If $vrs isn't empty, we've got a package...
|
---|
| 835 | # Insert instructions for unpacking the package and changing directories
|
---|
| 836 | #
|
---|
[c3c4e1d] | 837 | [[ "$vrs" != "" ]] && wrt_unpack3 "$name-$vrs.tar.*"
|
---|
[0170229] | 838 | #
|
---|
| 839 | # Select a script execution method
|
---|
| 840 | case $this_script in
|
---|
| 841 | *fstab*) if [[ -n "$FSTAB" ]]; then
|
---|
[a9490ab] | 842 | # Minimal boot mode has no access to original file, store in /sources
|
---|
| 843 | cp $FSTAB $BUILDDIR/sources/fstab
|
---|
[0170229] | 844 | wrt_copy_fstab2 "${this_script}"
|
---|
| 845 | else
|
---|
| 846 | wrt_run_as_root2 "${this_script}" "${file}"
|
---|
| 847 | fi
|
---|
| 848 | ;;
|
---|
| 849 | *) wrt_run_as_root2 "${this_script}" "${file}" ;;
|
---|
| 850 | esac
|
---|
| 851 | #
|
---|
| 852 | # Housekeeping...remove any build directory(ies) except if the package build fails.
|
---|
| 853 | [[ "$vrs" != "" ]] && wrt_remove_build_dirs2 "${name}"
|
---|
| 854 | #
|
---|
| 855 | # Include a touch of the target name so make can check if it's already been made.
|
---|
| 856 | echo -e '\t@touch $@' >> $MKFILE.tmp
|
---|
| 857 | #
|
---|
| 858 | #--------------------------------------------------------------------#
|
---|
| 859 | # >>>>>>>> END OF Makefile ENTRY <<<<<<<< #
|
---|
| 860 | #--------------------------------------------------------------------#
|
---|
| 861 | #
|
---|
| 862 | # Keep the script file name for Makefile dependencies.
|
---|
| 863 | PREV=$this_script
|
---|
| 864 |
|
---|
| 865 | done
|
---|
| 866 |
|
---|
[9e4b9a1] | 867 | # Add SBU-disk_usage report target if required
|
---|
| 868 | if [[ "$REPORT" = "1" ]] ; then wrt_report ; fi
|
---|
| 869 |
|
---|
[0170229] | 870 | }
|
---|
| 871 |
|
---|
| 872 |
|
---|
| 873 | #-----------------------------#
|
---|
| 874 | build_Makefile() { # Construct a Makefile from the book scripts
|
---|
| 875 | #-----------------------------#
|
---|
| 876 | echo "Creating Makefile... ${BOLD}START${OFF}"
|
---|
| 877 |
|
---|
| 878 | cd $JHALFSDIR/${PROGNAME}-commands
|
---|
| 879 | # Start with a clean Makefile.tmp file
|
---|
| 880 | >$MKFILE.tmp
|
---|
| 881 |
|
---|
| 882 | host_prep_Makefiles
|
---|
[d43a271] | 883 | cross_tools_Makefiles # $cross_tools
|
---|
| 884 | temptools_Makefiles # $temptools
|
---|
[afd0232] | 885 | if [[ $METHOD = "chroot" ]]; then
|
---|
[d43a271] | 886 | chroot_Makefiles # $chroottools
|
---|
[fa06e8e] | 887 | if [[ ! $TEST = "0" ]]; then
|
---|
[d43a271] | 888 | testsuite_tools_Makefiles # $testsuitetools
|
---|
[0170229] | 889 | fi
|
---|
[d43a271] | 890 | final_system_Makefiles # $basicsystem
|
---|
| 891 | bootscripts_Makefiles # $bootscripttools
|
---|
| 892 | bootable_Makefiles # $bootabletools
|
---|
[0170229] | 893 | else
|
---|
[d43a271] | 894 | boot_Makefiles # $boottools
|
---|
[fa06e8e] | 895 | if [[ ! $TEST = "0" ]]; then
|
---|
[d43a271] | 896 | bm_testsuite_tools_Makefiles # $testsuitetools
|
---|
[0170229] | 897 | fi
|
---|
[d43a271] | 898 | bm_final_system_Makefiles # $basicsystem
|
---|
| 899 | bm_bootscripts_Makefiles # $bootscipttools
|
---|
| 900 | bm_bootable_Makefiles # $bootabletoosl
|
---|
[0170229] | 901 | fi
|
---|
[39d4d5c] | 902 | # the_end_Makefiles
|
---|
[0170229] | 903 |
|
---|
| 904 |
|
---|
| 905 | # Add a header, some variables and include the function file
|
---|
| 906 | # to the top of the real Makefile.
|
---|
| 907 | (
|
---|
| 908 | cat << EOF
|
---|
| 909 | $HEADER
|
---|
| 910 |
|
---|
| 911 | SRC= /sources
|
---|
| 912 | MOUNT_PT= $BUILDDIR
|
---|
| 913 |
|
---|
| 914 | include makefile-functions
|
---|
| 915 |
|
---|
| 916 | EOF
|
---|
| 917 | ) > $MKFILE
|
---|
| 918 |
|
---|
| 919 | # Add chroot commands
|
---|
[e676ffa] | 920 | if [ "$METHOD" = "chroot" ] ; then
|
---|
| 921 | chroot=`cat chroot/*chroot* | sed -e '/#!\/tools\/bin\/bash/d' \
|
---|
[0170229] | 922 | -e '/^export/d' \
|
---|
| 923 | -e '/^logout/d' \
|
---|
| 924 | -e 's@ \\\@ @g' | tr -d '\n' | sed -e 's/ */ /g' \
|
---|
| 925 | -e 's|\\$|&&|g' \
|
---|
| 926 | -e 's|exit||g' \
|
---|
| 927 | -e 's|$| -c|' \
|
---|
| 928 | -e 's|"$$LFS"|$(MOUNT_PT)|'\
|
---|
| 929 | -e 's|set -e||'`
|
---|
[e676ffa] | 930 | echo -e "CHROOT1= $chroot\n" >> $MKFILE
|
---|
| 931 | fi
|
---|
[0170229] | 932 |
|
---|
| 933 | # Drop in the main target 'all:' and the chapter targets with each sub-target
|
---|
| 934 | # as a dependency.
|
---|
[39d4d5c] | 935 | if [[ "${METHOD}" = "chroot" ]]; then
|
---|
[0170229] | 936 | (
|
---|
| 937 | cat << EOF
|
---|
| 938 | all: chapter2 chapter3 chapter4 chapter5 chapter6 chapter7 chapter8
|
---|
| 939 | @\$(call echo_finished,$VERSION)
|
---|
| 940 |
|
---|
| 941 | chapter2: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment
|
---|
| 942 |
|
---|
| 943 | chapter3: chapter2 $cross_tools
|
---|
| 944 |
|
---|
| 945 | chapter4: chapter3 $temptools
|
---|
| 946 |
|
---|
[d43a271] | 947 | chapter5: chapter4 $chroottools $testsuitetools
|
---|
[0170229] | 948 |
|
---|
| 949 | chapter6: chapter5 $basicsystem
|
---|
| 950 |
|
---|
| 951 | chapter7: chapter6 $bootscripttools
|
---|
| 952 |
|
---|
| 953 | chapter8: chapter7 $bootabletools
|
---|
| 954 |
|
---|
| 955 | clean-all: clean
|
---|
[db187c74] | 956 | rm -rf ./{clfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
|
---|
[0170229] | 957 |
|
---|
| 958 | clean: clean-chapter4 clean-chapter3 clean-chapter2
|
---|
| 959 |
|
---|
| 960 | clean-chapter2:
|
---|
| 961 | -if [ ! -f user-lfs-exist ]; then \\
|
---|
| 962 | userdel lfs; \\
|
---|
| 963 | rm -rf /home/lfs; \\
|
---|
| 964 | fi;
|
---|
| 965 | rm -rf \$(MOUNT_PT)/tools
|
---|
| 966 | rm -f /tools
|
---|
| 967 | rm -rf \$(MOUNT_PT)/cross-tools
|
---|
| 968 | rm -f /cross-tools
|
---|
| 969 | rm -f envars user-lfs-exist
|
---|
| 970 | rm -f 02* logs/02*.log
|
---|
| 971 |
|
---|
| 972 | clean-chapter3:
|
---|
| 973 | rm -rf \$(MOUNT_PT)/tools/*
|
---|
| 974 | rm -f $cross_tools restore-lfs-env sources-dir
|
---|
| 975 | cd logs && rm -f $cross_tools && cd ..
|
---|
| 976 |
|
---|
| 977 | clean-chapter4:
|
---|
| 978 | -umount \$(MOUNT_PT)/sys
|
---|
| 979 | -umount \$(MOUNT_PT)/proc
|
---|
| 980 | -umount \$(MOUNT_PT)/dev/shm
|
---|
| 981 | -umount \$(MOUNT_PT)/dev/pts
|
---|
| 982 | -umount \$(MOUNT_PT)/dev
|
---|
| 983 | rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,lib64,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
|
---|
| 984 | rm -f $temptools
|
---|
| 985 | cd logs && rm -f $temptools && cd ..
|
---|
| 986 |
|
---|
| 987 |
|
---|
| 988 | restore-lfs-env:
|
---|
| 989 | @\$(call echo_message, Building)
|
---|
| 990 | @if [ -f /home/lfs/.bashrc.XXX ]; then \\
|
---|
| 991 | mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
|
---|
| 992 | fi;
|
---|
| 993 | @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
|
---|
| 994 | mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
|
---|
| 995 | fi;
|
---|
| 996 | @chown lfs:lfs /home/lfs/.bash* && \\
|
---|
| 997 | touch \$@
|
---|
| 998 |
|
---|
| 999 | EOF
|
---|
| 1000 | ) >> $MKFILE
|
---|
[39d4d5c] | 1001 | fi
|
---|
| 1002 |
|
---|
| 1003 |
|
---|
| 1004 | if [[ "${METHOD}" = "boot" ]]; then
|
---|
| 1005 | (
|
---|
| 1006 | cat << EOF
|
---|
[64cc345] | 1007 |
|
---|
[39d4d5c] | 1008 | all: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment \
|
---|
| 1009 | $cross_tools \
|
---|
| 1010 | $temptools \
|
---|
| 1011 | $chroottools \
|
---|
| 1012 | $boottools
|
---|
| 1013 | @\$(call echo_boot_finished,$VERSION)
|
---|
| 1014 |
|
---|
| 1015 | makeboot: 023-creatingtoolsdir 024-creatingcrossdir 025-addinguser 026-settingenvironment \
|
---|
| 1016 | $cross_tools\
|
---|
| 1017 | $temptools \
|
---|
| 1018 | $chroottools \
|
---|
| 1019 | $boottools
|
---|
| 1020 | @\$(call echo_boot_finished,$VERSION)
|
---|
| 1021 |
|
---|
[d43a271] | 1022 | makesys: $testsuitetools $basicsystem $bootscripttools $bootabletools
|
---|
[39d4d5c] | 1023 | @\$(call echo_finished,$VERSION)
|
---|
| 1024 |
|
---|
| 1025 |
|
---|
| 1026 | clean-all: clean
|
---|
[db187c74] | 1027 | rm -rf ./{clfs-commands,logs,Makefile,*.xsl,makefile-functions,packages,patches}
|
---|
[39d4d5c] | 1028 |
|
---|
| 1029 | clean: clean-makesys clean-makeboot clean-jhalfs
|
---|
| 1030 |
|
---|
| 1031 | clean-jhalfs:
|
---|
| 1032 | -if [ ! -f user-lfs-exist ]; then \\
|
---|
| 1033 | userdel lfs; \\
|
---|
| 1034 | rm -rf /home/lfs; \\
|
---|
| 1035 | fi;
|
---|
| 1036 | rm -rf \$(MOUNT_PT)/tools
|
---|
| 1037 | rm -f /tools
|
---|
| 1038 | rm -rf \$(MOUNT_PT)/cross-tools
|
---|
| 1039 | rm -f /cross-tools
|
---|
| 1040 | rm -f envars user-lfs-exist
|
---|
| 1041 | rm -f 02* logs/02*.log
|
---|
[0170229] | 1042 |
|
---|
[39d4d5c] | 1043 | clean-makeboot:
|
---|
| 1044 | rm -rf /tools/*
|
---|
[64cc345] | 1045 | rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools
|
---|
[39d4d5c] | 1046 | rm -f restore-lfs-env sources-dir
|
---|
| 1047 | cd logs && rm -f $cross_tools && rm -f $temptools && rm -f $chroottools && rm -f $boottools && cd ..
|
---|
| 1048 |
|
---|
| 1049 | clean-makesys:
|
---|
| 1050 | -umount \$(MOUNT_PT)/sys
|
---|
| 1051 | -umount \$(MOUNT_PT)/proc
|
---|
| 1052 | -umount \$(MOUNT_PT)/dev/shm
|
---|
| 1053 | -umount \$(MOUNT_PT)/dev/pts
|
---|
| 1054 | -umount \$(MOUNT_PT)/dev
|
---|
| 1055 | rm -rf \$(MOUNT_PT)/{bin,boot,dev,etc,home,lib,lib64,media,mnt,opt,proc,root,sbin,srv,sys,tmp,usr,var}
|
---|
| 1056 | rm -f $basicsystem
|
---|
| 1057 | rm -f $bootscripttools
|
---|
| 1058 | rm -f $bootabletools
|
---|
| 1059 | cd logs && rm -f $basicsystem && rm -f $bootscripttools && rm -f $bootabletools && cd ..
|
---|
| 1060 |
|
---|
| 1061 |
|
---|
| 1062 | restore-lfs-env:
|
---|
| 1063 | @\$(call echo_message, Building)
|
---|
| 1064 | @if [ -f /home/lfs/.bashrc.XXX ]; then \\
|
---|
| 1065 | mv -fv /home/lfs/.bashrc.XXX /home/lfs/.bashrc; \\
|
---|
| 1066 | fi;
|
---|
| 1067 | @if [ -f /home/lfs/.bash_profile.XXX ]; then \\
|
---|
| 1068 | mv -v /home/lfs/.bash_profile.XXX /home/lfs/.bash_profile; \\
|
---|
| 1069 | fi;
|
---|
| 1070 | @chown lfs:lfs /home/lfs/.bash* && \\
|
---|
| 1071 | touch \$@
|
---|
| 1072 |
|
---|
| 1073 | EOF
|
---|
| 1074 | ) >> $MKFILE
|
---|
| 1075 | fi
|
---|
[0170229] | 1076 |
|
---|
| 1077 | # Bring over the items from the Makefile.tmp
|
---|
| 1078 | cat $MKFILE.tmp >> $MKFILE
|
---|
| 1079 | rm $MKFILE.tmp
|
---|
| 1080 | echo "Creating Makefile... ${BOLD}DONE${OFF}"
|
---|
| 1081 |
|
---|
| 1082 | }
|
---|
| 1083 |
|
---|