Permalink
Browse files

OS-2054 want platform to deliver GRUB in a separate bundle

  • Loading branch information...
1 parent c96131c commit 83c7d1d88b0c2e1d0b780b8337081fd5f7d89a35 @wesolows wesolows committed Mar 19, 2013
Showing with 54 additions and 30 deletions.
  1. +4 −0 .gitignore
  2. +39 −12 Makefile
  3. +10 −12 tools/build_manifest
  4. +1 −6 tools/sorter
View
4 .gitignore
@@ -3,6 +3,7 @@
/output
/projects
/proto
+/proto.boot
/proto.strap
/log
/src/*.o
@@ -43,6 +44,7 @@ man/man/man1m/dsadm.1m
man/man/man1m/imgadm.1m
man/man/man1m/vmadm.1m
man/man/man1m/vmadmd.1m
+man/man/man1m/sysinfo.1m
src/diskinfo
src/disklayout
src/mkzpool
@@ -55,7 +57,9 @@ src/node-zutil/build/
src/sdc-on-tty
tools/pwgen-2.06/Makefile
tools/pwgen-2.06/autom4te.cache
+boot.manifest.gen
manifest.gen
+boot.manifest.d/
manifest.d/
overlay/order
overlay/sdc
View
51 Makefile
@@ -1,11 +1,13 @@
#
-# Copyright (c) 2012, Joyent, Inc. All rights reserved.
+# Copyright (c) 2013, Joyent, Inc. All rights reserved.
#
ROOT = $(PWD)
PROTO = $(ROOT)/proto
STRAP_PROTO = $(ROOT)/proto.strap
MPROTO = $(ROOT)/manifest.d
+BOOT_MPROTO = $(ROOT)/boot.manifest.d
+BOOT_PROTO = $(ROOT)/proto.boot
ifeq ($(shell uname -s),Darwin)
PATH = /bin:/usr/bin:/usr/sbin:/sbin:/opt/local/bin
@@ -16,6 +18,7 @@ endif
LOCAL_SUBDIRS := $(shell ls projects/local)
OVERLAYS := $(shell cat overlay/order)
MANIFEST = manifest.gen
+BOOT_MANIFEST = boot.manifest.gen
JSSTYLE = $(ROOT)/tools/jsstyle/jsstyle
JSLINT = $(ROOT)/tools/javascriptlint/build/install/jsl
CSTYLE = $(ROOT)/tools/cstyle
@@ -30,20 +33,36 @@ WORLD_MANIFESTS := \
$(MPROTO)/live.manifest \
$(MPROTO)/illumos-extra.manifest
+BOOT_MANIFESTS := \
+ $(BOOT_MPROTO)/illumos.manifest
+
SUBDIR_MANIFESTS := $(LOCAL_SUBDIRS:%=$(MPROTO)/%.sd.manifest)
OVERLAY_MANIFESTS := $(OVERLAYS:$(ROOT)/overlay/%=$(MPROTO)/%.ov.manifest)
+BOOT_VERSION := boot-$(shell [[ -f $(ROOT)/configure-buildver ]] && \
+ echo $$(head -n1 $(ROOT)/configure-buildver)-)$(shell head -n1 $(STAMPFILE))
+BOOT_TARBALL := output/$(BOOT_VERSION).tgz
+
world: 0-extra-stamp 0-illumos-stamp 1-extra-stamp 0-livesrc-stamp \
0-local-stamp 0-tools-stamp 0-man-stamp 0-devpro-stamp
-live: world manifest
+live: world manifest boot
@echo $(OVERLAY_MANIFESTS)
@echo $(SUBDIR_MANIFESTS)
mkdir -p ${ROOT}/log
(cd $(ROOT) && \
pfexec ./tools/build_live $(ROOT)/$(MANIFEST) $(ROOT)/output \
$(OVERLAYS) $(ROOT)/proto $(ROOT)/man/man)
+boot: $(BOOT_TARBALL)
+
+$(BOOT_TARBALL): world manifest
+ pfexec rm -rf $(BOOT_PROTO)
+ mkdir -p $(BOOT_PROTO)
+ pfexec ./tools/builder/builder $(ROOT)/$(BOOT_MANIFEST) \
+ $(BOOT_PROTO) $(ROOT)/proto
+ (cd $(BOOT_PROTO) && pfexec gtar cf $(ROOT)/$@ .)
+
#
# Manifest construction. There are 5 sources for manifests we need to collect
# in $(MPROTO) before running the manifest tool. One each comes from
@@ -53,21 +72,27 @@ live: world manifest
# These all end up in $(MPROTO), where we tell tools/build_manifest to look;
# it will pick up every file in that directory and treat it as a manifest.
#
+# In addition, a separate manifest is generated in similar manner for the
+# boot tarball.
+#
# Look ma, no for loops in these shell fragments!
#
-manifest: $(MANIFEST)
+manifest: $(MANIFEST) $(BOOT_MANIFEST)
-$(MPROTO):
- mkdir -p $(MPROTO)
+$(MPROTO) $(BOOT_MPROTO):
+ mkdir -p $@
-$(MPROTO)/live.manifest: $(MPROTO) src/manifest
+$(MPROTO)/live.manifest: src/manifest | $(MPROTO)
gmake DESTDIR=$(MPROTO) DESTNAME=live.manifest \
-C src manifest
-$(MPROTO)/illumos.manifest: $(MPROTO) projects/illumos/manifest
+$(MPROTO)/illumos.manifest: projects/illumos/manifest | $(MPROTO)
cp projects/illumos/manifest $(MPROTO)/illumos.manifest
-$(MPROTO)/illumos-extra.manifest: $(MPROTO) 1-extra-stamp
+$(BOOT_MPROTO)/illumos.manifest: projects/illumos/manifest | $(BOOT_MPROTO)
+ cp projects/illumos/boot.manifest $(BOOT_MPROTO)/illumos.manifest
+
+$(MPROTO)/illumos-extra.manifest: 1-extra-stamp | $(MPROTO)
gmake DESTDIR=$(MPROTO) DESTNAME=illumos-extra.manifest \
-C projects/illumos-extra manifest; \
@@ -86,10 +111,12 @@ $(MPROTO)/%.ov.manifest: $(MPROTO) $(ROOT)/overlay/%/manifest
cp $(ROOT)/overlay/$*/manifest $@
$(MANIFEST): $(WORLD_MANIFESTS) $(SUBDIR_MANIFESTS) $(OVERLAY_MANIFESTS)
- -rm -f $(MANIFEST)
- ./tools/build_manifest
- ./tools/sorter manifest.gen > manifest.gen.sorted && \
- mv manifest.gen.sorted $@
+ -rm -f $@
+ ./tools/build_manifest $(MPROTO) | ./tools/sorter > $@
+
+$(BOOT_MANIFEST): $(BOOT_MANIFESTS)
+ -rm -f $@
+ ./tools/build_manifest $(BOOT_MPROTO) | ./tools/sorter > $@
#
# Update source code from parent repositories. We do this for each local
View
22 tools/build_manifest
@@ -19,7 +19,7 @@
#
# CDDL HEADER END
#
-# Copyright 2011, Joyent, Inc.
+# Copyright 2013 Joyent, Inc. All rights reserved.
shopt -s xpg_echo
@@ -29,9 +29,6 @@ shopt -s xpg_echo
unalias -a
bm_arg0=$(basename $0)
-bm_root=$(dirname $0)/..
-bm_mdir=$bm_root/manifest.d
-bm_man=$bm_root/manifest.gen
function fail
{
@@ -44,8 +41,6 @@ function fail
function validate
{
local count
- [[ -f $bm_man ]] && \
- fail "manifest file already exists: $bm_man"
[[ ! -d $bm_mdir ]] && \
fail "manifest snippet directory doesn't exist: $bm_mdir"
@@ -56,18 +51,21 @@ function validate
function build
{
- touch $bm_man || fail "failed to create $bm_man"
for file in $bm_mdir/*; do
- echo "Adding manifest files from $file... \c "
- cat $file >> $bm_man
+ echo "Adding manifest files from $file... \c " >&2
+ grep -v "^#" $file
[[ $? -eq 0 ]] || fail "failed to append to manifest"
- echo "done"
+ echo "done" >&2
done
- grep -v "^#" < $bm_man > $bm_man.tmp
[[ $? -eq 0 ]] || fail "failed to remove comments from manifest"
- mv -f $bm_man.tmp $bm_man
}
+if [[ -z "$1" ]]; then
+ fail "Manifest directory is required"
+fi
+
+bm_mdir=$1
+
validate
build
exit 0
View
7 tools/sorter
@@ -9,13 +9,8 @@ import os
import sys
files = {}
-filename = 'manifest'
-# if filename is passed as first argument, use that file instead
-if len(sys.argv) >= 2 and os.path.isfile(sys.argv[1]):
- filename = sys.argv[1]
-
-for line in open(filename).readlines():
+for line in sys.stdin.readlines():
line = line.strip()
if len(line) == 0 or line[0] == '#':
continue

0 comments on commit 83c7d1d

Please sign in to comment.