[gnome-ostree] 3.6: Switch to dracut upstream
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-ostree] 3.6: Switch to dracut upstream
- Date: Mon, 1 Oct 2012 21:11:54 +0000 (UTC)
commit 769b1646598f836c898df876e3afb6069e33c323
Author: Colin Walters <walters verbum org>
Date: Mon Oct 1 17:10:39 2012 -0400
3.6: Switch to dracut upstream
This fixes a variety of issues; for example, udev now gets started
correctly from the initramfs, and that means booting with root=UUID=
now works.
gnomeos-3.6.json | 7 +-
patches/dracut-Support-OSTree.patch | 164 ++++++++++++++++++++
...ut-build-Add-disable-documentation-option.patch | 93 +++++++++++
3 files changed, 261 insertions(+), 3 deletions(-)
---
diff --git a/gnomeos-3.6.json b/gnomeos-3.6.json
index aca649c..cb45ff5 100644
--- a/gnomeos-3.6.json
+++ b/gnomeos-3.6.json
@@ -859,9 +859,10 @@
{"src": "git:git://git.kernel.org/pub/scm/utils/dash/dash.git"},
- {"src": "cgwalters:dracut",
- "branch": "ostree4",
- "config-opts": ["--disable-documentation"]},
+ {"src": "git:git://git.kernel.org/pub/scm/boot/dracut/dracut.git",
+ "config-opts": ["--disable-documentation"],
+ "patches": ["dracut-build-Add-disable-documentation-option.patch",
+ "dracut-Support-OSTree.patch"]},
{"src": "git:git://git.cairographics.org/git/py2cairo",
"patches": ["py2cairo-autogen.patch"]},
diff --git a/patches/dracut-Support-OSTree.patch b/patches/dracut-Support-OSTree.patch
new file mode 100644
index 0000000..33c49ba
--- /dev/null
+++ b/patches/dracut-Support-OSTree.patch
@@ -0,0 +1,164 @@
+From cf59b7d7258fcf1cd8270dd257f2c5f04d63be8e Mon Sep 17 00:00:00 2001
+From: Colin Walters <walters verbum org>
+Date: Mon, 24 Oct 2011 22:01:17 -0400
+Subject: [PATCH] Support OSTree
+
+If the kernel command line includes an "ostree=foo" argument, assume
+we're booting using OSTree.
+
+We now need to differentiate between the place where we mounted the
+root filesystem (/sysroot) and the target operating system
+(e.g. /sysroot/ostree/gnomeos-3.4-i686-5da77e290). Because most
+things in dracut check the operating system $NEWROOT, we set
+
+NEWROOT_MOUNTPOINT=/sysroot
+NEWROOT=/sysroot/ostree/gnomeos-3.4-i686-5da77e290
+
+This required changing only the rootfs-block module basically.
+
+Conflicts:
+ modules.d/95rootfs-block/mount-root.sh
+---
+ modules.d/95rootfs-block/mount-root.sh | 14 +++++++-------
+ modules.d/99base/init.sh | 27 ++++++++++++++++++++-------
+ modules.d/99base/module-setup.sh | 4 ++++
+ 3 files changed, 31 insertions(+), 14 deletions(-)
+
+diff --git a/modules.d/95rootfs-block/mount-root.sh b/modules.d/95rootfs-block/mount-root.sh
+index 0467a55..0ab084a 100755
+--- a/modules.d/95rootfs-block/mount-root.sh
++++ b/modules.d/95rootfs-block/mount-root.sh
+@@ -27,8 +27,8 @@ mount_root() {
+
+ _rflags_ro="$rflags,ro"
+
+- while ! mount -t ${rootfs} -o "$_rflags_ro" "${root#block:}" "$NEWROOT"; do
+- warn "Failed to mount -t ${rootfs} -o $_rflags_ro ${root#block:} $NEWROOT"
++ while ! mount -t ${rootfs} -o "$_rflags_ro" "${root#block:}" "$NEWROOT_MOUNTPOINT"; do
++ warn "Failed to mount -t ${rootfs} -o $_rflags_ro ${root#block:} $NEWROOT_MOUNTPOINT"
+ fsck_ask_err
+ done
+
+@@ -111,21 +111,21 @@ mount_root() {
+ [ "$rootfsck" != "0" -a -z "$fastboot" -a "$READONLY" != "yes" ] && \
+ ! strstr "${rflags}" _netdev && \
+ ! getargbool 0 rd.skipfsck; then
+- umount "$NEWROOT"
++ umount "$NEWROOT_MOUNTPOINT"
+ fsck_single "${root#block:}" "$rootfs" "$rflags" "$fsckoptions"
+ _ret=$?
+ [ $_ret -ne 255 ] && echo $_ret >/run/initramfs/root-fsck
+ ran_fsck=1
+ fi
+
+- echo "${root#block:} $NEWROOT $rootfs ${rflags:-defaults} 0 $rootfsck" >> /etc/fstab
++ echo "${root#block:} $NEWROOT_MOUNTPOINT $rootfs ${rflags:-defaults} 0 $rootfsck" >> /etc/fstab
+
+- if ! ismounted "$NEWROOT"; then
++ if ! ismounted "$NEWROOT_MOUNTPOINT"; then
+ info "Mounting ${root#block:} with -o ${rflags}"
+- mount "$NEWROOT" 2>&1 | vinfo
++ mount "$NEWROOT_MOUNTPOINT" 2>&1 | vinfo
+ elif ! are_lists_eq , "$rflags" "$_rflags_ro" defaults; then
+ info "Remounting ${root#block:} with -o ${rflags}"
+- mount -o remount "$NEWROOT" 2>&1 | vinfo
++ mount -o remount "$NEWROOT_MOUNTPOINT" 2>&1 | vinfo
+ fi
+
+ if ! getargbool 0 rd.skipfsck; then
+diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
+index 16c8958..502af09 100755
+--- a/modules.d/99base/init.sh
++++ b/modules.d/99base/init.sh
+@@ -200,6 +200,14 @@ unset queuetriggered
+ unset main_loop
+ unset RDRETRY
+
++ostree=$(getarg ostree=)
++if test -n $ostree; then
++ NEWROOT_MOUNTPOINT=${NEWROOT}
++ NEWROOT=${NEWROOT}/ostree/$ostree
++else
++ NEWROOT_MOUNTPOINT=$NEWROOT
++fi
++
+ # pre-mount happens before we try to mount the root filesystem,
+ # and happens once.
+ getarg 'rd.break=pre-mount' -d 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
+@@ -211,16 +219,17 @@ getarg 'rd.break=mount' -d 'rdbreak=mount' && emergency_shell -n mount "Break mo
+ # be sourced any number of times. As soon as one suceeds, no more are sourced.
+ i=0
+ while :; do
+- if ismounted "$NEWROOT"; then
++ if ismounted "$NEWROOT_MOUNTPOINT"; then
++ echo "Checking usable $NEWROOT"
+ usable_root "$NEWROOT" && break;
+ umount "$NEWROOT"
+ fi
+ for f in $hookdir/mount/*.sh; do
+ [ -f "$f" ] && . "$f"
+- if ismounted "$NEWROOT"; then
++ if ismounted "$NEWROOT_MOUNTPOINT"; then
+ usable_root "$NEWROOT" && break;
+ warn "$NEWROOT has no proper rootfs layout, ignoring and removing offending mount hook"
+- umount "$NEWROOT"
++ umount "$NEWROOT_MOUNTPOINT"
+ rm -f "$f"
+ fi
+ done
+@@ -232,7 +241,7 @@ done
+
+ {
+ echo -n "Mounted root filesystem "
+- while read dev mp rest; do [ "$mp" = "$NEWROOT" ] && echo $dev; done < /proc/mounts
++ while read dev mp rest; do [ "$mp" = "$NEWROOT_MOUNTPOINT" ] && echo $dev; done < /proc/mounts
+ } | vinfo
+
+ # pre pivot scripts are sourced just before we doing cleanup and switch over
+@@ -347,7 +356,11 @@ info "Switching root"
+ unset PS4
+
+ CAPSH=$(command -v capsh)
+-SWITCH_ROOT=$(command -v switch_root)
++if test -n "${ostree}"; then
++ SWITCH_ROOT=$(command -v ostree-switch-root)
++else
++ SWITCH_ROOT=$(command -v switch_root)
++fi
+ PATH=$OLDPATH
+ export PATH
+
+@@ -359,13 +372,13 @@ if [ -f /etc/capsdrop ]; then
+ -c "exec switch_root \"$NEWROOT\" \"$INIT\" $initargs" || \
+ {
+ warn "Command:"
+- warn capsh --drop=$CAPS_INIT_DROP -- -c exec switch_root "$NEWROOT" "$INIT" $initargs
++ warn capsh --drop=$CAPS_INIT_DROP -- -c exec switch_root "$NEWROOT_MOUNTPOINT" "$INIT" $initargs
+ warn "failed."
+ emergency_shell
+ }
+ else
+ unset RD_DEBUG
+- exec $SWITCH_ROOT "$NEWROOT" "$INIT" $initargs || {
++ exec $SWITCH_ROOT "$NEWROOT_MOUNTPOINT" $ostree "$INIT" $initargs || {
+ warn "Something went very badly wrong in the initramfs. Please "
+ warn "file a bug against dracut."
+ emergency_shell
+diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh
+index 2bcb6a1..fec8605 100755
+--- a/modules.d/99base/module-setup.sh
++++ b/modules.d/99base/module-setup.sh
+@@ -40,6 +40,10 @@ install() {
+ mkdir -p ${initdir}/tmp
+
+ dracut_install switch_root || dfatal "Failed to install switch_root"
++ ostree_switch_root=$(command -v ostree-switch-root)
++ if test -n "${ostree_switch_root}"; then
++ dracut_install ${ostree_switch_root} || dfatal "Failed to install ${ostree_switch_root}"
++ fi
+
+ inst_simple "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh"
+
+--
+1.7.11.4
+
diff --git a/patches/dracut-build-Add-disable-documentation-option.patch b/patches/dracut-build-Add-disable-documentation-option.patch
new file mode 100644
index 0000000..e1e6eb0
--- /dev/null
+++ b/patches/dracut-build-Add-disable-documentation-option.patch
@@ -0,0 +1,93 @@
+From 084c293a27d207f816b15ee0335dd297a2d25473 Mon Sep 17 00:00:00 2001
+From: Colin Walters <walters verbum org>
+Date: Tue, 7 Feb 2012 13:53:58 -0500
+Subject: [PATCH] build: Add --disable-documentation option
+
+Some operating system builders may not want to build documention, for
+example during a bootstrapping process.
+
+Conflicts:
+ Makefile
+ configure
+---
+ Makefile | 9 ++++++++-
+ configure | 4 ++++
+ 2 files changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index d04d3dd..57431a8 100644
+--- a/Makefile
++++ b/Makefile
+@@ -10,6 +10,7 @@ pkglibdir ?= ${libdir}/dracut
+ sysconfdir ?= ${prefix}/etc
+ bindir ?= ${prefix}/bin
+ mandir ?= ${prefix}/share/man
++enable_documentation ?= yes
+ CFLAGS ?= -O2 -g -Wall
+ CFLAGS += -std=gnu99
+
+@@ -61,6 +62,10 @@ indent:
+
+ doc: $(manpages) dracut.html
+
++ifneq ($(enable_documentation),no)
++all: doc
++endif
++
+ %: %.xml
+ xsltproc -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
+
+@@ -76,7 +81,7 @@ dracut.html: dracut.asc $(manpages)
+ http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
+ rm dracut.xml
+
+-install: doc dracut-version.sh
++install: dracut-version.sh
+ mkdir -p $(DESTDIR)$(pkglibdir)
+ mkdir -p $(DESTDIR)$(bindir)
+ mkdir -p $(DESTDIR)$(sysconfdir)
+@@ -94,11 +99,13 @@ install: doc dracut-version.sh
+ install -m 0755 dracut-logger.sh $(DESTDIR)$(pkglibdir)/dracut-logger.sh
+ install -m 0755 dracut-initramfs-restore.sh $(DESTDIR)$(pkglibdir)/dracut-initramfs-restore
+ cp -arx modules.d $(DESTDIR)$(pkglibdir)
++ifneq ($(enable_documentation),no)
+ for i in $(man1pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man1/$${i##*/}; done
+ for i in $(man5pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man5/$${i##*/}; done
+ for i in $(man7pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man7/$${i##*/}; done
+ for i in $(man8pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man8/$${i##*/}; done
+ ln -fs dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.kernel.7
++endif
+ if [ -n "$(systemdsystemunitdir)" ]; then \
+ mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
+ install -m 0644 dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir); \
+diff --git a/configure b/configure
+index 8632398..dfac38b 100755
+--- a/configure
++++ b/configure
+@@ -7,6 +7,8 @@ echo \#buildapi-variable-no-builddir >/dev/null
+
+ prefix=/usr
+
++enable_documentation=yes
++
+ # Little helper function for reading args from the commandline.
+ # it automatically handles -a b and -a=b variants, and returns 1 if
+ # we need to shift $3.
+@@ -33,6 +35,7 @@ while (($# > 0)); do
+ --sysconfdir) read_arg sysconfdir "$@" || shift;;
+ --sbindir) read_arg sbindir "$@" || shift;;
+ --mandir) read_arg mandir "$@" || shift;;
++ --disable-documentation) enable_documentation=no;;
+ *) echo "Ignoring unknown option '$1'";;
+ esac
+ shift
+@@ -45,5 +48,6 @@ datadir ?= ${datadir:-${prefix}/share}
+ sysconfdir ?= ${sysconfdir:-${prefix}/etc}
+ sbindir ?= ${sbindir:-${prefix}/sbin}
+ mandir ?= ${mandir:-${prefix}/share/man}
++enable_documentation ?= ${enable_documentation}
+ EOF
+ mv Makefile.inc.tmp Makefile.inc
+--
+1.7.11.4
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]