@@ -69,6 +69,7 @@ helpme ()
69
69
printf " \t-r: release build (no -g, DIAGNOSTIC, etc.). default: no\n"
70
70
printf " \t-D: increase debugginess. default: -O2 -g\n"
71
71
printf " \t-k: only kernel (no POSIX hypercalls). default: all\n"
72
+ printf " \t-l: choose a rumpkernel: netbsd or linux. default: netbsd\n"
72
73
echo
73
74
printf " \t-H: ignore diagnostic checks (expert-only). default: no\n"
74
75
printf " \t-V: specify -V arguments to NetBSD build (expert-only)\n"
@@ -289,19 +290,6 @@ doesitcxx ()
289
290
-x c++ - -o /dev/null $* > /dev/null 2>&1
290
291
}
291
292
292
- checkcheckout ()
293
- {
294
-
295
- [ -x " ${SRCDIR} /build.sh" ] || die " Cannot find ${SRCDIR} /build.sh!"
296
-
297
- [ ! -z " ${TARBALLMODE} " ] && return
298
-
299
- if ! ${BRDIR} /checkout.sh checkcheckout ${SRCDIR} \
300
- && ! ${TITANMODE} ; then
301
- die ' revision mismatch, run checkout (or -H to override)'
302
- fi
303
- }
304
-
305
293
checkcompiler ()
306
294
{
307
295
@@ -556,6 +544,7 @@ int main() {gzopen(NULL, NULL); return 0;}' -lz \
556
544
else
557
545
cppname=cpp
558
546
fi
547
+ # NB: we need rumpmake to build libbmk_*, but rumpmake needs --netbsd TOOLTUPLES
559
548
tname=${BRTOOLDIR} /bin/${MACHINE_GNU_ARCH} --netbsd${TOOLABI} -${cppname}
560
549
printf ' #!/bin/sh\n\nexec %s -E -x c "${@}"\n' ${CC} > ${tname}
561
550
chmod 755 ${tname}
616
605
appendmkconf Cmd yes RUMPKERN_ONLY
617
606
fi
618
607
619
- if ${KERNONLY} && ! cppdefines __NetBSD__ ; then
620
- appendmkconf ' Cmd' ' -D__NetBSD__ ' ' CPPFLAGS' +
608
+ if ${KERNONLY} && ! cppdefines ${RUMPKERN_CPPFLAGS} ; then
609
+ appendmkconf ' Cmd' " ${RUMPKERN_CPPFLAGS} " ' CPPFLAGS' +
621
610
appendmkconf ' Probe' " ${RUMPKERN_UNDEF} " ' CPPFLAGS' +
622
611
else
623
612
appendmkconf ' Probe' " ${RUMPKERN_UNDEF} " " RUMPKERN_UNDEF"
654
643
exec 3>&1 1> ${BRTOOLDIR} /toolchain-conf.mk
655
644
printf ' BUILDRUMP_TOOL_CFLAGS=%s\n' " ${EXTRA_CFLAGS} "
656
645
printf ' BUILDRUMP_TOOL_CXXFLAGS=%s\n' " ${EXTRA_CFLAGS} "
657
- printf ' BUILDRUMP_TOOL_CPPFLAGS=-D__NetBSD__ %s %s\n' \
658
- " ${EXTRA_CPPFLAGS} " " ${RUMPKERN_UNDEF} "
646
+ printf ' BUILDRUMP_TOOL_CPPFLAGS=%s %s %s\n' \
647
+ " ${RUMPKERN_CPPFLAGS} " " ${ EXTRA_CPPFLAGS}" " ${RUMPKERN_UNDEF} "
659
648
exec 1>&3 3>& -
660
649
661
650
chkcrt begins
@@ -754,120 +743,6 @@ makemake ()
754
743
[ $? -ne 0 ] && die build.sh ${cmd} failed
755
744
}
756
745
757
- makebuild ()
758
- {
759
-
760
- checkcheckout
761
-
762
- # ensure we're in SRCDIR, in case "tools" wasn't run
763
- cd ${SRCDIR}
764
-
765
- targets=" obj includes dependall install"
766
-
767
- #
768
- # Building takes 4 passes, just like when
769
- # building NetBSD the regular way. The passes are:
770
- # 1) obj
771
- # 2) includes
772
- # 3) dependall
773
- # 4) install
774
- #
775
-
776
- DIRS_first=' lib/librumpuser'
777
- DIRS_second=' lib/librump'
778
- DIRS_third=" lib/librumpdev lib/librumpnet lib/librumpvfs
779
- sys/rump/dev sys/rump/fs sys/rump/kern sys/rump/net
780
- sys/rump/include ${BRDIR} /brlib"
781
-
782
- # sys/rump/share was added to ${SRCDIR} 11/2014
783
- [ -d ${SRCDIR} /sys/rump/share ] \
784
- && appendvar DIRS_second ${SRCDIR} /sys/rump/share
785
-
786
- if [ ${MACHINE} = " i386" -o ${MACHINE} = " amd64" \
787
- -o ${MACHINE# evbearm} != ${MACHINE} \
788
- -o ${MACHINE# evbppc} != ${MACHINE} ]; then
789
- DIRS_emul=sys/rump/kern/lib/libsys_linux
790
- fi
791
- ${SYS_SUNOS} && appendvar DIRS_emul sys/rump/kern/lib/libsys_sunos
792
- if ${HIJACK} ; then
793
- DIRS_final=" lib/librumphijack"
794
- else
795
- DIRS_final=
796
- fi
797
-
798
- DIRS_third=" ${DIRS_third} ${DIRS_emul} "
799
-
800
- if ${KERNONLY} ; then
801
- mkmakefile ${OBJDIR} /Makefile.all \
802
- sys/rump ${DIRS_emul} ${BRDIR} /brlib
803
- else
804
- DIRS_third=" lib/librumpclient ${DIRS_third} "
805
-
806
- mkmakefile ${OBJDIR} /Makefile.first ${DIRS_first}
807
- mkmakefile ${OBJDIR} /Makefile.second ${DIRS_second}
808
- mkmakefile ${OBJDIR} /Makefile.third ${DIRS_third}
809
- mkmakefile ${OBJDIR} /Makefile.final ${DIRS_final}
810
- mkmakefile ${OBJDIR} /Makefile.all \
811
- ${DIRS_first} ${DIRS_second} ${DIRS_third} ${DIRS_final}
812
- fi
813
-
814
- # try to minimize the amount of domake invocations. this makes a
815
- # difference especially on systems with a large number of slow cores
816
- for target in ${targets} ; do
817
- if [ ${target} = " dependall" ] && ! ${KERNONLY} ; then
818
- domake ${OBJDIR} /Makefile.first ${target}
819
- domake ${OBJDIR} /Makefile.second ${target}
820
- domake ${OBJDIR} /Makefile.third ${target}
821
- domake ${OBJDIR} /Makefile.final ${target}
822
- else
823
- domake ${OBJDIR} /Makefile.all ${target}
824
- fi
825
- done
826
-
827
- if ! ${KERNONLY} ; then
828
- mkmakefile ${OBJDIR} /Makefile.utils \
829
- usr.bin/rump_server usr.bin/rump_allserver \
830
- usr.bin/rump_wmd
831
- for target in ${targets} ; do
832
- domake ${OBJDIR} /Makefile.utils ${target}
833
- done
834
- fi
835
- }
836
-
837
- makeinstall ()
838
- {
839
-
840
- # ensure we run this in a directory that does not have a
841
- # Makefile that could confuse rumpmake
842
- stage=$( cd ${BRTOOLDIR} && ${RUMPMAKE} -V ' ${BUILDRUMP_STAGE}' )
843
- (cd ${stage} /usr ; tar -cf - .) | (cd ${DESTDIR} ; tar -xf -)
844
- }
845
-
846
- #
847
- # install kernel headers.
848
- # Note: Do _NOT_ do this unless you want to install a
849
- # full rump kernel application stack
850
- #
851
- makekernelheaders ()
852
- {
853
-
854
- dodirs=$( cd ${SRCDIR} /sys && \
855
- ${RUMPMAKE} -V ' ${SUBDIR:Narch:Nmodules:Ncompat:Nnetnatm}' includes)
856
- # missing some architectures
857
- appendvar dodirs arch/amd64/include arch/i386/include arch/x86/include
858
- appendvar dodirs arch/arm/include arch/arm/include/arm32
859
- appendvar dodirs arch/evbarm64/include arch/aarch64/include
860
- appendvar dodirs arch/evbppc/include arch/powerpc/include
861
- appendvar dodirs arch/evbmips/include arch/mips/include
862
- appendvar dodirs arch/riscv/include
863
- for dir in ${dodirs} ; do
864
- (cd ${SRCDIR} /sys/${dir} && ${RUMPMAKE} obj)
865
- (cd ${SRCDIR} /sys/${dir} && ${RUMPMAKE} includes)
866
- done
867
- # create machine symlink
868
- (cd ${SRCDIR} /sys/arch && ${RUMPMAKE} NOSUBDIR=1 includes)
869
- }
870
-
871
746
settool ()
872
747
{
873
748
@@ -1036,7 +911,9 @@ evaltoolchain ()
1036
911
1037
912
case ${CC_TARGET} in
1038
913
* -linux* )
1039
- RUMPKERN_UNDEF=' -Ulinux -U__linux -U__linux__ -U__gnu_linux__'
914
+ if [ ${RUMPKERNEL} != " linux" ]; then
915
+ RUMPKERN_UNDEF=' -Ulinux -U__linux -U__linux__ -U__gnu_linux__'
916
+ fi
1040
917
cppdefines _BIG_ENDIAN \
1041
918
&& appendvar RUMPKERN_UNDEF -U_BIG_ENDIAN
1042
919
cppdefines _LITTLE_ENDIAN \
@@ -1353,12 +1230,14 @@ parseargs ()
1353
1230
NOISE=2
1354
1231
debugginess=0
1355
1232
KERNONLY=false
1233
+ RUMPKERNEL=netbsd
1356
1234
OBJDIR=./obj
1357
1235
DESTDIR=./rump
1358
1236
SRCDIR=./src
1237
+ LKL_SRCDIR=./linux
1359
1238
JNUM=4
1360
1239
1361
- while getopts ' d:DhHj:ko :qrs:T:V:F:' opt; do
1240
+ while getopts ' d:DhHj:kl:o :qrs:T:V:F:' opt; do
1362
1241
case " $opt " in
1363
1242
d)
1364
1243
DESTDIR=${OPTARG}
@@ -1419,6 +1298,9 @@ parseargs ()
1419
1298
k)
1420
1299
KERNONLY=true
1421
1300
;;
1301
+ l)
1302
+ RUMPKERNEL=${OPTARG}
1303
+ ;;
1422
1304
o)
1423
1305
OBJDIR=${OPTARG}
1424
1306
;;
@@ -1451,6 +1333,14 @@ parseargs ()
1451
1333
done
1452
1334
shift $(( ${OPTIND} - 1 ))
1453
1335
1336
+ # load rump kernel specific scripts
1337
+ if [ ${RUMPKERNEL} != " netbsd" -a ${RUMPKERNEL} != " linux" ]; then
1338
+ echo ' >> ERROR:'
1339
+ echo ' >> -l option (RUMPKERNEL) must be netbsd or linux'
1340
+ exit 1
1341
+ fi
1342
+ . ${BRDIR} /${RUMPKERNEL} .sh
1343
+
1454
1344
DBG=" ${F_DBG:- ${DBG} } "
1455
1345
1456
1346
BEQUIET=" -N${NOISE} "
@@ -1508,6 +1398,10 @@ parseargs ()
1508
1398
docheckout=true
1509
1399
checkoutstyle=cvs
1510
1400
fi
1401
+ if ${docheckout} && [ ${RUMPKERNEL} = " linux" ] ; then
1402
+ docheckout=true
1403
+ checkoutstyle=linux-git
1404
+ fi
1511
1405
1512
1406
# sanity checks
1513
1407
if [ ! -z " ${TARBALLMODE} " ]; then
@@ -1542,6 +1436,7 @@ resolvepaths ()
1542
1436
1543
1437
abspath BRTOOLDIR
1544
1438
abspath SRCDIR
1439
+ [ " ${RUMPKERNEL} " = " linux" ] && abspath LKL_SRCDIR
1545
1440
1546
1441
RUMPMAKE=" ${BRTOOLDIR} /bin/brrumpmake"
1547
1442
BRIMACROS=" ${BRTOOLDIR} /include/opt_buildrump.h"
@@ -1572,40 +1467,7 @@ resolvepaths ()
1572
1467
done
1573
1468
}
1574
1469
1575
- # create the makefiles used for building
1576
- mkmakefile ()
1577
- {
1578
1470
1579
- makefile=$1
1580
- shift
1581
- exec 3>&1 1> ${makefile}
1582
- printf ' # GENERATED FILE, MIGHT I SUGGEST NOT EDITING?\n'
1583
- printf ' SUBDIR='
1584
- for dir in $* ; do
1585
- case ${dir} in
1586
- /* )
1587
- printf ' %s' ${dir}
1588
- ;;
1589
- * )
1590
- printf ' %s' ${SRCDIR} /${dir}
1591
- ;;
1592
- esac
1593
- done
1594
-
1595
- printf ' \n.include <bsd.subdir.mk>\n'
1596
- exec 1>&3 3>& -
1597
- }
1598
-
1599
- domake ()
1600
- {
1601
-
1602
- mkfile=${1} ; shift
1603
- mktarget=${1} ; shift
1604
-
1605
- [ ! -x ${RUMPMAKE} ] && die " No rumpmake (${RUMPMAKE} ). Forgot tools?"
1606
- ${RUMPMAKE} $* -j ${JNUM} -f ${mkfile} ${mktarget}
1607
- [ $? -eq 0 ] || die " make $mkfile $mktarget "
1608
- }
1609
1471
1610
1472
# ##
1611
1473
# ##
@@ -1624,7 +1486,7 @@ done
1624
1486
1625
1487
parseargs " $@ "
1626
1488
1627
- ${docheckout} && { ${BRDIR} /checkout.sh ${checkoutstyle} ${SRCDIR} || exit 1; }
1489
+ ${docheckout} && { ${BRDIR} /checkout.sh ${checkoutstyle} ${SRCDIR} ${LKL_SRCDIR} || exit 1; }
1628
1490
1629
1491
if ${doprobe} || ${dotools} || ${dobuild} || ${dokernelheaders} \
1630
1492
|| ${doinstall} || ${dotests} ; then
@@ -1635,20 +1497,14 @@ if ${doprobe} || ${dotools} || ${dobuild} || ${dokernelheaders} \
1635
1497
1636
1498
${KERNONLY} || evalplatform
1637
1499
1500
+ export RUMPKERNEL
1638
1501
${doprobe} && writeproberes
1639
1502
${dotools} && maketools
1640
1503
${dobuild} && makebuild
1641
1504
${dokernelheaders} && makekernelheaders
1642
1505
${doinstall} && makeinstall
1643
1506
1644
- if ${dotests} ; then
1645
- if ${KERNONLY} ; then
1646
- diagout ' Kernel-only; skipping tests (no hypervisor)'
1647
- else
1648
- . ${BRDIR} /tests/testrump.sh
1649
- alltests
1650
- fi
1651
- fi
1507
+ ${dotests} && maketests
1652
1508
fi
1653
1509
1654
1510
diagout buildrump.sh ran successfully
0 commit comments