ostbuild: Major rework
This commit is contained in:
1 parent
b052758652
commit
717cec46c3
27 files changed
+1205
-353
No files matched your search
@@ -1,7 +1,10 @@
|
||||
{
|
||||
"name-prefix": "gnomeos-3.4",
|
||||
"prefix": "gnomeos-3.4",
|
||||
"architectures": ["i686"],
|
||||
"base-prefix": "yocto/gnomeos-3.4",
|
||||
"base": {
|
||||
"name": "yocto",
|
||||
"src": "cgwalters:poky"
|
||||
},
|
||||
|
||||
"config-opts": ["--disable-static", "--disable-silent-rules"],
|
||||
|
||||
@@ -25,13 +28,15 @@
|
||||
|
||||
"patches": {"src": "git:/src/ostree",
|
||||
"branch": "wip/ostbuild-v2",
|
||||
"prefix": "gnomeos/3.4"},
|
||||
"subdir": "gnomeos/3.4"},
|
||||
|
||||
"components": [
|
||||
{"src": "cgwalters:ginitscripts"},
|
||||
{"src": "cgwalters:ginitscripts",
|
||||
"noarch": true},
|
||||
|
||||
{"src": "gnome:gtk-doc-stub",
|
||||
"component": "devel"},
|
||||
"component": "devel",
|
||||
"noarch": true},
|
||||
|
||||
{"src": "git:git://github.com/atgreen/libffi.git"},
|
||||
|
||||
|
||||
+39
-3
@@ -16,6 +16,9 @@ base "runtime", and one "devel" with all of the development tools like
|
||||
gcc. We then import that into an OSTree branch
|
||||
e.g. "bases/yocto/gnomeos-3.4-i686-devel".
|
||||
|
||||
At present, it's still (mostly) possible to put this data on an ext4
|
||||
filesystem and boot into it.
|
||||
|
||||
We also have a Yocto recipe "ostree-native" which generates (as you
|
||||
might guess) a native binary of ostree. That binary is used to import
|
||||
into an "archive mode" OSTree repository. You can see it in
|
||||
@@ -26,26 +29,59 @@ can use "ostbuild" which uses "linux-user-chroot" to chroot inside,
|
||||
run a build on a source tree, and outputs binaries, which we then add
|
||||
to the build tree for the next module, and so on.
|
||||
|
||||
The final result of all of this is that the OSTree repository gains
|
||||
new commits (which can be downloaded by clients), while still
|
||||
retaining old build history.
|
||||
|
||||
Yocto details
|
||||
-------------
|
||||
|
||||
I have a branch of Yocto here:
|
||||
|
||||
https://github.com/cgwalters/poky
|
||||
|
||||
It has a collection of patches on top of the "Edison" release of
|
||||
Yocto, some of which are hacky, others upstreamable. The most
|
||||
important part though are the modifications to commit the generated
|
||||
root filesystem into OSTree.
|
||||
|
||||
ostbuild details
|
||||
----------------
|
||||
|
||||
The simple goal of ostbuild is that it only takes as input a
|
||||
"manifest" which is basically just a list of components to build. A
|
||||
component is a pure metadata file which includes the git repository
|
||||
"manifest" which is basically just a list of components to build. You
|
||||
can see this here:
|
||||
|
||||
http://git.gnome.org/browse/ostree/tree/gnomeos/3.4/gnomeos-3.4-src.json
|
||||
|
||||
A component is a pure metadata file which includes the git repository
|
||||
URL and branch name, as well as ./configure flags (--enable-foo).
|
||||
|
||||
There is no support for building from "tarballs" - I want the ability
|
||||
to review all of the code that goes in, and to efficiently store
|
||||
source code updates.
|
||||
source code updates. It's also just significantly easier from an
|
||||
implementation perspective, versus having to maintain a version
|
||||
control abstraction layer.
|
||||
|
||||
The result of a build of a component is an OSTree branch like
|
||||
"artifacts/gnomeos-3.4-i686-devel/libxslt/master". Then, a "compose"
|
||||
process merges together the individual filesystem trees into the final
|
||||
branches (e.g. gnomeos-3.4-i686-devel).
|
||||
|
||||
Doing local builds
|
||||
------------------
|
||||
|
||||
This is where you want to modify one (or a few) components on top of
|
||||
what comes from the ostree.gnome.org server, and test the result
|
||||
locally. I'm working on this.
|
||||
|
||||
Doing a full build on your system
|
||||
---------------------------------
|
||||
|
||||
Following this process is equivalent to what we have set up on the
|
||||
ostree.gnome.org build server. It will generate a completely new
|
||||
repository.
|
||||
|
||||
srcdir=/src
|
||||
builddir=/src/build
|
||||
|
||||
|
||||
@@ -46,17 +46,19 @@ if ! test -d /ostree/repo/objects; then
|
||||
mkdir -p /ostree
|
||||
|
||||
$SRCDIR/gnomeos-setup.sh /ostree
|
||||
|
||||
cd /ostree
|
||||
|
||||
ostree --repo=repo remote add gnome http://ostree.gnome.org/repo ${BRANCH_PREFIX}{runtime,devel}
|
||||
ostree-pull --repo=repo gnome
|
||||
for branch in runtime devel; do
|
||||
ostree --repo=repo checkout --atomic-retarget ${BRANCH_PREFIX}${branch}
|
||||
done
|
||||
ln -sf ${BRANCH_PREFIX}runtime current
|
||||
|
||||
cd ${WORKDIR}
|
||||
fi
|
||||
|
||||
cd /ostree
|
||||
|
||||
ostree --repo=repo remote add gnome http://ostree.gnome.org/repo ${BRANCH_PREFIX}{runtime,devel}
|
||||
ostree-pull --repo=repo gnome
|
||||
for branch in runtime devel; do
|
||||
ostree --repo=repo checkout --atomic-retarget ${BRANCH_PREFIX}${branch}
|
||||
done
|
||||
ln -sf ${BRANCH_PREFIX}runtime current
|
||||
|
||||
uname=$(uname -r)
|
||||
|
||||
if test -d /etc/grub.d; then
|
||||
|
||||
Executable
+74
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
# -*- indent-tabs-mode: nil; -*-
|
||||
# Create ostree-qemu.img file in the current directory, suitable
|
||||
# for booting via qemu.
|
||||
#
|
||||
# Copyright (C) 2011,2012 Colin Walters <walters@verbum.org>
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
SRCDIR=`dirname $0`
|
||||
WORKDIR=`pwd`
|
||||
|
||||
if test $(id -u) != 0; then
|
||||
cat <<EOF
|
||||
This script should be run as root.
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
usage () {
|
||||
echo "$0"
|
||||
exit 1
|
||||
}
|
||||
|
||||
OBJ=ostree-qemu.img
|
||||
if ! test -f ${OBJ}; then
|
||||
# Hardcoded 6 gigabyte filesystem size here; 6 gigabytes should be
|
||||
# enough for everybody.
|
||||
qemu-img create $OBJ 6G
|
||||
mkfs.ext4 -q -F $OBJ
|
||||
fi
|
||||
|
||||
mkdir -p fs
|
||||
umount fs || true
|
||||
sleep 1 # Avoid Linux kernel bug, pretty sure it's the new RCU pathname lookup
|
||||
mount -o loop ostree-qemu.img fs
|
||||
|
||||
cd fs
|
||||
|
||||
if ! test -d ./ostree/repo/objects; then
|
||||
mkdir -p ./ostree
|
||||
|
||||
$SRCDIR/gnomeos-setup.sh $(pwd)/ostree
|
||||
fi
|
||||
|
||||
mkdir -p ./run ./home ./root ./sys
|
||||
mkdir -p ./tmp
|
||||
chmod 01777 ./tmp
|
||||
|
||||
mkdir -p $(pwd)/ostree/modules
|
||||
rsync -a -H -v --delete /ostree/modules/ ./ostree/modules/
|
||||
|
||||
cd ..
|
||||
umount fs
|
||||
|
||||
cat << EOF
|
||||
Next, run gnomeos-qemu-pull.sh to copy data.
|
||||
EOF
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
# -*- indent-tabs-mode: nil; -*-
|
||||
# Run built image in QEMU
|
||||
#
|
||||
# Copyright (C) 2011,2012 Colin Walters <walters@verbum.org>
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
SRCDIR=`dirname $0`
|
||||
WORKDIR=`pwd`
|
||||
|
||||
if test $(id -u) != 0; then
|
||||
cat <<EOF
|
||||
This script should be run as root.
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
usage () {
|
||||
cat <<EOF
|
||||
usage: $0 SRC_REPO_PATH CURRENT_REF [REFS...]
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
SRC_REPO_PATH=$1
|
||||
test -n "$SRC_REPO_PATH" || usage
|
||||
shift
|
||||
|
||||
CURRENT_REF=$1
|
||||
test -n "$CURRENT_REF" || usage
|
||||
shift
|
||||
|
||||
if ! test -f ostree-qemu.img; then
|
||||
cat <<EOF
|
||||
ostree-qemu.img not found; You must run gnomeos-qemu-create.sh first
|
||||
EOF
|
||||
fi
|
||||
|
||||
mkdir -p fs
|
||||
umount fs || true
|
||||
sleep 1 # Avoid Linux kernel bug, pretty sure it's the new RCU pathname lookup
|
||||
mount -o loop ostree-qemu.img fs
|
||||
|
||||
cd fs
|
||||
ostree --repo=${SRC_REPO_PATH} local-clone ./ostree/repo ${CURRENT_REF} "$@"
|
||||
|
||||
cd ostree
|
||||
ostree --repo=./repo checkout --atomic-retarget ${CURRENT_REF}
|
||||
ln -sf ${CURRENT_REF} ${CURRENT_REF}.tmplink
|
||||
mv -T ${CURRENT_REF}.tmplink current
|
||||
|
||||
cd ${WORKDIR}
|
||||
umount fs
|
||||
@@ -33,62 +33,16 @@ EOF
|
||||
fi
|
||||
|
||||
usage () {
|
||||
echo "$0 OSTREE_REPO_PATH"
|
||||
echo "$0"
|
||||
exit 1
|
||||
}
|
||||
|
||||
ARCH=i686
|
||||
BRANCH_PREFIX="gnomeos-3.4-${ARCH}-"
|
||||
|
||||
OBJ=gnomeos-fs.img
|
||||
if ! test -f ${OBJ}; then
|
||||
cat <<EOF
|
||||
Create gnomeos-fs.img like this:
|
||||
$ qemu-img create gnomeos-fs.img 6G
|
||||
$ mkfs.ext4 -q -F gnomeos-fs.img
|
||||
EOF
|
||||
exit 1
|
||||
if ! test -f ostree-qemu.img; then
|
||||
echo "ostree-qemu.img not found; You must run gnomeos-qemu-create.sh first"
|
||||
fi
|
||||
|
||||
if ! test -d ${WORKDIR}/repo/objects; then
|
||||
cat <<EOF
|
||||
No ./repo/objects found
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p fs
|
||||
umount fs || true
|
||||
sleep 1 # Avoid Linux kernel bug, pretty sure it's the new RCU pathname lookup
|
||||
mount -o loop gnomeos-fs.img fs
|
||||
|
||||
cd fs
|
||||
|
||||
TOPROOT_BIND_MOUNTS="home root tmp"
|
||||
|
||||
for d in $TOPROOT_BIND_MOUNTS; do
|
||||
if ! test -d $d; then
|
||||
mkdir -m 0755 $d
|
||||
fi
|
||||
done
|
||||
chmod a=rwxt tmp
|
||||
|
||||
if ! test -d ostree; then
|
||||
mkdir -p ostree
|
||||
|
||||
$SRCDIR/gnomeos-setup.sh $(pwd)/ostree
|
||||
fi
|
||||
|
||||
rsync -a -H -v ${WORKDIR}/repo ${WORKDIR}/current ${WORKDIR}/modules ${WORKDIR}/var ${WORKDIR}/gnomeos-3.4-* ./ostree
|
||||
|
||||
current_uname=$(uname -r)
|
||||
|
||||
cd ${WORKDIR}
|
||||
|
||||
sync
|
||||
umount fs
|
||||
rmdir fs
|
||||
|
||||
ARGS="$@"
|
||||
if ! echo $ARGS | grep -q 'ostree='; then
|
||||
ARGS="ostree=current $ARGS"
|
||||
@@ -97,4 +51,4 @@ ARGS="rd.plymouth=0 root=/dev/sda $ARGS"
|
||||
KERNEL=/boot/vmlinuz-${current_uname}
|
||||
INITRD_ARG="-initrd /boot/initramfs-ostree-${current_uname}.img"
|
||||
|
||||
exec qemu-kvm -kernel ${KERNEL} ${INITRD_ARG} -hda gnomeos-fs.img -net user -net nic,model=virtio -m 512M -append "$ARGS" -monitor stdio
|
||||
exec qemu-kvm -kernel ${KERNEL} ${INITRD_ARG} -hda ostree-qemu.img -net user -net nic,model=virtio -m 512M -append "$ARGS" -monitor stdio
|
||||
@@ -58,6 +58,11 @@ fi
|
||||
|
||||
mkdir -p ./var/lib/gdm
|
||||
chown 2:2 ./var/lib/gdm
|
||||
mkdir -p ./var/log/gdm
|
||||
chown 2:2 ./var/log/gdm
|
||||
chmod 01770 ./var/log/gdm
|
||||
|
||||
mkdir -p ./var/lib/AccountsService
|
||||
|
||||
touch ./var/shadow
|
||||
chmod 0600 ./var/shadow
|
||||
|
||||
Reference in new issue
Block a user