Mercurial > hg > aboriginal
changeset 813:e2fc10ede93f
Consistently use STAGE_DIR as the output directory. (root-filesystem.sh already did, host-tools.sh was using $HOSTTOOLS, cross-compiler.sh was using $CROSS, and system-image.sh was using SYSIMAGE.)
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 23 Aug 2009 15:04:33 -0500 |
parents | 4e1e6aa7f445 |
children | 5dd054d1c789 |
files | cross-compiler.sh host-tools.sh system-image.sh |
diffstat | 3 files changed, 66 insertions(+), 63 deletions(-) [+] |
line wrap: on
line diff
--- a/cross-compiler.sh Sat Aug 22 04:07:00 2009 -0500 +++ b/cross-compiler.sh Sun Aug 23 15:04:33 2009 -0500 @@ -17,15 +17,14 @@ echo -e "$CROSS_COLOR" echo "=== Building $STAGE_NAME" -CROSS="${BUILD}/${STAGE_NAME}-${ARCH}" -blank_tempdir "$CROSS" +blank_tempdir "$STAGE_DIR" blank_tempdir "$WORK" # Build and install binutils setupfor binutils build-binutils && AR=ar AS=as LD=ld NM=nm OBJDUMP=objdump OBJCOPY=objcopy \ - "${CURSRC}/configure" --prefix="${CROSS}" --host=${CROSS_HOST} \ + "${CURSRC}/configure" --prefix="${STAGE_DIR}" --host=${CROSS_HOST} \ --target=${CROSS_TARGET} --with-lib-path=lib --disable-nls \ --disable-shared --disable-multilib --program-prefix="${ARCH}-" \ --disable-werror $BINUTILS_FLAGS && @@ -33,8 +32,8 @@ make -j $CPUS CFLAGS="-O2 $STATIC_FLAGS" && make -j $CPUS install && cd .. && -mkdir -p "${CROSS}/include" && -cp binutils/include/libiberty.h "${CROSS}/include" +mkdir -p "${STAGE_DIR}/include" && +cp binutils/include/libiberty.h "${STAGE_DIR}/include" cleanup binutils build-binutils @@ -43,7 +42,7 @@ setupfor gcc-core build-gcc && setupfor gcc-g++ build-gcc gcc-core && AR_FOR_TARGET="${ARCH}-ar" "${CURSRC}/configure" \ - --prefix="${CROSS}" --host=${CROSS_HOST} --target=${CROSS_TARGET} \ + --prefix="${STAGE_DIR}" --host=${CROSS_HOST} --target=${CROSS_TARGET} \ --enable-languages=c,c++ --enable-long-long --enable-c99 \ --disable-shared --disable-threads --disable-nls --disable-multilib \ --enable-__cxa_atexit --disable-libstdcxx-pch \ @@ -63,15 +62,15 @@ # Move the gcc internal libraries and headers somewhere sane. -mkdir -p "${CROSS}"/gcc && -mv "${CROSS}"/lib/gcc/*/*/include "${CROSS}"/gcc/include && -mv "${CROSS}"/lib/gcc/*/* "${CROSS}"/gcc/lib && -ln -s ${CROSS_TARGET} ${CROSS}/tools && -ln -sf ../../../../tools/bin/ld ${CROSS}/libexec/gcc/*/*/collect2 && +mkdir -p "${STAGE_DIR}"/gcc && +mv "${STAGE_DIR}"/lib/gcc/*/*/include "${STAGE_DIR}"/gcc/include && +mv "${STAGE_DIR}"/lib/gcc/*/* "${STAGE_DIR}"/gcc/lib && +ln -s ${CROSS_TARGET} ${STAGE_DIR}/tools && +ln -sf ../../../../tools/bin/ld ${STAGE_DIR}/libexec/gcc/*/*/collect2 && # Build and install gcc wrapper script. -cd "${CROSS}"/bin && +cd "${STAGE_DIR}"/bin && mv "${ARCH}-gcc" "$ARCH-rawgcc" && $CC $STATIC_FLAGS -Os -s "${SOURCES}"/toys/ccwrap.c -o "${ARCH}-gcc" \ -DGCC_UNWRAPPED_NAME='"'"$ARCH"-rawgcc'"' && @@ -85,15 +84,15 @@ ln -s "${ARCH}-gcc" "${ARCH}-g++" && ln -s "${ARCH}-gcc" "${ARCH}-c++" -cleanup "${CROSS}"/{lib/gcc,{libexec/gcc,gcc/lib}/install-tools} +cleanup "${STAGE_DIR}"/{lib/gcc,{libexec/gcc,gcc/lib}/install-tools} # Install kernel headers. setupfor linux && # Install Linux kernel headers (for use by uClibc). -make -j $CPUS headers_install ARCH="${KARCH}" INSTALL_HDR_PATH="${CROSS}" && +make -j $CPUS headers_install ARCH="${KARCH}" INSTALL_HDR_PATH="${STAGE_DIR}" && # This makes some very old package builds happy. -ln -s ../sys/user.h "${CROSS}/include/asm/page.h" && +ln -s ../sys/user.h "${STAGE_DIR}/include/asm/page.h" && cd .. cleanup linux @@ -101,19 +100,19 @@ # Build and install uClibc setupfor uClibc -make CROSS= KCONFIG_ALLCONFIG="$(getconfig uClibc)" allnoconfig && -make CROSS="${ARCH}-" KERNEL_HEADERS="${CROSS}/include" PREFIX="${CROSS}/" \ - RUNTIME_PREFIX=/ DEVEL_PREFIX=/ -j $CPUS $VERBOSITY \ +make KCONFIG_ALLCONFIG="$(getconfig uClibc)" allnoconfig && +make KERNEL_HEADERS="${STAGE_DIR}/include" PREFIX="${STAGE_DIR}/" \ + CROSS="${ARCH}-" RUNTIME_PREFIX=/ DEVEL_PREFIX=/ -j $CPUS $VERBOSITY \ install hostutils || dienow for i in $(cd utils; ls *.host | sed 's/\.host//') do - cp utils/"$i".host "$CROSS/bin/$ARCH-$i" || dienow + cp utils/"$i".host "$STAGE_DIR/bin/$ARCH-$i" || dienow done cd .. cleanup uClibc -cat > "${CROSS}"/README << EOF && +cat > "${STAGE_DIR}"/README << EOF && Cross compiler for $ARCH From http://impactlinux.com/fwl @@ -128,7 +127,7 @@ # Strip the binaries -cd "$CROSS" +cd "$STAGE_DIR" for i in `find bin -type f` `find "$CROSS_TARGET" -type f` do strip "$i" 2> /dev/null
--- a/host-tools.sh Sat Aug 22 04:07:00 2009 -0500 +++ b/host-tools.sh Sun Aug 23 15:04:33 2009 -0500 @@ -29,8 +29,10 @@ export LC_ALL=C +STAGE_DIR="${HOSTTOOLS}" + blank_tempdir "${WORK}" -mkdir -p "${HOSTTOOLS}" || dienow +mkdir -p "${STAGE_DIR}" || dienow # If we want to record the host command lines, so we know exactly what commands # the build uses, set up a wrapper that does that. @@ -88,26 +90,26 @@ # Use the new tools we build preferentially, as soon as they become # available. - PATH="$HOSTTOOLS:$PATH" + PATH="$STAGE_DIR:$PATH" # Start by building busybox. We have no idea what strange things our host # system has (or lacks, such as "which"), so throw busybox at it first # thing. - if [ ! -f "${HOSTTOOLS}/busybox" ] + if [ ! -f "${STAGE_DIR}/busybox" ] then setupfor busybox && make allyesconfig KCONFIG_ALLCONFIG="${SOURCES}/trimconfig-busybox" && make -j $CPUS && make busybox.links && - cp busybox "${HOSTTOOLS}" + cp busybox "${STAGE_DIR}" [ $? -ne 0 ] && dienow for i in $(sed 's@.*/@@' busybox.links) do - [ ! -f "${HOSTTOOLS}/$i" ] && - (ln -sf busybox "${HOSTTOOLS}/$i" || dienow) + [ ! -f "${STAGE_DIR}/$i" ] && + (ln -sf busybox "${STAGE_DIR}/$i" || dienow) done cd .. @@ -116,18 +118,18 @@ # Build toybox - if [ ! -f "${HOSTTOOLS}/toybox" ] + if [ ! -f "${STAGE_DIR}/toybox" ] then setupfor toybox && make defconfig && make || dienow if [ -z "$USE_TOYBOX" ] then - mv toybox "$HOSTTOOLS" && - ln -sf toybox "$HOSTTOOLS"/patch && - ln -sf toybox "$HOSTTOOLS"/netcat || dienow + mv toybox "$STAGE_DIR" && + ln -sf toybox "$STAGE_DIR"/patch && + ln -sf toybox "$STAGE_DIR"/netcat || dienow else - make install_flat PREFIX="${HOSTTOOLS}" || dienow + make install_flat PREFIX="${STAGE_DIR}" || dienow fi cd .. @@ -146,24 +148,24 @@ for i in ar as nm cc make ld gcc do - if [ ! -f "${HOSTTOOLS}/$i" ] + if [ ! -f "${STAGE_DIR}/$i" ] then # Loop through each instance, populating fallback directories. X=0 - FALLBACK="$HOSTTOOLS" - PATH="$OLDPATH" "$HOSTTOOLS/which" -a "$i" | while read j + FALLBACK="$STAGE_DIR" + PATH="$OLDPATH" "$STAGE_DIR/which" -a "$i" | while read j do mkdir -p "$FALLBACK" && ln -sf "$j" "$FALLBACK/$i" || dienow X=$[$X+1] - FALLBACK="$HOSTTOOLS/fallback-$X" + FALLBACK="$STAGE_DIR/fallback-$X" done fi done - # We now have all the tools we need in $HOSTTOOLS, so trim the $PATH to + # We now have all the tools we need in $STAGE_DIR, so trim the $PATH to # remove the old ones. PATH="$(hosttools_path)" @@ -184,7 +186,7 @@ setupfor distcc && ./configure --with-included-popt --disable-Werror && make -j "$CPUS" && - cp distcc distccd "${HOSTTOOLS}" && + cp distcc distccd "${STAGE_DIR}" && cd .. cleanup distcc @@ -193,12 +195,12 @@ # Build genext2fs. We use it to build the ext2 image to boot qemu with # in system-image.sh. -if [ ! -f "${HOSTTOOLS}"/genext2fs ] +if [ ! -f "${STAGE_DIR}"/genext2fs ] then setupfor genext2fs && ./configure && make -j $CPUS && - cp genext2fs "${HOSTTOOLS}" && + cp genext2fs "${STAGE_DIR}" && cd .. cleanup genext2fs @@ -218,13 +220,13 @@ # fsck.ext2 and tune2fs. These are installed by default in most distros # (which genext2fs isn't), and genext2fs doesn't have ext3 support anyway. -if [ ! -f "${HOSTTOOLS}"/mke2fs ] +if [ ! -f "${STAGE_DIR}"/mke2fs ] then setupfor e2fsprogs && ./configure --disable-tls --enable-htree && make -j "$CPUS" && - cp misc/{mke2fs,tune2fs} resize/resize2fs "${HOSTTOOLS}" && - cp e2fsck/e2fsck "$HOSTTOOLS"/fsck.ext2 && + cp misc/{mke2fs,tune2fs} resize/resize2fs "${STAGE_DIR}" && + cp e2fsck/e2fsck "$STAGE_DIR"/fsck.ext2 && cd .. cleanup e2fsprogs @@ -232,12 +234,12 @@ # Squashfs is an alternate packaging option. -if [ ! -f "${HOSTTOOLS}"/mksquashfs ] +if [ ! -f "${STAGE_DIR}"/mksquashfs ] then setupfor squashfs && cd squashfs-tools && make -j $CPUS && - cp mksquashfs unsquashfs "${HOSTTOOLS}" && + cp mksquashfs unsquashfs "${STAGE_DIR}" && cd .. cleanup squashfs @@ -250,7 +252,7 @@ # Either build qemu from source, or symlink it. -if [ ! -f "${HOSTTOOLS}"/qemu ] +if [ ! -f "${STAGE_DIR}"/qemu ] then if [ ! -z "$HOST_BUILD_EXTRA" ] then @@ -266,11 +268,11 @@ setupfor qemu && cp "$SOURCES"/patches/openbios-ppc pc-bios/openbios-ppc && sed -i 's@datasuffix=".*"@datasuffix="/pc-bios"@' configure && - ./configure --disable-gfx-check --prefix="$HOSTTOOLS" && + ./configure --disable-gfx-check --prefix="$STAGE_DIR" && make -j $CPUS && # Copy the executable files and ROM files - cp $(find -type f -perm +111 -name "qemu*") "$HOSTTOOLS" && - cp -r pc-bios "$HOSTTOOLS" && + cp $(find -type f -perm +111 -name "qemu*") "$STAGE_DIR" && + cp -r pc-bios "$STAGE_DIR" && cd .. cleanup qemu @@ -282,7 +284,7 @@ do for j in $(cd "$i"; ls qemu* 2>/dev/null) do - ln -s "$i/$j" "$HOSTTOOLS/$j" + ln -s "$i/$j" "$STAGE_DIR/$j" done done fi @@ -291,7 +293,7 @@ if [ ! -z "$RECORD_COMMANDS" ] then # Make sure the host tools we just built are also in wrapdir - for j in $(ls "$HOSTTOOLS") + for j in $(ls "$STAGE_DIR") do [ -e "$BUILD/wrapdir/$j" ] || ln -s wrappy "$BUILD/wrapdir/$j" done
--- a/system-image.sh Sat Aug 22 04:07:00 2009 -0500 +++ b/system-image.sh Sun Aug 23 15:04:33 2009 -0500 @@ -19,8 +19,10 @@ blank_tempdir "$WORK" -# A little song and dance so we run in our own session, to prevent the "kill 0" -# below from taking down the shell that called us. +# This little song and dance makes us run in our own session, to prevent the +# "kill 0" below from taking down the shell that called us when it cleans up +# our background tasks. (We run the kernel build and root filesystem image +# generation in parallel.) if [ -z "$SYSTEM_IMAGE_SETSID" ] then @@ -34,13 +36,13 @@ exec "$WORK/mysetsid" "$0" "$@" fi -# Announce start of stage. +# Announce start of stage. (Down here after the recursive call above so +# it doesn't get announced twice.) echo -e "$PACKAGE_COLOR" echo "=== Packaging system image from root-filesystem" -SYSIMAGE="${BUILD}/system-image-${ARCH_NAME}" -blank_tempdir "$SYSIMAGE" +blank_tempdir "$STAGE_DIR" [ -z "$SYSIMAGE_TYPE" ] && SYSIMAGE_TYPE=squashfs @@ -132,7 +134,7 @@ [ $BLOCKS -lt 4096 ] && BLOCKS=4096 genext2fs -z -D "$DEVLIST" -d "$NATIVE_ROOT" -b $BLOCKS -i 1024 \ - "$SYSIMAGE/$IMAGE" && + "$STAGE_DIR/$IMAGE" && rm "$DEVLIST" || dienow # Extend image size to HDA_MEGS if necessary, keeping it sparse. (Feeding @@ -141,14 +143,14 @@ if [ $[1024*$SYSIMAGE_HDA_MEGS] -gt 65536 ] then - dd if=/dev/zero of="$SYSIMAGE/$IMAGE" bs=1k count=1 seek=$[1024*1024-1] && - resize2fs "$SYSIMAGE/$IMAGE" ${SYSIMAGE_HDA_MEGS}M || dienow + dd if=/dev/zero of="$STAGE_DIR/$IMAGE" bs=1k count=1 seek=$[1024*1024-1] && + resize2fs "$STAGE_DIR/$IMAGE" ${SYSIMAGE_HDA_MEGS}M || dienow fi elif [ "$SYSIMAGE_TYPE" == "squashfs" ] then IMAGE="image-${ARCH}.sqf" - mksquashfs "${NATIVE_ROOT}" "$SYSIMAGE/$IMAGE" -noappend -all-root \ + mksquashfs "${NATIVE_ROOT}" "$STAGE_DIR/$IMAGE" -noappend -all-root \ -no-progress -p "/dev d 755 0 0" -p "/dev/console c 666 0 0 5 1" || dienow else echo "Unknown image type." >&2 @@ -164,7 +166,7 @@ # Install kernel [ -d "${TOOLS}/src" ] && cp .config "${TOOLS}"/src/config-linux -cp "${KERNEL_PATH}" "${SYSIMAGE}/zImage-${ARCH}" && +cp "${KERNEL_PATH}" "${STAGE_DIR}/zImage-${ARCH}" && cd .. cleanup linux @@ -189,8 +191,8 @@ # filesystem, kernel, and base kernel command line arguments in case you want # to use an emulator other than qemu, but put the default case in qemu_defaults -cp "$SOURCES/toys/run-emulator.sh" "$SYSIMAGE/run-emulator.sh" && -emulator_command "$IMAGE" zImage-$ARCH >> "$SYSIMAGE/run-emulator.sh" +cp "$SOURCES/toys/run-emulator.sh" "$STAGE_DIR/run-emulator.sh" && +emulator_command "$IMAGE" zImage-$ARCH >> "$STAGE_DIR/run-emulator.sh" [ $? -ne 0 ] && dienow