Skip to content

Commit

Permalink
feat: make i386 first citizen again
Browse files Browse the repository at this point in the history
  • Loading branch information
iMilnb committed Jan 7, 2025
1 parent 270dd3b commit 4fc20f6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
27 changes: 15 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,30 @@ GROUP!= id -gn
ifneq (${WHOAMI}, root)
SUDO!= command -v doas || echo "sudo -E ARCH=${ARCH} VERS=${VERS}"
endif
# sets to fetch
RESCUE= rescue.tar.xz etc.tar.xz
BASE= base.tar.xz etc.tar.xz
PROF= ${BASE} comp.tar.xz
NBAKERY= ${BASE} comp.tar.xz
BOZO= ${BASE}
IMGBUILDER= ${BASE}
SETSEXT=tar.xz
SETSDIR=sets/${ARCH}

ifeq (${ARCH}, evbarm-aarch64)
KERNEL= netbsd-GENERIC64.img
LIVEIMGGZ= https://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/latest/evbarm-aarch64/binary/gzimg/arm64.img.gz
else ifeq (${ARCH}, i386)
KERNEL= netbsd-GENERIC
SETSEXT= tgz
else
KERNEL= netbsd-SMOL
KDIST= https://smolbsd.org/assets
LIVEIMGGZ= https://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/latest/images/NetBSD-10.99.12-amd64-live.img.gz
endif
LIVEIMG= NetBSD-${ARCH}-live.img

# sets to fetch
RESCUE= rescue.${SETSEXT} etc.${SETSEXT}
BASE= base.${SETSEXT} etc.${SETSEXT}
PROF= ${BASE} comp.${SETSEXT}
NBAKERY= ${BASE} comp.${SETSEXT}
BOZO= ${BASE}
IMGBUILDER= ${BASE}

ifeq ($(shell uname -m), x86_64)
ROOTFS?= -r ld0a
else
Expand Down Expand Up @@ -68,11 +72,10 @@ kernfetch:
)

setfetch:
setsdir=sets/${ARCH} && \
[ -d $${setsdir} ] || mkdir -p $${setsdir} && \
for s in $${SETS}; do \
if [ ! -f $${setsdir}/$$s ]; then \
curl -L -O --output-dir $${setsdir} ${DIST}/sets/$$s; \
[ -d ${SETSDIR} ] || mkdir -p ${SETSDIR}
for s in ${SETS}; do \
if [ ! -f ${SETSDIR}/$$s ]; then \
curl -L -o ${SETSDIR}/$$s ${DIST}/sets/$$s; \
fi; \
done

Expand Down
7 changes: 5 additions & 2 deletions startnb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ img=${img:-$NBIMG}

OS=$(uname -s)
MACHINE=$(uname -m) # Linux and macos x86
QEMU="qemu-system-${MACHINE}"

cputype="host"

Expand Down Expand Up @@ -140,7 +141,9 @@ x86_64|i386)
mflags="-M microvm,rtc=on,acpi=off,pic=off${ACCEL}"
cpuflags="-cpu ${cputype},+invtsc"
root=${root:-"ld0a"}
extra="$extra -L bios -bios bios-microvm.bin"
# stack smashing with version 9.0 and 9.1
${QEMU} --version|egrep -q '9\.[01]' && \
extra="$extra -L bios -bios bios-microvm.bin"
;;
aarch64)
mflags="-M virt${ACCEL},highmem=off,gic-version=3"
Expand All @@ -165,7 +168,7 @@ fi
# QMP is available
[ -n "${qmp_port}" ] && extra="$extra -qmp tcp:localhost:${qmp_port},server,wait=off"

cmd="qemu-system-${MACHINE} -smp $cores \
cmd="${QEMU} -smp $cores \
$mflags -m $mem $cpuflags \
-kernel $kernel -append \"console=com root=${root} ${append}\" \
-global virtio-mmio.force-legacy=false ${share} \
Expand Down

0 comments on commit 4fc20f6

Please sign in to comment.