Mercurial > hg > aboriginal
changeset 580:90bea985c98e
Rename package-mini-native.sh to system-image.sh so the scripts and tarballs they create all have the same name.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 11 Jan 2009 14:24:22 -0600 |
parents | 05a608d26600 |
children | 9dffdd74c186 |
files | build.sh host-tools.sh package-mini-native.sh system-image.sh |
diffstat | 4 files changed, 132 insertions(+), 132 deletions(-) [+] |
line wrap: on
line diff
--- a/build.sh Sun Jan 11 03:16:17 2009 -0600 +++ b/build.sh Sun Jan 11 14:24:22 2009 -0600 @@ -43,6 +43,6 @@ then echo "=== Skipping system-image-$i (already there)" else - time ./package-mini-native.sh $i || exit 1 + time ./system-image.sh $i || exit 1 fi done
--- a/host-tools.sh Sun Jan 11 03:16:17 2009 -0600 +++ b/host-tools.sh Sun Jan 11 14:24:22 2009 -0600 @@ -141,7 +141,7 @@ fi # If the host system hasn't got genext2fs, build it. We use it to build the -# ext2 image to boot qemu with in package-mini-native.sh. +# ext2 image to boot qemu with in system-image.sh. if [ ! -f "${HOSTTOOLS}"/genext2fs ] then
--- a/package-mini-native.sh Sun Jan 11 03:16:17 2009 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ -#!/bin/bash - -# Create a bootable system image from mini-native - -NO_BASE_ARCH=1 -source sources/include.sh - -echo -e "$PACKAGE_COLOR" -echo "=== Packaging system image from mini-native" - -SYSIMAGE="${BUILD}/system-image-${ARCH}" -IMAGE="${SYSIMAGE}/image-${ARCH}.ext2" - -TOOLSDIR=tools -[ -z "$NATIVE_TOOLSDIR" ] && TOOLSDIR=usr - -# Flush old system-image directory - -rm -rf "${SYSIMAGE}" -mkdir -p "${SYSIMAGE}" || dienow - -# Build a linux kernel for the target - -setupfor linux -make ARCH="${KARCH}" KCONFIG_ALLCONFIG="$(getconfig linux)" \ - allnoconfig > /dev/null || dienow - -if [ ! -z "$USE_INITRAMFS" ] -then - echo "Generating initramfs (in background)" - ( - $CC usr/gen_init_cpio.c -o my_gen_init_cpio || dienow - (./my_gen_init_cpio <( - [ ! -d "$NATIVE"/dev ] && echo "dir /dev 755 0 0" - [ ! -e "$NATIVE"/init ] && - echo "slink /init $NATIVE/$TOOLSDIR/sbin/init.sh 755 0 0" - - "$SOURCES"/toys/gen_initramfs_list.sh "$NATIVE" && - echo "nod /dev/console 640 0 0 c 5 1" >> initramfs.txt || dienow - ) || dienow - ) | gzip -9 > initramfs_data.cpio.gz || dienow - echo Initramfs generated. - ) & -fi - -# Build a kernel. - -make -j $CPUS ARCH="${KARCH}" CROSS_COMPILE="${ARCH}-" || dienow -wait4background 0 - -# Embed an initramfs image in the kernel? - -if [ ! -z "$USE_INITRAMFS" ] -then - # This is a repeat of an earlier make invocation, but if we try to - # consolidate them the dependencies build unnecessary prereqisites - # and then decide that they're newer than the cpio.gz we supplied, - # and thus overwrite it with a default (emptyish) one. - - echo "Building kernel with initramfs." - [ -f initramfs_data.cpio.gz ] && - touch initramfs_data.cpio.gz && - mv initramfs_data.cpio.gz usr && - make -j $CPUS ARCH="${KARCH}" CROSS_COMPILE="${ARCH}-" || dienow -fi - -# Install kernel - -[ -d "${TOOLS}/src" ] && cp .config "${TOOLS}"/src/config-linux -cp "${KERNEL_PATH}" "${SYSIMAGE}/zImage-${ARCH}" && -cd .. - -cleanup linux - -if [ -z "$USE_INITRAMFS" ] -then - # Generate a 64 megabyte ext2 filesystem image from the $NATIVE directory, - # with a temporary file defining the /dev nodes for the new filesystem. - - cat > "$WORK/devlist" << EOF && -/dev d 755 0 0 - - - - - -/dev/console c 640 0 0 5 1 0 0 - -EOF - genext2fs -z -D "$WORK/devlist" -d "${NATIVE}" -i 1024 -b $[64*1024] \ - "$IMAGE" && - rm "$WORK/devlist" || dienow -fi - -# Provide qemu's common command line options between architectures. The lack -# of ending quotes on -append is intentional, callers append more kernel -# command line arguments and provide their own ending quote. -function qemu_defaults() -{ - echo -n "-nographic -no-reboot \$WITH_HDB" - [ -z "$USE_INITRAMFS" ] && echo -n " -hda \"$1\"" - echo " -kernel \"$2\" -append \"root=/dev/$ROOT console=$CONSOLE" \ - "rw init=/$TOOLSDIR/sbin/init.sh panic=1" \ - 'PATH=$DISTCC_PATH_PREFIX/$TOOLSDIR/bin $KERNEL_EXTRA"' -} - -# Write out a script to call the appropriate emulator. We split out the -# 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-$ARCH.ext2 zImage-$ARCH >> "$SYSIMAGE/run-emulator.sh" - -[ $? -ne 0 ] && dienow - -if [ "$ARCH" == powerpc ] -then - cp "$SOURCES"/toys/ppc_rom.bin "$SYSIMAGE" || dienow -fi - -# Tar it up. - -tar -cvj -f "$BUILD"/system-image-$ARCH.tar.bz2 \ - -C "$BUILD" system-image-$ARCH || dienow - -echo -e "=== Packaging complete\e[0m" - - -# We used to do this, but updating the squashfs patch for each new kernel -# was just too much work. If it gets merged someday, we may care again... - -#echo -n "Creating tools.sqf" -#("${WORK}/mksquashfs" "${NATIVE}/tools" "${WORK}/tools.sqf" \ -# -noappend -all-root -info || dienow) | dotprogress - -
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/system-image.sh Sun Jan 11 14:24:22 2009 -0600 @@ -0,0 +1,130 @@ +#!/bin/bash + +# Create a bootable system image from mini-native + +NO_BASE_ARCH=1 +source sources/include.sh + +echo -e "$PACKAGE_COLOR" +echo "=== Packaging system image from mini-native" + +SYSIMAGE="${BUILD}/system-image-${ARCH}" +IMAGE="${SYSIMAGE}/image-${ARCH}.ext2" + +TOOLSDIR=tools +[ -z "$NATIVE_TOOLSDIR" ] && TOOLSDIR=usr + +# Flush old system-image directory + +rm -rf "${SYSIMAGE}" +mkdir -p "${SYSIMAGE}" || dienow + +# Build a linux kernel for the target + +setupfor linux +make ARCH="${KARCH}" KCONFIG_ALLCONFIG="$(getconfig linux)" \ + allnoconfig > /dev/null || dienow + +if [ ! -z "$USE_INITRAMFS" ] +then + echo "Generating initramfs (in background)" + ( + $CC usr/gen_init_cpio.c -o my_gen_init_cpio || dienow + (./my_gen_init_cpio <( + [ ! -d "$NATIVE"/dev ] && echo "dir /dev 755 0 0" + [ ! -e "$NATIVE"/init ] && + echo "slink /init $NATIVE/$TOOLSDIR/sbin/init.sh 755 0 0" + + "$SOURCES"/toys/gen_initramfs_list.sh "$NATIVE" && + echo "nod /dev/console 640 0 0 c 5 1" >> initramfs.txt || dienow + ) || dienow + ) | gzip -9 > initramfs_data.cpio.gz || dienow + echo Initramfs generated. + ) & +fi + +# Build a kernel. + +make -j $CPUS ARCH="${KARCH}" CROSS_COMPILE="${ARCH}-" || dienow +wait4background 0 + +# Embed an initramfs image in the kernel? + +if [ ! -z "$USE_INITRAMFS" ] +then + # This is a repeat of an earlier make invocation, but if we try to + # consolidate them the dependencies build unnecessary prereqisites + # and then decide that they're newer than the cpio.gz we supplied, + # and thus overwrite it with a default (emptyish) one. + + echo "Building kernel with initramfs." + [ -f initramfs_data.cpio.gz ] && + touch initramfs_data.cpio.gz && + mv initramfs_data.cpio.gz usr && + make -j $CPUS ARCH="${KARCH}" CROSS_COMPILE="${ARCH}-" || dienow +fi + +# Install kernel + +[ -d "${TOOLS}/src" ] && cp .config "${TOOLS}"/src/config-linux +cp "${KERNEL_PATH}" "${SYSIMAGE}/zImage-${ARCH}" && +cd .. + +cleanup linux + +if [ -z "$USE_INITRAMFS" ] +then + # Generate a 64 megabyte ext2 filesystem image from the $NATIVE directory, + # with a temporary file defining the /dev nodes for the new filesystem. + + cat > "$WORK/devlist" << EOF && +/dev d 755 0 0 - - - - - +/dev/console c 640 0 0 5 1 0 0 - +EOF + genext2fs -z -D "$WORK/devlist" -d "${NATIVE}" -i 1024 -b $[64*1024] \ + "$IMAGE" && + rm "$WORK/devlist" || dienow +fi + +# Provide qemu's common command line options between architectures. The lack +# of ending quotes on -append is intentional, callers append more kernel +# command line arguments and provide their own ending quote. +function qemu_defaults() +{ + echo -n "-nographic -no-reboot \$WITH_HDB" + [ -z "$USE_INITRAMFS" ] && echo -n " -hda \"$1\"" + echo " -kernel \"$2\" -append \"root=/dev/$ROOT console=$CONSOLE" \ + "rw init=/$TOOLSDIR/sbin/init.sh panic=1" \ + 'PATH=$DISTCC_PATH_PREFIX/$TOOLSDIR/bin $KERNEL_EXTRA"' +} + +# Write out a script to call the appropriate emulator. We split out the +# 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-$ARCH.ext2 zImage-$ARCH >> "$SYSIMAGE/run-emulator.sh" + +[ $? -ne 0 ] && dienow + +if [ "$ARCH" == powerpc ] +then + cp "$SOURCES"/toys/ppc_rom.bin "$SYSIMAGE" || dienow +fi + +# Tar it up. + +tar -cvj -f "$BUILD"/system-image-$ARCH.tar.bz2 \ + -C "$BUILD" system-image-$ARCH || dienow + +echo -e "=== Packaging complete\e[0m" + + +# We used to do this, but updating the squashfs patch for each new kernel +# was just too much work. If it gets merged someday, we may care again... + +#echo -n "Creating tools.sqf" +#("${WORK}/mksquashfs" "${NATIVE}/tools" "${WORK}/tools.sqf" \ +# -noappend -all-root -info || dienow) | dotprogress + +