[CUWiN-Dev] Modifications to mkstaboot
Matt Isaacs
isaacsm at cuwireless.net
Wed Sep 20 14:43:36 CDT 2006
I've made some modifications to mkstaboot that allow the passing of the -j
option to build.sh. The -j option will allow one to control the number of
processes running in parallel, thus allowing the build process (at least the
NetBSD portion) to take advantage of multi-core/CPU systems. This option is
specified by passing -j NJOBS to mkstaboot, where NJOBS is the number of
processes you want to run in parallel. There are a couple of caveats (I'm
open to suggestions on how to fix them). First, the -j parameter cannot be
the last parameter passed. If it is, the script interprets its parameter as
an argument and fails. Second, the -j option to build.sh/make disables
compatibility mode. Compatibility mode can be renabled by explicitly
passing make the -B parameter, which I haven't figured out how to do yet.
A minor change I made was the addition of a -h option, to print the usage
information for mkstaboot. Since the addition of automatic error trapping,
the script exits without printing this. This provides a means to get to
this usage info from the command line (though not automatic like it is
without the trapping). It also provides a familar mnemonic to get help for
those new to using mkstaboot.
The diff listed at the end of this message.
--
Matthew Isaacs
CUWiN Network Engineer
===BEGIN mkstaboot DIFF===
Index: mkstaboot
===================================================================
--- mkstaboot (revision 4237)
+++ mkstaboot (working copy)
@@ -149,6 +149,14 @@
-i iso Write an ISO9660 image of the system suitable
for a 386/486/Pentium PC to the file <iso>.
+
+ -j Passes -j njob to build.sh; sets number of jobs to run in parallel
+ Suggested values range from 1 more than the number of CPUs in your
system
+ to 4 times the number of CPUs in your system.
+ NOTE: Must not be the last option on the command line;
+ It also disables compatibility mode
+ (see http://www.netbsd.org/guide/en/chap-build.html).
+ Compatibility mode may be re-enabled passing the -B option to
make.
-K nfs-kernel Write the kernel for NFS root to nfs-kernel.
@@ -212,7 +220,7 @@
EXTSRC 3rd-party sources [${EXTSRC:-undefined}]
EOF
- exit 1
+ exit 0
}
CUWSRC=$(absolutize $CUWSRC)
@@ -226,7 +234,7 @@
build_clean=clean
build_obj=obj
-opts=$(getopt a:b:c:C:E:e:f:F:i:K:k:Ll:N:n:M:m:OoP:p:Ss:t:T:uU:x: $*)
+opts=$(getopt :a:b:c:C:E:e:f:F:hi:j:K:k:Ll:N:n:M:m:OoP:p:Ss:t:T:uU:x: $*)
if [ $? -ne 0 ]; then
usage
@@ -268,24 +276,19 @@
CUW_TARGET_BASE=${FLASHDEV%%.img}
shift
;;
- -l) # NFS client IP
- NFS_CLIENT_IP=$2
- shift
- ;;
- -n) # NFS server, ip:path
- NFS_SERVER=$2
- if ! echo $NFS_SERVER | \
- grep -Eq ${NFS_SERVER_REGEX} >/dev/null 2>/dev/null; then
- bomb "$proggie: malformed NFS server"
- usage
- fi
- shift
- ;;
+ -h) # Print usage
+ usage
+ ;;
-i) # ISO output filename
ISO=$(absolutize $2)
CUW_TARGET_BASE=${ISO%%.iso}
shift
;;
+ -j) # Pass -j njob to build.sh --> tweaks compile for multi-cpus
+ # fails if its the last option passed (no clue why-->gives invalid
arg on its option)
+ NJOBS=$2
+ shift
+ ;;
-K) # output file for kernel w/ NFS root
NFSKERNEL=$(absolutize $2)
shift
@@ -293,6 +296,10 @@
-k) OVERRIDE_KERNEL=$(absolutize $2)
shift
;;
+ -l) # NFS client IP
+ NFS_CLIENT_IP=$2
+ shift
+ ;;
-M) # output file for kernel w/ memory-disk root
MDIMAGE=$(absolutize $2)
CUW_TARGET_BASE=${MDIMAGE%%.md}
@@ -308,6 +315,15 @@
CUW_TARGET_BASE=${TAR%%.tgz}
shift
;;
+ -n) # NFS server, ip:path
+ NFS_SERVER=$2
+ if ! echo $NFS_SERVER | \
+ grep -Eq ${NFS_SERVER_REGEX} >/dev/null 2>/dev/null; then
+ bomb "$proggie: malformed NFS server"
+ usage
+ fi
+ shift
+ ;;
-o) BUILD_SH_OPTS="$BUILD_SH_OPTS -o"
build_obj=
;;
@@ -423,6 +439,10 @@
if [ ${MACHINE_ARCH:-none} != none ]; then
BUILD_SH_OPTS="${BUILD_SH_OPTS} -a ${MACHINE_ARCH}"
fi
+if [ ${NJOBS:-none} != none ]; then
+ BUILD_SH_OPTS="${BUILD_SH_OPTS} -j ${NJOBS}"
+fi
+
BUILD_SH_OPTS="${BUILD_SH_OPTS} ${BUILD_SH_LOWFAT}"
BUILD_SH="sh build.sh ${BUILD_SH_OPTS}"
===END mkstaboot DIFF===
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.chambana.net/mailman/archive/cu-wireless-dev/attachments/20060920/61968de8/attachment.htm
More information about the CU-Wireless-Dev
mailing list