view host-tools.sh @ 253:f93932523a08

Reorder forkbomb build so ./host-tools.sh gets built first. Then toybox utilities can be used to extract all the other packages (patch, bunzip, sha1sum, echo, eventually tar...) Motivated by a bug I encountered in gnu patch on Kubuntu 7.10 that's insisting linux-2.6.13-cmdline.patch is a reversed patch, when it isn't. (That patch has been happily applying for over a year now, and I examined it by hand. The bug's in the Ubuntu patch command. Not my problem.)
author Rob Landley <rob@landley.net>
date Tue, 01 Jan 2008 03:08:29 -0600
parents 8b0d2080707c
children e005f4279b36
line wrap: on
line source

#!/bin/bash

# Get lots of predefined environment variables and shell functions.

echo -e "\e[0m"
echo "=== Building host tools"

NO_ARCH=1
source include.sh

#rm -rf "${HOSTTOOLS}"
mkdir -p "${HOSTTOOLS}" || dienow

# Build toybox
if [ ! -f "$(which toybox)" ]
then
echo which toybox
  setupfor toybox &&
  make defconfig &&
  make &&
  make instlist &&
  make install_flat PREFIX="${HOSTTOOLS}" &&
  cd .. &&
  $CLEANUP toybox

  [ $? -ne 0 ] && dienow
fi

# As a temporary measure, build User Mode Linux and use _that_ to package
# the ext2 image to boot qemu with.

if [ -z "$(which linux)" ]
then
  setupfor linux &&
  cat > mini.conf << EOF
CONFIG_BINFMT_ELF=y
CONFIG_HOSTFS=y
CONFIG_LBD=y
CONFIG_BLK_DEV=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_STDERR_CONSOLE=y
CONFIG_UNIX98_PTYS=y
CONFIG_EXT2_FS=y
EOF
  make ARCH=um allnoconfig KCONFIG_ALLCONFIG=mini.conf &&
  make -j $CPUS ARCH=um &&
  cp linux "${HOSTTOOLS}" &&
  cd .. &&
  $CLEANUP linux

  [ $? -ne 0 ] && dienow
fi

# Build squashfs
#setupfor squashfs
#cd squashfs-tools &&
#make &&
#cp mksquashfs unsquashfs "${HOSTTOOLS}" &&
#cd .. &&
#$CLEANUP squashfs*
#
#[ $? -ne 0 ] && dienow

# we can't reliably build qemu because who knows what gcc version the host
# has?  so until qemu is fixed to build with an arbitrary c compiler,
# just test for its' existence and warn.

temp="qemu-${qemu_test}"
[ -z "$qemu_test" ] && temp=qemu

if [ -z "$(which $temp)" ]
then
  echo "***************** warning: $temp not found. *******************"
fi

#  setupfor qemu &&
#  ./configure --disable-gcc-check --disable-gfx-check --prefix="${CROSS}" &&
#  make &&
#  make install &&
#  cd .. &&
#  $CLEANUP qemu-*

echo -e "\e[32mHost tools build complete.\e[0m"