apertis-image-sdk.yaml 5.93 KB
Newer Older
Denis Pynkin's avatar
Denis Pynkin committed
1 2 3
{{ $architecture := or .architecture "amd64" }}
{{ $type := or .type "sdk" }}
{{ $mirror := or .mirror "https://repositories.apertis.org/apertis/" }}
4
{{ $suite := or .suite "v2019pre" }}
5 6 7
{{ $timestamp := or .timestamp "" }}
{{ $ospack := or .ospack (printf "ospack_%s-%s-%s" $suite $architecture $type) }}
{{ $image := or .image (printf "apertis-%s-%s-%s" $suite  $type $architecture) }}
Denis Pynkin's avatar
Denis Pynkin committed
8

9
{{ $cmdline := or .cmdline "console=tty0 console=ttyS0,115200n8 rootwait ro quiet splash plymouth.ignore-serial-consoles fsck.mode=auto fsck.repair=yes" }}
Denis Pynkin's avatar
Denis Pynkin committed
10

11 12
{{ $demopack := or .demopack "disabled" }}

13
{{ $size := or .size "40G" }}
14
{{ $sampleappscheckout := or .sampleappscheckout "disabled" }}
15
{{ $devrootpack := or .devrootpack "disabled" }}
16

17 18
{{- $unpack := or .unpack "true" }}

Denis Pynkin's avatar
Denis Pynkin committed
19 20 21 22
architecture: {{ $architecture }}

actions:

23
{{- if eq $unpack "true" }}
Denis Pynkin's avatar
Denis Pynkin committed
24 25 26
  - action: unpack
    description: Unpack {{ $ospack }}
    compression: gz
27
    file: {{ $ospack }}.tar.gz
28
{{- end }}
Denis Pynkin's avatar
Denis Pynkin committed
29

30 31 32 33
  # Add multimedia demo pack
  # Provide URL via '-t demopack:"https://images.apertis.org/media/multimedia-demo.tar.gz"'
  # to add multimedia demo files
  {{ if ne $demopack "disabled" }}
34 35 36 37 38 39
  # Use wget to get some insight about https://phabricator.collabora.com/T11930
  # TODO: Revert to a download action once the cause is found
  - action: run
    description: Download multimedia demo pack
    chroot: false
    command: wget --debug {{ $demopack }} -O "${ARTIFACTDIR}/multimedia-demo.tar.gz"
40 41

  - action: unpack
42 43 44 45 46 47 48 49
    description: Unpack multimedia demo pack
    compression: gz
    file: multimedia-demo.tar.gz

  - action: run
    description: Clean up multimedia demo pack tarball
    chroot: false
    command: rm "${ARTIFACTDIR}/multimedia-demo.tar.gz"
50 51
  {{ end }}

Denis Pynkin's avatar
Denis Pynkin committed
52
  - action: image-partition
53
    imagename: {{ $image }}.img
54
    imagesize: {{ $size }}
Denis Pynkin's avatar
Denis Pynkin committed
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
    partitiontype: gpt

    mountpoints:
      - mountpoint: /
        partition: system
      - mountpoint: /boot/efi
        partition: EFI
      - mountpoint: /home
        partition: general_storage

    partitions:
      - name: EFI
        fs: vfat
        start: 6176s
        end: 256M
        flags: [ boot ]
      - name: system
        fs: btrfs
        start: 256M
        end: 10G
      - name: general_storage
        fs: btrfs
        start: 10G
        end: 100%

  - action: filesystem-deploy
    description: Deploying ospack onto image
82
    append-kernel-cmdline: {{ $cmdline }}
Denis Pynkin's avatar
Denis Pynkin committed
83 84 85

  - action: apt
    packages:
86
      - systemd-boot
Denis Pynkin's avatar
Denis Pynkin committed
87 88 89 90 91 92 93

  - action: run
    description: Install UEFI bootloader
    chroot: true
    command: bootctl --path=/boot/efi install

  - action: apt
94
    description: Kernel and system packages for {{$architecture}}
Denis Pynkin's avatar
Denis Pynkin committed
95
    packages:
96
      - linux-image-{{$architecture}}
Denis Pynkin's avatar
Denis Pynkin committed
97 98 99
      - btrfs-tools
      - libgles2-mesa

