"k">if [ -z "$OE_TMPDIR" ]; then # Try to get OE_TMPDIR from bitbake type -P bitbake &>/dev/null || { echo "In order for this script to dynamically infer paths"; echo "to kernels or filesystem images, you either need"; echo "bitbake in your PATH or to source oe-init-build-env"; echo "before running this script" >&2; exit 1; } # We have bitbake in PATH, get OE_TMPDIR from bitbake OE_TMPDIR=`MACHINE=$MACHINE bitbake -e | grep ^TMPDIR=\" | cut -d '=' -f2 | cut -d '"' -f2` if [ -z "$OE_TMPDIR" ]; then # Check for errors from bitbake that the user needs to know about BITBAKE_OUTPUT=`bitbake -e | wc -l` if [ "$BITBAKE_OUTPUT" -eq "0" ]; then echo "Error: this script needs to be run from your build directory," echo "or you need to explicitly set OE_TMPDIR in your environment" else echo "There was an error running bitbake to determine TMPDIR" echo "Here is the output from 'bitbake -e':" bitbake -e fi exit 1 fi fi } setup_sysroot() { # Toolchain installs set up $OECORE_NATIVE_SYSROOT in their # environment script. If that variable isn't set, we're # either in an in-tree build scenario or the environment # script wasn't source'd. if [ -z "$OECORE_NATIVE_SYSROOT" ]; then setup_tmpdir BUILD_ARCH=`uname -m` BUILD_OS=`uname | tr '[A-Z]' '[a-z]'` BUILD_SYS="$BUILD_ARCH-$BUILD_OS" OECORE_NATIVE_SYSROOT=$OE_TMPDIR/sysroots/$BUILD_SYS fi } # Locate a rootfs image to boot which matches our expected # machine and fstype. findimage() { where=$1 machine=$2 extension=$3 # Sort rootfs candidates by modification time - the most # recently created one is the one we most likely want to boot. filenames=`ls -t $where/*-image*$machine.$extension 2>/dev/null | xargs` for name in $filenames; do case $name in *core-image-sato* | \ *core-image-lsb* | \ *core-image-basic* | \ *core-image-minimal* ) ROOTFS=$name return ;; esac done echo "Couldn't find a $machine rootfs image in $where." exit 1 } if [ -e "$ROOTFS" -a -z "$FSTYPE" ]; then # Extract the filename extension EXT=`echo $ROOTFS | awk -F . '{ print \$NF }'` if [ "x$EXT" = "xext2" -o "x$EXT" = "xext3" -o \ "x$EXT" = "xjffs2" -o "x$EXT" = "xbtrfs" ]; then FSTYPE=$EXT else echo "Note: Unable to determine filesystem extension for $ROOTFS" echo "We will use the default FSTYPE for $MACHINE" # ...which is done further below... fi fi if [ -z "$KERNEL" -a "x$FSTYPE" != "xvmdk" ]; then setup_tmpdir eval kernel_file=\$${machine2}_DEFAULT_KERNEL KERNEL=$OE_TMPDIR/deploy/images/$kernel_file if [ -z "$KERNEL" ]; then error "Unable to determine default kernel for MACHINE [$MACHINE]" fi fi # KERNEL is now set for all cases if [ -z "$FSTYPE" ]; then eval FSTYPE=\$${machine2}_DEFAULT_FSTYPE if [ -z "$FSTYPE" ]; then error "Unable to determine default fstype for MACHINE [$MACHINE]" fi fi # FSTYPE is now set for all cases # Handle cases where a ROOTFS type is given instead of a filename, e.g. # core-image-sato if [ "$LAZY_ROOTFS" = "true" ]; then setup_tmpdir echo "Assuming $ROOTFS really means $OE_TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE" ROOTFS=$OE_TMPDIR/deploy/images/$ROOTFS-$MACHINE.$FSTYPE fi if [ -z "$ROOTFS" -a "x$FSTYPE" != "xvmdk" ]; then setup_tmpdir T=$OE_TMPDIR/deploy/images eval rootfs_list=\$${machine2}_DEFAULT_ROOTFS findimage $T $MACHINE $FSTYPE if [ -z "$ROOTFS" ]; then error "Unable to determine default rootfs for MACHINE [$MACHINE]" fi fi # ROOTFS is now set for all cases echo "" echo "Continuing with the following parameters:" if [ "x$FSTYPE" != "xvmdk" ]; then echo "KERNEL: [$KERNEL]" echo "ROOTFS: [$ROOTFS]" else echo "VMDK: [$VM]" fi echo "FSTYPE: [$FSTYPE]" setup_sysroot # OECORE_NATIVE_SYSROOT is now set for all cases INTERNAL_SCRIPT="$0-internal" if [ ! -f "$INTERNAL_SCRIPT" -o ! -r "$INTERNAL_SCRIPT" ]; then INTERNAL_SCRIPT=`which runqemu-internal` fi . $INTERNAL_SCRIPT exit $?