The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=006aaafd3552fefcd615efc200a48d6fa864aa28

commit 006aaafd3552fefcd615efc200a48d6fa864aa28
Author:     Warner Losh <i...@freebsd.org>
AuthorDate: 2025-02-18 17:43:06 +0000
Commit:     Warner Losh <i...@freebsd.org>
CommitDate: 2025-02-18 17:43:20 +0000

    full-test.sh: Support running on macos
    
    Sponsored by:           Netflix
---
 tools/boot/full-test.sh | 80 ++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 60 insertions(+), 20 deletions(-)

diff --git a/tools/boot/full-test.sh b/tools/boot/full-test.sh
index bdb030361b1f..370088f120bb 100644
--- a/tools/boot/full-test.sh
+++ b/tools/boot/full-test.sh
@@ -30,6 +30,47 @@ BIOS=${STAND_ROOT}/bios
 SCRIPTS=${STAND_ROOT}/scripts
 OVERRIDE=${STAND_ROOT}/override
 
+# Find make
+case $(uname) in
+    Darwin)
+       t=$(realpath $(dirname $0)/../..)
+       # Use the python wrapper to find make
+       if [ -f ${t}/tools/build/make.py ]; then
+           MAKE="${t}/tools/build/make.py"
+           case $(uname -m) in
+               arm64)
+                   DEFARCH="TARGET_ARCH=aarch64 TARGET=arm64"
+                   ;;
+               x86_64)
+                   DEFARCH="TARGET_ARCH=amd64 TARGET=amd64"
+                   ;;
+               *)
+                   die "Do not know about $(uanme -p)"
+                   ;;
+           esac
+       else
+           die "Can't find the make wrapper"
+       fi
+       ;;
+    FreeBSD)
+       MAKE=make
+       ;;
+    # linux) not yet
+    *)
+       die "Do not know about system $(uname)"
+       ;;
+esac
+
+SRCTOP=$(${MAKE} ${DEFARCH} -v SRCTOP)
+echo $SRCTOP
+
+# Find makefs and mkimg
+MAKEFS=$(SHELL="which makefs" ${MAKE} ${DEFARCH} buildenv | tail -1) || die 
"No makefs try WITH_DISK_IMAGE_TOOLS_BOOTSTRAP=y"
+MKIMG=$(SHELL="which mkimg" ${MAKE} ${DEFARCH} buildenv | tail -1) || die "No 
mkimg, try buildworld first"
+MTREE=$(SHELL="which mtree" ${MAKE} ${DEFARCH} buildenv | tail -1) || die "No 
mtree, try buildworld first"
+
+# MAKE=$(SHELL="which make" ${MAKE} ${DEFARCH} buildenv | tail -1) || die "No 
make, try buildworld first"
+
 # hack -- I have extra junk in my qemu, but it's not needed to recreate things
 if [ $(whoami) = imp ]; then
     qemu_bin=/home/imp/git/qemu/00-build
@@ -46,8 +87,6 @@ ARCHES="amd64:amd64 arm64:aarch64"
 # The smallest FAT32 filesystem is 33292 KB
 espsize=33292
 
-SRCTOP=$(make -v SRCTOP)
-
 mkdir -p ${CACHE} ${TREES} ${IMAGES} ${BIOS}
 
 die()
@@ -197,14 +236,15 @@ make_freebsd_test_trees()
        [ "${m}" != "${ma}" ] && ma_combo="${m}-${ma}"
        dir=${TREES}/${ma_combo}/test-stand
        mkdir -p ${dir}
-       mtree -deUW -f ${SRCTOP}/etc/mtree/BSD.root.dist -p ${dir}
+       ${MTREE} -deUW -f ${SRCTOP}/etc/mtree/BSD.root.dist -p ${dir}
        echo "Creating tree for ${m}:${ma}"
-       cd ${SRCTOP}/stand
+       cd ${SRCTOP}
        # Indirection needed because our build system is too complex
