Change qemux86-64 BITBAKE_CMD to LAYER_DIR in target case

Change-Id: I892c3ae0e73915a5707dc4b38d979e30c67cc582
Signed-off-by: Michael Shepos <shepos@us.ibm.com>
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/build-setup.sh b/build-setup.sh
index 2251395..c1e888d 100755
--- a/build-setup.sh
+++ b/build-setup.sh
@@ -130,6 +130,7 @@
 chown ${UID}:${GROUPS} ${xtrct_path}
 
 # Work out what build target we should be running and set BitBake command
+MACHINE=""
 case ${target} in
   palmetto)
     LAYER_DIR="meta-ibm/meta-palmetto"
@@ -151,9 +152,12 @@
     ;;
   qemu)
     LAYER_DIR="meta-phosphor"
+    # MACHINE defaults to `qemuarm` in this layer, no change necessary
     ;;
   qemux86-64)
-    BITBAKE_CMD="MACHINE=qemux86-64 source oe-init-build-env"
+    LAYER_DIR="meta-phosphor"
+    # MACHINE defaults to `qemuarm` in this layer, change to `qemux86-64`
+    MACHINE="qemux86-64"
     ;;
   *)
     exit 1
@@ -312,6 +316,11 @@
 # Source our build env
 ${BITBAKE_CMD}
 
+# Change MACHINE name when given for build target
+if [[ -n "${MACHINE}" ]]; then
+  sed "s/^MACHINE\ ??=.*/MACHINE\ ??=\ \"${MACHINE}\"/" -i conf/local.conf
+fi
+
 # Custom BitBake config settings
 cat >> conf/local.conf << EOF_CONF
 BB_NUMBER_THREADS = "$(nproc)"