100 101 102 103 104
  - action: run
    description: "Save installed package status"
    chroot: false
    command: gzip -c "${ROOTDIR}/var/lib/dpkg/status" > "${ARTIFACTDIR}/{{ $image }}.pkglist.gz"

Denis Pynkin's avatar
Denis Pynkin committed
105 106
  - action: run
    description: Cleanup /var/lib
107
    script: scripts/remove_var_lib_parts.sh
Denis Pynkin's avatar
Denis Pynkin committed
108

109
  {{ if eq $sampleappscheckout "enabled" }}
110 111 112
  - action: run
    description: Fetch sample app bundle sources
    chroot: true
113
    script: scripts/clone-sample-repos.sh
114
  {{ end }}
115

116 117 118
  # Add devroot pack for foreign architecture platform development
  # Provide URL via '-t devrootpack:"https://images.apertis.org/release/18.12/18.12.0/armhf/devroot/ospack_18.12-armhf-devroot_18.12.0.tar.gz"
  {{ if ne $devrootpack "disabled" }}
119
  - action: download
120 121 122
    url: {{ $devrootpack }}
    name: devrootpack
    filename: devrootpack.tar.gz
123 124 125 126 127 128 129 130 131

  - action: run
    description: Create the devroot directory
    chroot: false
    command: mkdir -p "${ROOTDIR}/opt/devroot"

  - action: run
    description: Unpack the devroot ospack
    chroot: false
132
    command: tar --extract -C "${ROOTDIR}/opt/devroot" -f devrootpack.tar.gz
133 134
  {{ end }}

135 136 137 138 139 140
  # work around the Debos isssue in https://phabricator.apertis.org/T4308
  - action: run
    chroot: false
    description: "Drop resolv.conf so the appropriate one gets created at runtime"
    command: rm "${ROOTDIR}/etc/resolv.conf"

141 142 143 144 145 146 147 148 149 150 151 152
  # the clearing of machine-id can't be done before this point since
  # systemd-boot requires the machine-id to be set for reasons related to
  # dual-boot scenarios:
  # * to avoid conflicts when creating entries, see the `90-loaderentry` kernel
  #   install trigger
  # * to set the entries for the currently booted installation as default in
  #   the loader.conf generated by `bootctl install`
  #
  # in our image this is not useful, as the actual machine-id is supposed to be
  # uniquely generated on the first boot. however the impact is negligible, as
  # things still work albeit the code used to potentially disambiguate entries
  # doesn't match a real machine-id
153 154 155 156 157
  - action: run
    chroot: false
    description: "Empty /etc/machine-id so it's regenerated on first boot with an unique value"
    command: truncate -s0 "${ROOTDIR}/etc/machine-id"

158 159 160 161 162
  - action: run
    description: List files on {{ $image }}
    chroot: false
    script: scripts/list-files "$ROOTDIR" | gzip > "${ARTIFACTDIR}/{{ $image }}.filelist.gz"

163
  # For VirtualBox
Denis Pynkin's avatar
Denis Pynkin committed
164
  - action: run
165
    description: Convert raw image to {{ $image }}.vdi
Denis Pynkin's avatar
Denis Pynkin committed
166
    postprocess: true
167
    command: qemu-img convert -O vdi {{ $image }}.img {{ $image }}.vdi
Denis Pynkin's avatar
Denis Pynkin committed
168 169

  - action: run
170
    description: Compress {{ $image }}.vdi
Denis Pynkin's avatar
Denis Pynkin committed
171
    postprocess: true
172 173 174 175 176
    command: gzip -f {{ $image }}.vdi

  - action: run
    description: Checksum for {{ $image }}.vdi.gz
    postprocess: true
Emanuele Aina's avatar
Emanuele Aina committed
177
    command: sha256sum {{ $image }}.vdi.gz > {{ $image }}.vdi.gz.sha256
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192

  # Raw image
  - action: run
    description: Create block map for {{ $image }}.img
    postprocess: true
    command: bmaptool create {{ $image }}.img > {{ $image }}.img.bmap

  - action: run
    description: Compress {{ $image }}.img
    postprocess: true
    command: gzip -f {{ $image }}.img

  - action: run
    description: Checksum for {{ $image }}.img.gz
    postprocess: true
Emanuele Aina's avatar
Emanuele Aina committed
193
    command: sha256sum {{ $image }}.img.gz > {{ $image }}.img.gz.sha256