-#      SHELL="make clean" make buildenv TARGET=${m} TARGET_ARCH=${ma}
-       SHELL="make -j 100 all" make buildenv TARGET=${m} TARGET_ARCH=${ma}
-       SHELL="make install DESTDIR=${dir} MK_MAN=no MK_INSTALL_AS_USER=yes 
WITHOUT_DEBUG_FILES=yes" \
-            make buildenv TARGET=${m} TARGET_ARCH=${ma}
+       # Also, bare make for 'inside' the buildenv ${MAKE} for outside
+#      SHELL="make clean" ${MAKE} buildenv TARGET=${m} TARGET_ARCH=${ma}
+       SHELL="sh -c 'cd stand ; make -j 100 all'" ${MAKE} TARGET=${m} 
TARGET_ARCH=${ma} buildenv
+       DESTDIR=${dir} SHELL="sh -c 'cd stand ; make install MK_MAN=no 
MK_INSTALL_AS_USER=yes WITHOUT_DEBUG_FILES=yes'" \
+            ${MAKE} buildenv TARGET=${m} TARGET_ARCH=${ma}
        rm -rf ${dir}/bin ${dir}/[ac-z]*        # Don't care about anything here
     done
 }
@@ -279,14 +319,14 @@ make_linuxboot_images()
        img2=${IMAGES}/${ma_combo}/linuxboot-${ma_combo}-zfs.img
        pool="linuxboot"
        mkdir -p ${IMAGES}/${ma_combo}
-       makefs -t msdos -o fat_type=32 -o sectors_per_cluster=1 \
+       ${MAKEFS} -t msdos -o fat_type=32 -o sectors_per_cluster=1 \
               -o volume_label=EFISYS -s80m ${esp} ${src}
-       makefs -t ffs -B little -s 200m -o label=root ${ufs} ${dir} ${dir2}
-       mkimg -s gpt -p efi:=${esp} -p freebsd-ufs:=${ufs} -o ${img}
-       makefs -t zfs -s 200m \
+       ${MAKEFS} -t ffs -B little -s 200m -o label=root ${ufs} ${dir} ${dir2}
+       ${MKIMG} -s gpt -p efi:=${esp} -p freebsd-ufs:=${ufs} -o ${img}
+       ${MAKEFS} -t zfs -s 200m \
               -o poolname=${pool} -o bootfs=${pool} -o rootpath=/ \
                ${zfs} ${dir} ${dir2}
-       mkimg -s gpt \
+       ${MKIMG} -s gpt \
              -p efi:=${esp} \
              -p freebsd-zfs:=${zfs} -o ${img2}
        rm -f ${esp}    # Don't need to keep this around
@@ -446,10 +486,10 @@ make_freebsd_images()
        cat > ${dir2}/etc/fstab <<EOF
 /dev/ufs/root  /               ufs     rw      1       1
 EOF
-       makefs -t msdos -o fat_type=32 -o sectors_per_cluster=1 \
+       ${MAKEFS} -t msdos -o fat_type=32 -o sectors_per_cluster=1 \
               -o volume_label=EFISYS -s100m ${esp} ${src}
-       makefs -t ffs -B little -s 200m -o label=root ${ufs} ${dir} ${dir2}
-       mkimg -s gpt -p efi:=${esp} -p freebsd-ufs:=${ufs} -o ${img}
+       ${MAKEFS} -t ffs -B little -s 200m -o label=root ${ufs} ${dir} ${dir2}
+       ${MKIMG} -s gpt -p efi:=${esp} -p freebsd-ufs:=${ufs} -o ${img}
        # rm -f ${esp} ${ufs}   # Don't need to keep this around
     done
 
@@ -470,10 +510,10 @@ EOF
     cat > ${dir2}/etc/fstab <<EOF
 /dev/ufs/root  /               ufs     rw      1       1
 EOF
-    makefs -t ffs -B little -s 200m \
+    ${MAKEFS} -t ffs -B little -s 200m \
           -o label=root,version=2,bsize=32768,fsize=4096,density=16384 \
           ${ufs} ${dir} ${dir2}
-    mkimg -s gpt -b ${dir2}/boot/pmbr \
+    ${MKIMG} -s gpt -b ${dir2}/boot/pmbr \
          -p freebsd-boot:=${dir2}/boot/gptboot \
          -p freebsd-ufs:=${ufs} \
          -o ${img}
@@ -494,10 +534,10 @@ EOF
     cat > ${dir2}/etc/fstab <<EOF
 /dev/ufs/root  /               ufs     rw      1       1
 EOF
-    makefs -t ffs -B big -s 200m \
+    ${MAKEFS} -t ffs -B big -s 200m \
           -o label=root,version=2,bsize=32768,fsize=4096,density=16384 \
           ${ufs} ${dir} ${dir2}
-    mkimg -a 1 -s apm \
+    ${MKIMG} -a 1 -s apm \
         -p freebsd-boot:=${dir2}/boot/boot1.hfs \
         -p freebsd-ufs:=${ufs} \
         -o ${img}

Reply via email to