diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2017-05-24 16:55:48 +0100 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2017-05-24 17:05:06 +0100 |
commit | 7339ae4d183c1eae2b9a6fda4e084af58e6e67cf (patch) | |
tree | 96e81fa487c187e0134535bb5b70e5a67d99711f | |
parent | f049e15fab122ebd3c2554c81b95fbf7f66bd766 (diff) | |
download | definitions-7339ae4d183c1eae2b9a6fda4e084af58e6e67cf.tar.gz |
Add deployment target for devel-system
BuildStream is soon going to gain built-in support for deploying images
so this should be considered a temporary x86_64 only hack.
It's based on instructions in the defs2bst README:
https://gitlab.com/BuildStream/defs2bst/blob/master/README.rst
-rw-r--r-- | elements/bsp-x86_64-generic.bst | 2 | ||||
-rw-r--r-- | elements/bsp-x86_both-tools.bst | 6 | ||||
-rw-r--r-- | elements/bsp-x86_both-tools/nasm.bst | 11 | ||||
-rw-r--r-- | elements/bsp-x86_both-tools/syslinux.bst | 16 | ||||
-rw-r--r-- | elements/deploy-tools.bst | 8 | ||||
-rw-r--r-- | elements/deploy-tools/mtools.bst | 8 | ||||
-rw-r--r-- | elements/deploy-tools/nasm.bst (renamed from elements/bsp-x86_64-generic/nasm.bst) | 0 | ||||
-rw-r--r-- | elements/deploy-tools/syslinux.bst (renamed from elements/bsp-x86_64-generic/syslinux.bst) | 2 | ||||
-rw-r--r-- | elements/initramfs/initramfs-gz.bst | 2 | ||||
-rw-r--r-- | elements/ivi/bsp-x86_64-ivi/linux-x86-64-ivi.bst | 2 | ||||
-rw-r--r-- | elements/systems/devel-system-files.bst | 12 | ||||
-rw-r--r-- | elements/systems/devel-system-image.bst | 141 | ||||
-rw-r--r-- | elements/systems/devel-system.bst | 15 | ||||
-rw-r--r-- | elements/systems/ivi-system-content.bst | 1 | ||||
-rw-r--r-- | files/essential-files/etc/inputrc (renamed from old/install-files/essential-files/etc/inputrc) | 0 | ||||
l--------- | files/essential-files/etc/os-release (renamed from old/install-files/essential-files/etc/os-release) | 0 | ||||
-rw-r--r-- | files/essential-files/etc/profile (renamed from old/install-files/essential-files/etc/profile) | 0 | ||||
-rw-r--r-- | files/essential-files/usr/bin/brpaste (renamed from old/install-files/essential-files/usr/bin/brpaste) | 0 | ||||
-rw-r--r-- | files/essential-files/usr/lib/os-release (renamed from old/install-files/essential-files/usr/lib/os-release) | 0 | ||||
-rw-r--r-- | files/essential-files/usr/lib/tmpfiles.d/shutdownramfs.conf (renamed from old/install-files/essential-files/usr/lib/tmpfiles.d/shutdownramfs.conf) | 0 | ||||
-rw-r--r-- | old/install-files/essential-files/manifest | 11 |
21 files changed, 187 insertions, 50 deletions
diff --git a/elements/bsp-x86_64-generic.bst b/elements/bsp-x86_64-generic.bst index f35ca9d7..ef601bdf 100644 --- a/elements/bsp-x86_64-generic.bst +++ b/elements/bsp-x86_64-generic.bst @@ -3,5 +3,3 @@ description: The set of platform specific components required for booting a 64-b x86 based system. depends: - bsp-x86_64-generic/linux-x86-64-generic.bst -- bsp-x86_64-generic/nasm.bst -- bsp-x86_64-generic/syslinux.bst diff --git a/elements/bsp-x86_both-tools.bst b/elements/bsp-x86_both-tools.bst deleted file mode 100644 index 7d68c639..00000000 --- a/elements/bsp-x86_both-tools.bst +++ /dev/null @@ -1,6 +0,0 @@ -kind: stack -description: The set of platform specific components required for configuring a bootable - x86 based system. -depends: -- bsp-x86_both-tools/nasm.bst -- bsp-x86_both-tools/syslinux.bst diff --git a/elements/bsp-x86_both-tools/nasm.bst b/elements/bsp-x86_both-tools/nasm.bst deleted file mode 100644 index 485a22d0..00000000 --- a/elements/bsp-x86_both-tools/nasm.bst +++ /dev/null @@ -1,11 +0,0 @@ -kind: autotools -depends: -- docutils.bst -sources: -- kind: git - url: upstream:nasm - track: nasm-2.11.08 - ref: 8fa0fe16408afc76ce1ae4387e1a9d46893cfda6 -config: - install-commands: - - make INSTALLROOT="%{install-root}" install diff --git a/elements/bsp-x86_both-tools/syslinux.bst b/elements/bsp-x86_both-tools/syslinux.bst deleted file mode 100644 index c8103d0e..00000000 --- a/elements/bsp-x86_both-tools/syslinux.bst +++ /dev/null @@ -1,16 +0,0 @@ -kind: manual -depends: -- docutils.bst -- bsp-x86_both-tools/nasm.bst -sources: -- kind: git - url: upstream:syslinux - track: baserock/syslinux-4.06-gcc5-glibc2.20 - ref: f92b88bc6c65ba71dad92fe7da7b7085607b439a -config: - build-commands: - - make clean - - make NO_WERROR=1 - - make NO_WERROR=1 installer - install-commands: - - make INSTALLROOT="%{install-root}" install diff --git a/elements/deploy-tools.bst b/elements/deploy-tools.bst new file mode 100644 index 00000000..92e72eab --- /dev/null +++ b/elements/deploy-tools.bst @@ -0,0 +1,8 @@ +kind: stack +description: Deployment tooling +depends: +- foundation.bst +- tools.bst +- deploy-tools/mtools.bst +- deploy-tools/nasm.bst +- deploy-tools/syslinux.bst diff --git a/elements/deploy-tools/mtools.bst b/elements/deploy-tools/mtools.bst new file mode 100644 index 00000000..15cd5203 --- /dev/null +++ b/elements/deploy-tools/mtools.bst @@ -0,0 +1,8 @@ +kind: autotools +depends: +- foundation.bst +sources: +- kind: git + url: upstream:mtools + track: mtools-4.0.18 + ref: af0c3edb9706e470b45a9c8dd6debcc9e2d543c2 diff --git a/elements/bsp-x86_64-generic/nasm.bst b/elements/deploy-tools/nasm.bst index 485a22d0..485a22d0 100644 --- a/elements/bsp-x86_64-generic/nasm.bst +++ b/elements/deploy-tools/nasm.bst diff --git a/elements/bsp-x86_64-generic/syslinux.bst b/elements/deploy-tools/syslinux.bst index d52c9fdd..205766b8 100644 --- a/elements/bsp-x86_64-generic/syslinux.bst +++ b/elements/deploy-tools/syslinux.bst @@ -1,7 +1,7 @@ kind: manual depends: - docutils.bst -- bsp-x86_64-generic/nasm.bst +- deploy-tools/nasm.bst sources: - kind: git url: upstream:syslinux diff --git a/elements/initramfs/initramfs-gz.bst b/elements/initramfs/initramfs-gz.bst index 81b5b7d3..3ddc35ca 100644 --- a/elements/initramfs/initramfs-gz.bst +++ b/elements/initramfs/initramfs-gz.bst @@ -10,6 +10,8 @@ config: base: foundation.bst input: initramfs/initramfs.bst + collect: "%{install-root}" + commands: - mkdir -p %{install-root}/boot - (find . -print0 | cpio -0 -H newc -o) | diff --git a/elements/ivi/bsp-x86_64-ivi/linux-x86-64-ivi.bst b/elements/ivi/bsp-x86_64-ivi/linux-x86-64-ivi.bst index 3dd05bd3..e4cf43ff 100644 --- a/elements/ivi/bsp-x86_64-ivi/linux-x86-64-ivi.bst +++ b/elements/ivi/bsp-x86_64-ivi/linux-x86-64-ivi.bst @@ -1,6 +1,4 @@ kind: manual -depends: -- bsp-x86_both-tools.bst sources: - kind: git url: upstream:linux diff --git a/elements/systems/devel-system-files.bst b/elements/systems/devel-system-files.bst new file mode 100644 index 00000000..b4cd5a44 --- /dev/null +++ b/elements/systems/devel-system-files.bst @@ -0,0 +1,12 @@ +kind: import +description: Extra files to add to the system + +# We depend on this, because we want these files to +# replace anything which was already there. +depends: +- systems/devel-system-content.bst + +# Use a local source pointing to the files +sources: +- kind: local + path: files/essential-files diff --git a/elements/systems/devel-system-image.bst b/elements/systems/devel-system-image.bst new file mode 100644 index 00000000..7a91a2b4 --- /dev/null +++ b/elements/systems/devel-system-image.bst @@ -0,0 +1,141 @@ +kind: script +description: Create a deployment of the devel system +depends: +- filename: systems/devel-system.bst + type: build +- filename: deploy-tools.bst + type: build + +variables: + # Size of the disk to create + # + # Should be able to calculate this based on the space + # used, however it must be a multiple of (63 * 512) bytes + # as mtools wants a size that is devisable by sectors (512 bytes) + # per track (63). + boot-size: 252000K + + rootfs-size: 4G + swap-size: 1G + sector-size: 512 + +config: + base: deploy-tools.bst + input: systems/devel-system.bst + + collect: "%{install-root}" + + commands: + + - | + # Split up the boot directory and the other + cd /buildstream + mkdir -p /buildstream/sda1 + mkdir -p /buildstream/sda2 + + mv %{build-root}/boot/* /buildstream/sda1 + mv %{build-root}/* /buildstream/sda2 + + - | + # Generate an fstab + cat > /buildstream/sda2/etc/fstab << EOF + /dev/sda2 / ext4 defaults,rw,noatime 0 1 + /dev/sda1 /boot vfat defaults 0 2 + /dev/sda3 none swap defaults 0 0 + EOF + + - | + # Create the syslinux config + mkdir -p /buildstream/sda1/syslinux + cat > /buildstream/sda1/syslinux/syslinux.cfg << EOF + PROMPT 0 + TIMEOUT 5 + + ALLOWOPTIONS 1 + SERIAL 0 115200 + + DEFAULT boot + LABEL boot + + KERNEL /vmlinuz + INITRD /initramfs.gz + + APPEND root=/dev/sda2 rootfstype=ext4 rootdelay=20 init=/usr/lib/systemd/systemd + EOF + + - | + # Create the vfat image + truncate -s %{boot-size} /buildstream/sda1.img + mkdosfs /buildstream/sda1.img + + - | + # Copy all that stuff into the image + mcopy -D s -i /buildstream/sda1.img -s /buildstream/sda1/* ::/ + + - | + # Install the bootloader on the image, it should get the config file + # from inside the vfat image, I think + syslinux --directory /syslinux/ /buildstream/sda1.img + + - | + # Now create the root filesys on sda2 + truncate -s %{rootfs-size} /buildstream/sda2.img + mkfs.ext4 -F -i 8192 /buildstream/sda2.img -L root -d /buildstream/sda2 + + - | + # Create swap + truncate -s %{swap-size} /buildstream/sda3.img + mkswap -L swap /buildstream/sda3.img + + - | + + ######################################## + # Partition the disk # + ######################################## + + # First get the size in bytes + sda1size=$(stat --printf="%s" /buildstream/sda1.img) + sda2size=$(stat --printf="%s" /buildstream/sda2.img) + sda3size=$(stat --printf="%s" /buildstream/sda3.img) + + # Now convert to sectors + sda1sec=$(( ${sda1size} / %{sector-size} )) + sda2sec=$(( ${sda2size} / %{sector-size} )) + sda3sec=$(( ${sda3size} / %{sector-size} )) + + # Now get the offsets in sectors, first sector is MBR + sda1offset=1 + sda2offset=$(( ${sda1offset} + ${sda1sec} )) + sda3offset=$(( ${sda2offset} + ${sda2sec} )) + + # Get total disk size in sectors and bytes + sdasectors=$(( ${sda3offset} + ${sda3sec} )) + sdabytes=$(( ${sdasectors} * %{sector-size} )) + + # Create the main disk and do the partitioning + truncate -s ${sdabytes} /buildstream/sda.img + parted -s /buildstream/sda.img mklabel msdos + parted -s /buildstream/sda.img unit s mkpart primary fat32 ${sda1offset} $(( ${sda1offset} + ${sda1sec} - 1 )) + parted -s /buildstream/sda.img unit s mkpart primary ext2 ${sda2offset} $(( ${sda2offset} + ${sda2sec} - 1 )) + parted -s /buildstream/sda.img unit s mkpart primary linux-swap ${sda3offset} $(( ${sda3offset} + ${sda3sec} - 1 )) + + # Make partition 1 the boot partition + parted -s /buildstream/sda.img set 1 boot on + + # Now splice the existing filesystems directly into the image + dd if=/buildstream/sda1.img of=/buildstream/sda.img \ + ibs=%{sector-size} obs=%{sector-size} conv=notrunc \ + count=${sda1sec} seek=${sda1offset} + + dd if=/buildstream/sda2.img of=/buildstream/sda.img \ + ibs=%{sector-size} obs=%{sector-size} conv=notrunc \ + count=${sda2sec} seek=${sda2offset} + + dd if=/buildstream/sda3.img of=/buildstream/sda.img \ + ibs=%{sector-size} obs=%{sector-size} conv=notrunc \ + count=${sda3sec} seek=${sda3offset} + + - | + # Move the image where it will be collected + mv /buildstream/sda.img %{install-root} + chmod 0644 %{install-root}/sda.img diff --git a/elements/systems/devel-system.bst b/elements/systems/devel-system.bst new file mode 100644 index 00000000..7346b3e0 --- /dev/null +++ b/elements/systems/devel-system.bst @@ -0,0 +1,15 @@ +kind: compose +description: GNOME system +depends: +- filename: systems/devel-system-content.bst + type: build +- filename: systems/devel-system-files.bst + type: build +- filename: initramfs/initramfs-gz.bst + type: build + +config: + # Include only the runtime and locale domains in this composition + include: + - runtime + - locale diff --git a/elements/systems/ivi-system-content.bst b/elements/systems/ivi-system-content.bst index b34329b0..be37edaf 100644 --- a/elements/systems/ivi-system-content.bst +++ b/elements/systems/ivi-system-content.bst @@ -3,7 +3,6 @@ description: A generic IVI system with components from GENIVI and AGL depends: - gnu-toolchain.bst - bluetooth.bst -- bsp-x86_both-tools.bst - ivi/bsp-x86_64-ivi.bst - core.bst - cpp-common-libs.bst diff --git a/old/install-files/essential-files/etc/inputrc b/files/essential-files/etc/inputrc index ddee44cd..ddee44cd 100644 --- a/old/install-files/essential-files/etc/inputrc +++ b/files/essential-files/etc/inputrc diff --git a/old/install-files/essential-files/etc/os-release b/files/essential-files/etc/os-release index c4c75b41..c4c75b41 120000 --- a/old/install-files/essential-files/etc/os-release +++ b/files/essential-files/etc/os-release diff --git a/old/install-files/essential-files/etc/profile b/files/essential-files/etc/profile index 5c0a1331..5c0a1331 100644 --- a/old/install-files/essential-files/etc/profile +++ b/files/essential-files/etc/profile diff --git a/old/install-files/essential-files/usr/bin/brpaste b/files/essential-files/usr/bin/brpaste index d2f9d867..d2f9d867 100644 --- a/old/install-files/essential-files/usr/bin/brpaste +++ b/files/essential-files/usr/bin/brpaste diff --git a/old/install-files/essential-files/usr/lib/os-release b/files/essential-files/usr/lib/os-release index b729c75f..b729c75f 100644 --- a/old/install-files/essential-files/usr/lib/os-release +++ b/files/essential-files/usr/lib/os-release diff --git a/old/install-files/essential-files/usr/lib/tmpfiles.d/shutdownramfs.conf b/files/essential-files/usr/lib/tmpfiles.d/shutdownramfs.conf index 174f1f03..174f1f03 100644 --- a/old/install-files/essential-files/usr/lib/tmpfiles.d/shutdownramfs.conf +++ b/files/essential-files/usr/lib/tmpfiles.d/shutdownramfs.conf diff --git a/old/install-files/essential-files/manifest b/old/install-files/essential-files/manifest deleted file mode 100644 index 93095d86..00000000 --- a/old/install-files/essential-files/manifest +++ /dev/null @@ -1,11 +0,0 @@ -0040755 0 0 /etc -overwrite 0120000 0 0 /etc/os-release -overwrite 0100644 0 0 /etc/profile -overwrite 0100644 0 0 /etc/inputrc -0040755 0 0 /usr -0040755 0 0 /usr/bin -0100755 0 0 /usr/bin/brpaste -0040755 0 0 /usr/lib -0100644 0 0 /usr/lib/os-release -0040755 0 0 /usr/lib/tmpfiles.d -0100644 0 0 /usr/lib/tmpfiles.d/shutdownramfs.conf |