Tristan Maat pushed to branch tlater/image-authoring at BuildStream / bst-external
Commits:
-
f1ce2f33
by Tristan Maat at 2018-07-30T17:16:21Z
19 changed files:
- doc/Makefile
- + doc/examples/image-authoring/elements/base.bst
- + doc/examples/image-authoring/elements/contents.bst
- + doc/examples/image-authoring/elements/contents/busybox.bst
- + doc/examples/image-authoring/elements/contents/hello.bst
- + doc/examples/image-authoring/elements/contents/musl.bst
- + doc/examples/image-authoring/elements/image-x86_64.bst
- + doc/examples/image-authoring/elements/image/initramfs/initramfs-gz.bst
- + doc/examples/image-authoring/elements/image/initramfs/initramfs-scripts.bst
- + doc/examples/image-authoring/elements/image/initramfs/initramfs.bst
- + doc/examples/image-authoring/elements/image/linux.bst
- + doc/examples/image-authoring/elements/image/system.bst
- + doc/examples/image-authoring/files/hello/hello
- + doc/examples/image-authoring/files/initramfs-scripts/init
- + doc/examples/image-authoring/files/initramfs-scripts/shutdown
- + doc/examples/image-authoring/project.conf
- + doc/source/examples.rst
- + doc/source/examples/image-authoring.rst
- doc/source/index.rst
Changes:
... | ... | @@ -80,6 +80,7 @@ html devhelp: templates |
80 | 80 |
PYTHONPATH=$(CURDIR)/../bst_external \
|
81 | 81 |
$(SPHINXBUILD) -b $@ $(ALLSPHINXOPTS) "$(BUILDDIR)/$@" \
|
82 | 82 |
$(wildcard source/*.rst) \
|
83 |
+ $(wildcard source/examples/*.rst) \
|
|
83 | 84 |
$(wildcard source/elements/*.rst) \
|
84 | 85 |
$(wildcard source/sources/*.rst)
|
85 | 86 |
@echo
|
1 |
+# elements/base.bst
|
|
2 |
+ |
|
3 |
+kind: import
|
|
4 |
+sources:
|
|
5 |
+- kind: docker
|
|
6 |
+ url: https://registry.hub.docker.com/library/buildstream/image-tools/
|
|
7 |
+ track: latest
|
1 |
+# elements/contents.bst
|
|
2 |
+ |
|
3 |
+kind: stack
|
|
4 |
+description: The image contents
|
|
5 |
+depends:
|
|
6 |
+ - contents/hello.bst
|
|
7 |
+ - contents/busybox.bst
|
1 |
+# elements/contents/busybox.bst
|
|
2 |
+ |
|
3 |
+kind: manual
|
|
4 |
+ |
|
5 |
+sources:
|
|
6 |
+- kind: tar
|
|
7 |
+ url: busybox:busybox-1.27.2.tar.bz2
|
|
8 |
+depends:
|
|
9 |
+- filename: base.bst
|
|
10 |
+ type: build
|
|
11 |
+- filename: contents/musl.bst
|
|
12 |
+ type: runtime
|
|
13 |
+ |
|
14 |
+environment:
|
|
15 |
+ PATH: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin
|
|
16 |
+ |
|
17 |
+config:
|
|
18 |
+ configure-commands:
|
|
19 |
+ # Busybox's default config has everything enabled.
|
|
20 |
+ - make defconfig KCONFIG_NOTIMESTAMP=1
|
|
21 |
+ |
|
22 |
+ # None of this is needed because we have kmod; and it actually breaks the
|
|
23 |
+ # Linux build because depmod isn't compatible enough with util-linux's.
|
|
24 |
+ - sed -e 's/CONFIG_DEPMOD=y.*/# CONFIG_DEPMOD is not set/' -i .config
|
|
25 |
+ - sed -e 's/CONFIG_INSMOD=y.*/# CONFIG_INSMOD is not set/' -i .config
|
|
26 |
+ - sed -e 's/CONFIG_MODPROBE=y.*/# CONFIG_MODPROBE is not set/' -i .config
|
|
27 |
+ - sed -e 's/CONFIG_MODPROBE_SMALL=y.*/# CONFIG_MODPROBE_SMALL is not set/' -i .config
|
|
28 |
+ - sed -e 's/CONFIG_LSMOD=y.*/# CONFIG_LSMOD is not set/' -i .config
|
|
29 |
+ - sed -e 's/CONFIG_RMMOD=y.*/# CONFIG_RMMOD is not set/' -i .config
|
|
30 |
+ |
|
31 |
+ build-commands:
|
|
32 |
+ - make KCONFIG_NOTIMESTAMP=1
|
|
33 |
+ |
|
34 |
+ install-commands:
|
|
35 |
+ - |
|
|
36 |
+ # Note here we intentionally ignore '%{prefix}', this is going into '/'
|
|
37 |
+ make CONFIG_PREFIX="%{install-root}" KCONFIG_NOTIMESTAMP=1 install &&
|
|
38 |
+ chmod 6755 "%{install-root}/bin/busybox"
|
|
39 |
+ |
|
40 |
+ # We need to prepare the system for creating files in /etc later
|
|
41 |
+ # (/etc/fstab, for example)
|
|
42 |
+ - mkdir -p "%{install-root}/etc"
|
|
43 |
+ |
|
44 |
+public:
|
|
45 |
+ bst:
|
|
46 |
+ split-rules:
|
|
47 |
+ runtime:
|
|
48 |
+ (>):
|
|
49 |
+ - |
|
|
50 |
+ /bin/*
|
|
51 |
+ - |
|
|
52 |
+ /sbin/*
|
1 |
+# elements/contents/hello.bst
|
|
2 |
+ |
|
3 |
+kind: import
|
|
4 |
+ |
|
5 |
+sources:
|
|
6 |
+ - kind: local
|
|
7 |
+ path: files/hello
|
|
8 |
+ directory: /usr/bin
|
|
9 |
+ |
|
10 |
+depends:
|
|
11 |
+ - filename: contents/busybox.bst
|
|
12 |
+ type: runtime
|
1 |
+# elements/contents/musl.bst
|
|
2 |
+ |
|
3 |
+kind: autotools
|
|
4 |
+ |
|
5 |
+sources:
|
|
6 |
+- kind: tar
|
|
7 |
+ url: https://www.musl-libc.org/releases/musl-1.1.18.tar.gz
|
|
8 |
+ |
|
9 |
+ ref: d017ee5d01aec0c522a1330fdff06b1e428cb409e1db819cc4935d5da4a5a118
|
|
10 |
+depends:
|
|
11 |
+- filename: base.bst
|
|
12 |
+ type: build
|
|
13 |
+ |
|
14 |
+config:
|
|
15 |
+ configure-commands:
|
|
16 |
+ - '%{configure}'
|
1 |
+# elements/image-x86_64.bst
|
|
2 |
+ |
|
3 |
+# Specify the plugin reference - we want to import the x86image plugin
|
|
4 |
+# from buildstream-external
|
|
5 |
+kind: x86image
|
|
6 |
+description: Create a deployment of a Linux system
|
|
7 |
+depends:
|
|
8 |
+ - filename: image/system.bst
|
|
9 |
+ type: build
|
|
10 |
+ - filename: base.bst
|
|
11 |
+ type: build
|
|
12 |
+ |
|
13 |
+# Boot image settings; the defaults can work, but you almost certainly
|
|
14 |
+# want to customize them to match your image requirements.
|
|
15 |
+#
|
|
16 |
+# These settings are tailored to this specific project, don't just
|
|
17 |
+# blindly copy.
|
|
18 |
+variables:
|
|
19 |
+ # Size of the disk to create
|
|
20 |
+ #
|
|
21 |
+ # Should be able to calculate this based on the space
|
|
22 |
+ # used, however it must be a multiple of (63 * 512) bytes
|
|
23 |
+ # as mtools wants a size that is divisible by sectors (512 bytes)
|
|
24 |
+ # per track (63).
|
|
25 |
+ boot-size: 16M
|
|
26 |
+ rootfs-size: 69M
|
|
27 |
+ sector-size: 512
|
|
28 |
+ swap-size: 40K
|
|
29 |
+ kernel-args: root=/dev/sda2 rootfstype=ext4 init=/sbin/init console=ttyS0
|
|
30 |
+ kernel-name: vmlinuz-4.14.3
|
|
31 |
+ |
|
32 |
+config:
|
|
33 |
+ # The element that should be staged into "/". It must contain
|
|
34 |
+ # all the tools required to generate the image
|
|
35 |
+ base: base.bst
|
|
36 |
+ |
|
37 |
+ # The element that should be staged into %{build-root}. It is expected
|
|
38 |
+ # to be the system that you're planning to turn into an image.
|
|
39 |
+ input: image/system.bst
|
|
40 |
+ |
|
41 |
+ # This is technically not necessary, but convenient for trying
|
|
42 |
+ # things out :)
|
|
43 |
+ final-commands:
|
|
44 |
+ (>):
|
|
45 |
+ - |
|
|
46 |
+ cat > %{install-root}/run-in-qemu.sh << EOF
|
|
47 |
+ #!/bin/sh
|
|
48 |
+ qemu-system-x86_64 -drive file=sda.img,format=raw -nographic
|
|
49 |
+ EOF
|
|
50 |
+ chmod +x %{install-root}/run-in-qemu.sh
|
1 |
+# elements/image/initramfs/initramfs-gz.bst
|
|
2 |
+ |
|
3 |
+kind: script
|
|
4 |
+description: The compressed initramfs
|
|
5 |
+ |
|
6 |
+depends:
|
|
7 |
+- filename: image/initramfs/initramfs.bst
|
|
8 |
+ type: build
|
|
9 |
+- filename: contents.bst
|
|
10 |
+ type: build
|
|
11 |
+ |
|
12 |
+variables:
|
|
13 |
+ cwd: "%{build-root}"
|
|
14 |
+ |
|
15 |
+config:
|
|
16 |
+ layout:
|
|
17 |
+ - element: contents.bst
|
|
18 |
+ destination: /
|
|
19 |
+ - element: image/initramfs/initramfs.bst
|
|
20 |
+ destination: "%{build-root}"
|
|
21 |
+ |
|
22 |
+ commands:
|
|
23 |
+ - mkdir -p %{install-root}/boot
|
|
24 |
+ # We need to ensure exec permissions here.
|
|
25 |
+ # See: https://gitlab.com/BuildStream/buildstream/issues/84
|
|
26 |
+ - chmod +x ./sbin/init ./sbin/shutdown
|
|
27 |
+ - (find . -print0 | cpio -0 -H newc -o) |
|
|
28 |
+ gzip -c > %{install-root}/boot/initramfs.gz
|
1 |
+# elements/image/initramfs/initramfs-scripts.bst
|
|
2 |
+ |
|
3 |
+kind: import
|
|
4 |
+ |
|
5 |
+sources:
|
|
6 |
+- kind: local
|
|
7 |
+ path: files/initramfs-scripts
|
|
8 |
+ directory: /sbin
|
1 |
+# elements/image/initramfs/initramfs.bst
|
|
2 |
+ |
|
3 |
+kind: compose
|
|
4 |
+description: Initramfs composition
|
|
5 |
+ |
|
6 |
+depends:
|
|
7 |
+ - filename: contents.bst
|
|
8 |
+ type: build
|
|
9 |
+ - filename: image/initramfs/initramfs-scripts.bst
|
|
10 |
+ type: build
|
|
11 |
+ |
|
12 |
+config:
|
|
13 |
+ include:
|
|
14 |
+ - runtime
|
1 |
+# elements/image/linux.bst
|
|
2 |
+ |
|
3 |
+kind: manual
|
|
4 |
+ |
|
5 |
+depends:
|
|
6 |
+- filename: base.bst
|
|
7 |
+ type: build
|
|
8 |
+ |
|
9 |
+sources:
|
|
10 |
+- kind: tar
|
|
11 |
+ url: kernel:linux/kernel/v4.x/linux-4.14.3.tar.xz
|
|
12 |
+ ref: b628134ebb63ec82cb3e304a10aab2fd306fe79212e75ce81d8af73463c80366
|
|
13 |
+config:
|
|
14 |
+ configure-commands:
|
|
15 |
+ - sed -i 's|#!/bin/bash|#!/bin/ash|' scripts/config
|
|
16 |
+ - make defconfig
|
|
17 |
+ - scripts/config -e PACKET
|
|
18 |
+ - scripts/config -e SATA_AHCI
|
|
19 |
+ - scripts/config -e ATA_GENERIC
|
|
20 |
+ - scripts/config -e HAVE_IDE
|
|
21 |
+ - scripts/config -d BLK_DEV_IDE_SATA
|
|
22 |
+ - scripts/config -e BTRFS_FS
|
|
23 |
+ - scripts/config -e BTRFS_FS_POSIX_ACL
|
|
24 |
+ - scripts/config -e DEVTMPFS
|
|
25 |
+ - scripts/config -e DEVTMPFS_MOUNT
|
|
26 |
+ - scripts/config -e CONFIG_FHANDLE
|
|
27 |
+ - scripts/config -e DEVPTS_MULTIPLE_INSTANCES
|
|
28 |
+ - scripts/config -e CGROUPS
|
|
29 |
+ - scripts/config -e AUTOFS4_FS
|
|
30 |
+ - scripts/config --set-str UEVENT_HELPER_PATH ''
|
|
31 |
+ - scripts/config -e EXT2_FS
|
|
32 |
+ - scripts/config -e EXT2_FS_XATTR
|
|
33 |
+ - scripts/config -e EXT2_FS_POSIX_ACL
|
|
34 |
+ - scripts/config -e EXT2_FS_SECURITY
|
|
35 |
+ - scripts/config -e EXT2_FS_XIP
|
|
36 |
+ - scripts/config -e EXT3_FS
|
|
37 |
+ - scripts/config -d EXT3_DEFAULTS_TO_ORDERED
|
|
38 |
+ - scripts/config -e EXT3_FS_XATTR
|
|
39 |
+ - scripts/config -e EXT3_FS_POSIX_ACL
|
|
40 |
+ - scripts/config -e EXT3_FS_SECURITY
|
|
41 |
+ - scripts/config -e EXT4_FS
|
|
42 |
+ - scripts/config -e EXT4_FS_XATTR
|
|
43 |
+ - scripts/config -e EXT4_FS_POSIX_ACL
|
|
44 |
+ - scripts/config -e EXT4_FS_SECURITY
|
|
45 |
+ - scripts/config -d EXT4_DEBUG
|
|
46 |
+ - scripts/config -e FUSE_FS
|
|
47 |
+ - scripts/config -e OVERLAY_FS
|
|
48 |
+ - scripts/config -e XFS_FS
|
|
49 |
+ - scripts/config -e LIBCRC32C
|
|
50 |
+ - scripts/config -d JBD_DEBUG
|
|
51 |
+ - scripts/config -d JBD2_DEBUG
|
|
52 |
+ - scripts/config -e BLK_DEV_LOOP
|
|
53 |
+ - scripts/config -d BLK_DEV_CRYPTOLOOP
|
|
54 |
+ - scripts/config -e CEPH_FS
|
|
55 |
+ - scripts/config --set-val BLK_DEV_LOOP_MIN_COUNT 8
|
|
56 |
+ - scripts/config -e DM_SNAPSHOT
|
|
57 |
+ - scripts/config -e VIRTIO
|
|
58 |
+ - scripts/config -e VIRTIO_RING
|
|
59 |
+ - scripts/config -e VIRTIO_PCI
|
|
60 |
+ - scripts/config -e VIRTIO_BALLOON
|
|
61 |
+ - scripts/config -e VIRTIO_BLK
|
|
62 |
+ - scripts/config -e VIRTIO_NET
|
|
63 |
+ - scripts/config -e VIRTIO_CONSOLE
|
|
64 |
+ - scripts/config -e HW_RANDOM_VIRTIO
|
|
65 |
+ - scripts/config -e 9P_FS
|
|
66 |
+ - scripts/config -e 9P_FSCACHE
|
|
67 |
+ - scripts/config -e 9P_FS_POSIX_ACL
|
|
68 |
+ - scripts/config -e NET_9P
|
|
69 |
+ - scripts/config -e NET_9P_VIRTIO
|
|
70 |
+ - scripts/config -e R8169
|
|
71 |
+ - scripts/config -e 8139TOO
|
|
72 |
+ - scripts/config -e 8139CP
|
|
73 |
+ - scripts/config -e ATL1
|
|
74 |
+ - scripts/config -e ATL1C
|
|
75 |
+ - scripts/config -e ATL1E
|
|
76 |
+ - scripts/config -e E100
|
|
77 |
+ - scripts/config -e E1000
|
|
78 |
+ - scripts/config -e E1000E
|
|
79 |
+ - scripts/config -e USB_USBNET
|
|
80 |
+ - scripts/config -e USB_NET_AX8817X
|
|
81 |
+ - scripts/config -e USB_NET_AX88179_178A
|
|
82 |
+ - scripts/config -e USB_NET_DM9601
|
|
83 |
+ - scripts/config -e IKCONFIG
|
|
84 |
+ - scripts/config -e IKCONFIG_PROC
|
|
85 |
+ - scripts/config -e SECCOMP
|
|
86 |
+ - scripts/config -d DEBUG_STACK_TRACE
|
|
87 |
+ - scripts/config -e NFSD
|
|
88 |
+ - scripts/config -e NFSD_V3
|
|
89 |
+ - scripts/config -e KVM
|
|
90 |
+ - scripts/config -e TUN
|
|
91 |
+ - scripts/config -e BRIDGE
|
|
92 |
+ - scripts/config -e VHOST_NET
|
|
93 |
+ - scripts/config -e NF_NAT
|
|
94 |
+ - scripts/config -e IP_NF_NAT
|
|
95 |
+ - scripts/config -e IP_NF_TARGET_MASQUERADE
|
|
96 |
+ - scripts/config -e FB_VESA
|
|
97 |
+ - scripts/config -e HOTPLUG_PCI
|
|
98 |
+ - scripts/config -e HOTPLUG_PCI_ACPI
|
|
99 |
+ - scripts/config -e VLAN_8021Q
|
|
100 |
+ - scripts/config -e BRIDGE_VLAN_FILTERING
|
|
101 |
+ - scripts/config -e BLK_DEV_NBD
|
|
102 |
+ - scripts/config -e BRIDGE_NF_EBTABLES
|
|
103 |
+ - scripts/config -e NETFILTER
|
|
104 |
+ - scripts/config -e NETFILTER_ADVANCED
|
|
105 |
+ - scripts/config -e NETFILTER_XT_MATCH_ADDRTYPE
|
|
106 |
+ - scripts/config -e OPENVSWITCH
|
|
107 |
+ - scripts/config -e OPENVSWITCH_VXLAN
|
|
108 |
+ - scripts/config -e CONFIG_OPENVSWITCH_GRE
|
|
109 |
+ - scripts/config -e NET_CLS_BASIC
|
|
110 |
+ - scripts/config -e NET_SCH_INGRESS
|
|
111 |
+ - scripts/config -e NET_ACT_POLICE
|
|
112 |
+ - scripts/config -e NET_IPGRE_DEMUX
|
|
113 |
+ - scripts/config -e NET_SCH_HTB
|
|
114 |
+ - scripts/config -e NET_SCH_HFSC
|
|
115 |
+ - scripts/config -e VXLAN
|
|
116 |
+ - scripts/config -e VETH
|
|
117 |
+ - scripts/config -e IP_NF_MATCH_AH
|
|
118 |
+ - scripts/config -e IP_NF_MATCH_ECN
|
|
119 |
+ - scripts/config -e IP_NF_MATCH_RPFILTER
|
|
120 |
+ - scripts/config -e IP_NF_MATCH_TTL
|
|
121 |
+ - scripts/config -e IP_NF_TARGET_SYNPROXY
|
|
122 |
+ - scripts/config -e IP_NF_TARGET_NETMAP
|
|
123 |
+ - scripts/config -e IP_NF_TARGET_REDIRECT
|
|
124 |
+ - scripts/config -e IP_NF_TARGET_CLUSTERIP
|
|
125 |
+ - scripts/config -e IP_NF_TARGET_ECN
|
|
126 |
+ - scripts/config -e IP_NF_TARGET_TTL
|
|
127 |
+ - scripts/config -e IP_NF_RAW
|
|
128 |
+ - scripts/config -e IP_NF_SECURITY
|
|
129 |
+ - scripts/config -e IP_NF_ARPTABLES
|
|
130 |
+ - scripts/config -e KVM_INTEL
|
|
131 |
+ - scripts/config -e NETFILTER_NETLINK_QUEUE
|
|
132 |
+ - scripts/config -e SCSI_NETLINK
|
|
133 |
+ - scripts/config -e NETFILTER_XT_TARGET_MARK
|
|
134 |
+ - scripts/config -e NETFILTER_XT_SET
|
|
135 |
+ - scripts/config -e IP_SET
|
|
136 |
+ - scripts/config -e IP_SET_BITMAP_IP
|
|
137 |
+ - scripts/config -e IP_SET_BITMAP_IPMAC
|
|
138 |
+ - scripts/config -e IP_SET_BITMAP_PORT
|
|
139 |
+ - scripts/config -e IP_SET_HASH_IP
|
|
140 |
+ - scripts/config -e IP_SET_HASH_IPMARK
|
|
141 |
+ - scripts/config -e IP_SET_HASH_IPPORT
|
|
142 |
+ - scripts/config -e IP_SET_HASH_IPPORTIP
|
|
143 |
+ - scripts/config -e IP_SET_HASH_IPPORTNET
|
|
144 |
+ - scripts/config -e IP_SET_HASH_MAC
|
|
145 |
+ - scripts/config -e IP_SET_HASH_NETPORTNET
|
|
146 |
+ - scripts/config -e IP_SET_HASH_NET
|
|
147 |
+ - scripts/config -e IP_SET_HASH_NETNET
|
|
148 |
+ - scripts/config -e IP_SET_HASH_NETPORT
|
|
149 |
+ - scripts/config -e IP_SET_HASH_NETIFACE
|
|
150 |
+ - scripts/config -e IP_SET_LIST_SET
|
|
151 |
+ - scripts/config -e NF_CONNTRACK_TIMEOUT
|
|
152 |
+ - scripts/config -e NF_CONNTRACK_TIMESTAMP
|
|
153 |
+ - scripts/config -e NF_CONNTRACK_EVENTS
|
|
154 |
+ - scripts/config -e NF_CONNTRACK_LABELS
|
|
155 |
+ - scripts/config -e NETFILTER_NETLINK_ACCT
|
|
156 |
+ - scripts/config -e NETFILTER_NETLINK_QUEUE_CT
|
|
157 |
+ - scripts/config -e NF_CT_PROTO_DCCP
|
|
158 |
+ - scripts/config -e NF_CT_PROTO_GRE
|
|
159 |
+ - scripts/config -e NF_CT_PROTO_SCTP
|
|
160 |
+ - scripts/config -e NF_CT_PROTO_UDPLITE
|
|
161 |
+ - scripts/config -e NF_CT_NETLINK_TIMEOUT
|
|
162 |
+ - scripts/config -e NF_CT_NETLINK_HELPER
|
|
163 |
+ - scripts/config -e NF_CONNTRACK_AMANDA
|
|
164 |
+ - scripts/config -e NF_CONNTRACK_H323
|
|
165 |
+ - scripts/config -e NF_CONNTRACK_BROADCAST
|
|
166 |
+ - scripts/config -e NF_CONNTRACK_NETBIOS_NS
|
|
167 |
+ - scripts/config -e NF_CONNTRACK_SNMP
|
|
168 |
+ - scripts/config -e NF_CONNTRACK_PPTP
|
|
169 |
+ - scripts/config -e NF_CONNTRACK_SANE
|
|
170 |
+ - scripts/config -e NF_CONNTRACK_TFTP
|
|
171 |
+ - scripts/config -e NF_LOG_COMMON
|
|
172 |
+ - scripts/config -e NF_NAT_PROTO_DCCP
|
|
173 |
+ - scripts/config -e NF_NAT_PROTO_UDPLITE
|
|
174 |
+ - scripts/config -e NF_NAT_PROTO_SCTP
|
|
175 |
+ - scripts/config -e NF_NAT_AMANDA
|
|
176 |
+ - scripts/config -e NF_NAT_TFTP
|
|
177 |
+ - scripts/config -e NF_TABLES
|
|
178 |
+ - scripts/config -e NF_TABLES_INET
|
|
179 |
+ - scripts/config -e NFT_COMPAT
|
|
180 |
+ - scripts/config -e NFT_EXTHDR
|
|
181 |
+ - scripts/config -e NFT_META
|
|
182 |
+ - scripts/config -e NFT_CT
|
|
183 |
+ - scripts/config -e NFT_LIMIT
|
|
184 |
+ - scripts/config -e NFT_NAT
|
|
185 |
+ - scripts/config -e NFT_QUEUE
|
|
186 |
+ - scripts/config -e NFT_REJECT
|
|
187 |
+ - scripts/config -e NFT_REJECT_INET
|
|
188 |
+ - scripts/config -e NFT_RBTREE
|
|
189 |
+ - scripts/config -e NFT_HASH
|
|
190 |
+ - scripts/config -e NFT_COUNTER
|
|
191 |
+ - scripts/config -e NFT_LOG
|
|
192 |
+ - scripts/config -e NFT_MASQ
|
|
193 |
+ - scripts/config -e NETFILTER_XT_CONNMARK
|
|
194 |
+ - scripts/config -e NETFILTER_XT_TARGET_AUDIT
|
|
195 |
+ - scripts/config -e NETFILTER_XT_TARGET_CHECKSUM
|
|
196 |
+ - scripts/config -e NETFILTER_XT_TARGET_CLASSIFY
|
|
197 |
+ - scripts/config -e NETFILTER_XT_TARGET_CT
|
|
198 |
+ - scripts/config -e NETFILTER_XT_TARGET_DSCP
|
|
199 |
+ - scripts/config -e NETFILTER_XT_TARGET_HMARK
|
|
200 |
+ - scripts/config -e NETFILTER_XT_TARGET_LED
|
|
201 |
+ - scripts/config -e NETFILTER_XT_TARGET_LOG
|
|
202 |
+ - scripts/config -e NETFILTER_XT_TARGET_NFQUEUE
|
|
203 |
+ - scripts/config -e NETFILTER_XT_TARGET_RATEEST
|
|
204 |
+ - scripts/config -e NETFILTER_XT_TARGET_TPROXY
|
|
205 |
+ - scripts/config -e NETFILTER_XT_TARGET_TCPOPTSTRIP
|
|
206 |
+ - scripts/config -e NETFILTER_XT_TARGET_TEE
|
|
207 |
+ - scripts/config -e NETFILTER_XT_TARGET_TRACE
|
|
208 |
+ - scripts/config -e NETFILTER_XT_TARGET_IDLETIMER
|
|
209 |
+ - scripts/config -e NETFILTER_XT_MATCH_BPF
|
|
210 |
+ - scripts/config -e NETFILTER_XT_MATCH_CLUSTER
|
|
211 |
+ - scripts/config -e NETFILTER_XT_MATCH_COMMENT
|
|
212 |
+ - scripts/config -e NETFILTER_XT_MATCH_CONNBYTES
|
|
213 |
+ - scripts/config -e NETFILTER_XT_MATCH_CONNLABEL
|
|
214 |
+ - scripts/config -e NETFILTER_XT_MATCH_CONNLIMIT
|
|
215 |
+ - scripts/config -e NETFILTER_XT_MATCH_CPU
|
|
216 |
+ - scripts/config -e NETFILTER_XT_MATCH_DCCP
|
|
217 |
+ - scripts/config -e NETFILTER_XT_MATCH_DEVGROUP
|
|
218 |
+ - scripts/config -e NETFILTER_XT_MATCH_DSCP
|
|
219 |
+ - scripts/config -e NETFILTER_XT_MATCH_ESP
|
|
220 |
+ - scripts/config -e NETFILTER_XT_MATCH_HASHLIMIT
|
|
221 |
+ - scripts/config -e NETFILTER_XT_MATCH_HELPER
|
|
222 |
+ - scripts/config -e NETFILTER_XT_MATCH_IPCOMP
|
|
223 |
+ - scripts/config -e NETFILTER_XT_MATCH_IPRANGE
|
|
224 |
+ - scripts/config -e NETFILTER_XT_MATCH_IPVS
|
|
225 |
+ - scripts/config -e NETFILTER_XT_MATCH_L2TP
|
|
226 |
+ - scripts/config -e NETFILTER_XT_MATCH_LENGTH
|
|
227 |
+ - scripts/config -e NETFILTER_XT_MATCH_LIMIT
|
|
228 |
+ - scripts/config -e NETFILTER_XT_MATCH_MAC
|
|
229 |
+ - scripts/config -e NETFILTER_XT_MATCH_MULTIPORT
|
|
230 |
+ - scripts/config -e NETFILTER_XT_MATCH_NFACCT
|
|
231 |
+ - scripts/config -e NETFILTER_XT_MATCH_OSF
|
|
232 |
+ - scripts/config -e NETFILTER_XT_MATCH_OWNER
|
|
233 |
+ - scripts/config -e NETFILTER_XT_MATCH_CGROUP
|
|
234 |
+ - scripts/config -e NETFILTER_XT_MATCH_PHYSDEV
|
|
235 |
+ - scripts/config -e NETFILTER_XT_MATCH_PKTTYPE
|
|
236 |
+ - scripts/config -e NETFILTER_XT_MATCH_QUOTA
|
|
237 |
+ - scripts/config -e NETFILTER_XT_MATCH_RATEEST
|
|
238 |
+ - scripts/config -e NETFILTER_XT_MATCH_REALM
|
|
239 |
+ - scripts/config -e NETFILTER_XT_MATCH_RECENT
|
|
240 |
+ - scripts/config -e NETFILTER_XT_MATCH_SCTP
|
|
241 |
+ - scripts/config -e NETFILTER_XT_MATCH_SOCKET
|
|
242 |
+ - scripts/config -e NETFILTER_XT_MATCH_STATISTIC
|
|
243 |
+ - scripts/config -e NETFILTER_XT_MATCH_STRING
|
|
244 |
+ - scripts/config -e NETFILTER_XT_MATCH_TCPMSS
|
|
245 |
+ - scripts/config -e NETFILTER_XT_MATCH_TIME
|
|
246 |
+ - scripts/config -e NETFILTER_XT_MATCH_U32
|
|
247 |
+ - scripts/config -e IP_VS
|
|
248 |
+ - scripts/config -e BRIDGE_NETFILTER
|
|
249 |
+ - scripts/config -e CRYPTO_CRC32C
|
|
250 |
+ - scripts/config -e CONFIGFS_FS
|
|
251 |
+ - scripts/config -e EXPERT
|
|
252 |
+ - scripts/config -e TARGET_CORE
|
|
253 |
+ - scripts/config -e ISCSI_TARGET
|
|
254 |
+ - scripts/config -e TCM_IBLOCK
|
|
255 |
+ - scripts/config -e TCM_FILEIO
|
|
256 |
+ - scripts/config -e TCM_PSCSI
|
|
257 |
+ - scripts/config -e TCM_USER
|
|
258 |
+ - scripts/config -e CONFIG_UIO
|
|
259 |
+ - scripts/config -e LOOPBACK_TARGET
|
|
260 |
+ - scripts/config -e TCM_FC
|
|
261 |
+ - scripts/config -e LIBFC
|
|
262 |
+ - scripts/config -e SCSI_FC_ATTRS
|
|
263 |
+ - scripts/config -e SCSI_ISCSI_ATTRS
|
|
264 |
+ - scripts/config -e ISCSI_TCP
|
|
265 |
+ - scripts/config -e SCSI_LOWLEVEL
|
|
266 |
+ - scripts/config -e SCSI_VIRTIO
|
|
267 |
+ - scripts/config -e HYPERVISOR_GUEST
|
|
268 |
+ - scripts/config -e PARAVIRT
|
|
269 |
+ - scripts/config -e CONFIG_SND_INTEL8X0
|
|
270 |
+ - scripts/config -m CONFIG_DRM_CIRRUS_QEMU
|
|
271 |
+ - scripts/config -m CONFIG_DRM_BOCHS
|
|
272 |
+ - scripts/config -m CONFIG_DRM_VIRTIO_GPU
|
|
273 |
+ - scripts/config -e BT
|
|
274 |
+ - yes '' | make oldconfig
|
|
275 |
+ build-commands:
|
|
276 |
+ - make $MAKEFLAGS
|
|
277 |
+ install-commands:
|
|
278 |
+ - mkdir -p "%{install-root}"/boot
|
|
279 |
+ - make INSTALL_PATH="%{install-root}"/boot install
|
|
280 |
+ - make INSTALL_MOD_PATH="%{install-root}" modules_install
|
|
281 |
+ - install -d "%{install-root}%{prefix}/src/linux"
|
|
282 |
+ - |
|
|
283 |
+ (
|
|
284 |
+ printf 'Makefile\0'
|
|
285 |
+ printf 'Module.symvers\0'
|
|
286 |
+ find arch/x86 -maxdepth 1 -name 'Makefile*' -print0
|
|
287 |
+ find arch/x86 \( -name 'module.lds' -o -name 'Kbuild.platforms' -o -name 'Platform' \) -print0
|
|
288 |
+ find arch/x86 \( -type d -a \( -name include -o -name scripts \) \) -o \
|
|
289 |
+ \! -type d -a \( -path '*include/*' -o -path '*scripts/*' \) -print0
|
|
290 |
+ find include -name 'asm*' -prune -o -print0
|
|
291 |
+ find include/asm-generic -print0
|
|
292 |
+ find include/uapi -print0
|
|
293 |
+ find scripts -print0
|
|
294 |
+ ) | cpio -0pumd "%{install-root}%{prefix}/src/linux"
|
|
295 |
+public:
|
|
296 |
+ bst:
|
|
297 |
+ integration-commands:
|
|
298 |
+ - if which depmod; then (cd /usr/lib/modules && for version in *; do depmod -a
|
|
299 |
+ "$version"; done) fi
|
1 |
+# elements/image/system.bst
|
|
2 |
+ |
|
3 |
+kind: compose
|
|
4 |
+description: The system installed onto the image
|
|
5 |
+ |
|
6 |
+depends:
|
|
7 |
+ - filename: contents.bst
|
|
8 |
+ type: build
|
|
9 |
+ - filename: image/linux.bst
|
|
10 |
+ type: build
|
|
11 |
+ - filename: image/initramfs/initramfs-gz.bst
|
|
12 |
+ type: build
|
|
13 |
+ |
|
14 |
+config:
|
|
15 |
+ include:
|
|
16 |
+ - runtime
|
1 |
+#!/bin/ash
|
|
2 |
+ |
|
3 |
+echo 'Hello World!'
|
1 |
+#!/bin/sh
|
|
2 |
+trap 'exec /bin/sh' INT EXIT
|
|
3 |
+ |
|
4 |
+# We need proc for reading the kernel command line
|
|
5 |
+mount -n -t proc none /proc
|
|
6 |
+ |
|
7 |
+set -- $(cat /proc/cmdline)
|
|
8 |
+ |
|
9 |
+# We don't want to leave mount points around
|
|
10 |
+umount /proc
|
|
11 |
+ |
|
12 |
+rootwait=true # defaults to off in the kernel, I think it's more useful on
|
|
13 |
+for arg; do
|
|
14 |
+ case "$arg" in
|
|
15 |
+ root=LABEL=*)
|
|
16 |
+ if [ x"$root_type" != x ]; then
|
|
17 |
+ echo "Warning, multiple root= specified, using latest."
|
|
18 |
+ fi
|
|
19 |
+ root_type=label
|
|
20 |
+ root="${arg#root=LABEL=}"
|
|
21 |
+ ;;
|
|
22 |
+ root=UUID=*)
|
|
23 |
+ if [ x"$root_type" != x ]; then
|
|
24 |
+ echo "Warning, multiple root= specified, using latest."
|
|
25 |
+ fi
|
|
26 |
+ root_type=uuid
|
|
27 |
+ root="${arg#root=UUID=}"
|
|
28 |
+ ;;
|
|
29 |
+ root=*)
|
|
30 |
+ if [ x"$root_type" != x ]; then
|
|
31 |
+ echo "Warning, multiple root= specified, using latest."
|
|
32 |
+ fi
|
|
33 |
+ root_type=disk
|
|
34 |
+ root="${arg#root=}"
|
|
35 |
+ ;;
|
|
36 |
+ rootflags=*)
|
|
37 |
+ if [ x"$rootflags" != x ]; then
|
|
38 |
+ echo "Warning, multiple rootflags= specified, using latest."
|
|
39 |
+ fi
|
|
40 |
+ rootflags=",${arg#rootflags=}"
|
|
41 |
+ ;;
|
|
42 |
+ rootfstype=*)
|
|
43 |
+ if [ x"$rootfstype" != x ]; then
|
|
44 |
+ echo "Warning, multiple rootfstype= specified, using latest."
|
|
45 |
+ fi
|
|
46 |
+ rootfstype="${arg#rootfstype=}"
|
|
47 |
+ ;;
|
|
48 |
+ rootdelay=*)
|
|
49 |
+ if [ x"$rootdelay" != x ]; then
|
|
50 |
+ echo "Warning, multiple rootdelay= specified, using latest."
|
|
51 |
+ fi
|
|
52 |
+ rootdelay="${arg#rootdelay=}"
|
|
53 |
+ ;;
|
|
54 |
+ rootwait)
|
|
55 |
+ rootwait=true
|
|
56 |
+ ;;
|
|
57 |
+ norootwait)
|
|
58 |
+ rootwait=false
|
|
59 |
+ ;;
|
|
60 |
+ ro)
|
|
61 |
+ ro=ro
|
|
62 |
+ ;;
|
|
63 |
+ rw)
|
|
64 |
+ ro=rw
|
|
65 |
+ ;;
|
|
66 |
+ init=*)
|
|
67 |
+ init="${arg#init=}"
|
|
68 |
+ ;;
|
|
69 |
+ esac
|
|
70 |
+done
|
|
71 |
+ |
|
72 |
+ |
|
73 |
+if [ x"$rootdelay" != x ]; then
|
|
74 |
+ sleep "$rootdelay"
|
|
75 |
+fi
|
|
76 |
+ |
|
77 |
+if [ x"$rootfstype" = x ]; then
|
|
78 |
+ # Warn that busybox may not be able to auto-detect rootfs type
|
|
79 |
+ cat <<\EOF
|
|
80 |
+Warning, rootfs type not specified, auto-detection of type is slow and
|
|
81 |
+may fail. Please add rootfstype=$type to kernel command line.
|
|
82 |
+EOF
|
|
83 |
+fi
|
|
84 |
+ |
|
85 |
+mount -n -t devtmpfs devtmpfs /dev
|
|
86 |
+ |
|
87 |
+while true; do
|
|
88 |
+ case "$root_type" in
|
|
89 |
+ disk)
|
|
90 |
+ if mount -n -t "${rootfstype}" -o "${ro-rw}""$rootflags" "$root" /mnt; then
|
|
91 |
+ break
|
|
92 |
+ else
|
|
93 |
+ echo disk $root not found
|
|
94 |
+ blkid
|
|
95 |
+ fi
|
|
96 |
+ ;;
|
|
97 |
+ label)
|
|
98 |
+ disk="$(findfs LABEL="$root")"
|
|
99 |
+ if [ x"$disk" = x ]; then
|
|
100 |
+ echo disk with label $root not found
|
|
101 |
+ blkid
|
|
102 |
+ else
|
|
103 |
+ mount -n -t "${rootfstype}" -o "${ro-rw}""$rootflags" "$disk" /mnt && break
|
|
104 |
+ fi
|
|
105 |
+ ;;
|
|
106 |
+ uuid)
|
|
107 |
+ disk="$(findfs UUID="$root")"
|
|
108 |
+ if [ x"$disk" = x ]; then
|
|
109 |
+ echo disk with UUID $root not found
|
|
110 |
+ blkid
|
|
111 |
+ else
|
|
112 |
+ mount -n -t "${rootfstype}" -o "${ro-rw}""$rootflags" "$disk" /mnt && break
|
|
113 |
+ fi
|
|
114 |
+ ;;
|
|
115 |
+ '')
|
|
116 |
+ echo "Error, no root specified"
|
|
117 |
+ exit 1
|
|
118 |
+ ;;
|
|
119 |
+ esac
|
|
120 |
+ if "$rootwait"; then
|
|
121 |
+ echo Trying again in 0.5 seconds
|
|
122 |
+ sleep 0.5
|
|
123 |
+ fi
|
|
124 |
+done
|
|
125 |
+umount -n /dev
|
|
126 |
+ |
|
127 |
+# We dont create any static device nodes while building,
|
|
128 |
+# device nodes will be created by systemd but before that
|
|
129 |
+# we at least need the console
|
|
130 |
+mknod -m 0600 /mnt/dev/console c 5 1
|
|
131 |
+ |
|
132 |
+exec switch_root -c /dev/console /mnt "${init-/sbin/init}"
|
1 |
+#!/bin/sh
|
|
2 |
+ |
|
3 |
+fail(){
|
|
4 |
+ echo "$@" >&2
|
|
5 |
+ # The behaviour on failure of systemd when shutting down without a
|
|
6 |
+ # shutdownramfs is to freeze if it fails, but the behaviour of an initramfs
|
|
7 |
+ # on failure is to drop you into a recovery shell. The latter seems more
|
|
8 |
+ # useful.
|
|
9 |
+ exec /bin/sh
|
|
10 |
+}
|
|
11 |
+ |
|
12 |
+startswith(){
|
|
13 |
+ # Filter out lines that don't start with $1
|
|
14 |
+ # grep ^EXPR is usually sufficient, but would require escaping of EXPR.
|
|
15 |
+ # Instead this compares the line to the line with its prefix stripped,
|
|
16 |
+ # so if the line is different, then it started with that prefix.
|
|
17 |
+ # It's ugly, but is less logic than escaping the regular _expression_ and
|
|
18 |
+ # using grep, more reliable than not making any effort to escape, and
|
|
19 |
+ # less surprising than requiring the parameter to be pre-escaped.
|
|
20 |
+ while read -r line; do
|
|
21 |
+ if [ "${line#"$1"}" != "$line" ]; then
|
|
22 |
+ printf '%s\n' "$line"
|
|
23 |
+ fi
|
|
24 |
+ done
|
|
25 |
+}
|
|
26 |
+ |
|
27 |
+recursive_umount(){
|
|
28 |
+ # Recursively unmount every mountpoint under $1.
|
|
29 |
+ # This works by filtering to select mountpoints from mountinfo that start
|
|
30 |
+ # with the absolute path of the directory given.
|
|
31 |
+ # It unmounts in reverse-order, so that it may unmount dependent mounts
|
|
32 |
+ # first, and it has to handle the paths having octal escape sequences.
|
|
33 |
+ set -- "$(readlink -f "$1")"
|
|
34 |
+ cut -d' ' -f5 /proc/self/mountinfo | startswith "$1" \
|
|
35 |
+ | sort -r | while read -r mp; do
|
|
36 |
+ umount "$(echo -e "$mp")"
|
|
37 |
+ done
|
|
38 |
+}
|
|
39 |
+ |
|
40 |
+# Give the rootfs another chance to write its state to disk.
|
|
41 |
+sync
|
|
42 |
+ |
|
43 |
+# Kill any http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons/
|
|
44 |
+# as we don't have any facility to cleanly shut them down in this initramfs.
|
|
45 |
+killall5
|
|
46 |
+ |
|
47 |
+# Recursively unmount the old root, so they have a chance of performing
|
|
48 |
+# unmount-time cleanup.
|
|
49 |
+recursive_umount /oldroot
|
|
50 |
+ |
|
51 |
+case "$1" in
|
|
52 |
+reboot|poweroff|halt)
|
|
53 |
+ if ! "$1" -f; then
|
|
54 |
+ fail "$1 command failed"
|
|
55 |
+ fi
|
|
56 |
+ ;;
|
|
57 |
+kexec)
|
|
58 |
+ # probably don't have this, but we'll try anyway
|
|
59 |
+ if ! kexec -e; then
|
|
60 |
+ fail "$1 command failed"
|
|
61 |
+ fi
|
|
62 |
+ ;;
|
|
63 |
+*)
|
|
64 |
+ fail "Unrecognized shutdown verb $1"
|
|
65 |
+ ;;
|
|
66 |
+esac
|
|
67 |
+ |
1 |
+# project.conf
|
|
2 |
+ |
|
3 |
+name: test-image
|
|
4 |
+element-path: elements
|
|
5 |
+ |
|
6 |
+# Allow the project use any version higher than 0 of the x86image
|
|
7 |
+# plugin installed through pip from the bst-external package
|
|
8 |
+plugins:
|
|
9 |
+ - origin: pip
|
|
10 |
+ package-name: BuildStream-external
|
|
11 |
+ elements:
|
|
12 |
+ x86image: 0
|
|
13 |
+ - origin: pip
|
|
14 |
+ package-name: BuildStream-external
|
|
15 |
+ elements:
|
|
16 |
+ docker: 0
|
|
17 |
+ |
|
18 |
+aliases:
|
|
19 |
+ kernel: https://www.kernel.org/pub/
|
|
20 |
+ gnu: http://ftp.gnu.org/gnu/
|
|
21 |
+ busybox: https://www.busybox.net/downloads/
|
1 |
+:orphan:
|
|
2 |
+ |
|
3 |
+.. _examples:
|
|
4 |
+ |
|
5 |
+Examples
|
|
6 |
+========
|
|
7 |
+ |
|
8 |
+This page contains examples of BuildStream projects using external
|
|
9 |
+plugins, described step by step. All run under CI, so you can trust
|
|
10 |
+they are maintained and work as expected.
|
|
11 |
+ |
|
12 |
+ |
|
13 |
+.. toctree::
|
|
14 |
+ :maxdepth: 1
|
|
15 |
+ |
|
16 |
+ examples/image-authoring
|
1 |
+.. _examples_image_authoring:
|
|
2 |
+ |
|
3 |
+Building a system image
|
|
4 |
+=======================
|
|
5 |
+ |
|
6 |
+.. note::
|
|
7 |
+ |
|
8 |
+ This example is distributed with BuildStream-external in the
|
|
9 |
+ `doc/examples/image-authoring
|
|
10 |
+ <https://gitlab.com/BuildStream/bst-external/tree/master/doc/examples/image-authoring>`_
|
|
11 |
+ subdirectory.
|
|
12 |
+ |
|
13 |
+Project structure
|
|
14 |
+-----------------
|
|
15 |
+ |
|
16 |
+We set a :ref:`project <projectconf>` definition as follows:
|
|
17 |
+ |
|
18 |
+``project.conf``
|
|
19 |
+~~~~~~~~~~~~~~~~
|
|
20 |
+ |
|
21 |
+.. literalinclude:: ../../examples/image-authoring/project.conf
|
|
22 |
+ :language: yaml
|
|
23 |
+ |
|
24 |
+Since we require plugins currently not part of the core set, we set up
|
|
25 |
+the plugins to be used by this project. In this case, we will use the
|
|
26 |
+x86image plugin to create the image and the docker plugin to acquire a
|
|
27 |
+base image to work with.
|
|
28 |
+ |
|
29 |
+We also add :ref:`source aliases <project_source_aliases>` for a few
|
|
30 |
+sources we will use.
|
|
31 |
+ |
|
32 |
+``elements/base.bst``
|
|
33 |
+~~~~~~~~~~~~~~~~~~~~~
|
|
34 |
+ |
|
35 |
+.. literalinclude:: ../../examples/image-authoring/elements/base.bst
|
|
36 |
+ :language: yaml
|
|
37 |
+ |
|
38 |
+This is the :mod:`import <elements.import>` element used to import the
|
|
39 |
+base image that will write the image we want to create. This is a
|
|
40 |
+`BuildStream docker image
|
|
41 |
+<https://gitlab.com/BuildStream/buildstream-docker-images/tree/master/image-tools>`_
|
|
42 |
+made to help using BuildStream to create OS images.
|
|
43 |
+ |
|
44 |
+``elements/contents.bst``
|
|
45 |
+~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
46 |
+ |
|
47 |
+.. literalinclude:: ../../examples/image-authoring/elements/contents.bst
|
|
48 |
+ :language: yaml
|
|
49 |
+ |
|
50 |
+This element defines the contents of our image. For this example, we
|
|
51 |
+will set up a system containing `BusyBox <https://www.busybox.net/>`_
|
|
52 |
+and a hello world script. Since these are best defined as two separate
|
|
53 |
+elements, we use a :mod:`stack <elements.stack>` element to pull in
|
|
54 |
+these dependencies.
|
|
55 |
+ |
|
56 |
+``elements/contents/busybox.bst``
|
|
57 |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
58 |
+ |
|
59 |
+.. literalinclude:: ../../examples/image-authoring/elements/contents/busybox.bst
|
|
60 |
+ :language: yaml
|
|
61 |
+ |
|
62 |
+This defines our BusyBox contents - for the uninitiated, BusyBox is a
|
|
63 |
+set of basic UNIX commands usually expected on a Linux machine, and
|
|
64 |
+brings the main components of our shell environment. For more info,
|
|
65 |
+check `BusyBox's about page <https://www.busybox.net/about.html>`_.
|
|
66 |
+ |
|
67 |
+``elements/contents/musl.bst``
|
|
68 |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
69 |
+ |
|
70 |
+.. literalinclude:: ../../examples/image-authoring/elements/contents/musl.bst
|
|
71 |
+ :language: yaml
|
|
72 |
+ |
|
73 |
+This defines `musl libc <https://www.musl-libc.org/>`_, a small C
|
|
74 |
+library. It is required to run BusyBox.
|
|
75 |
+ |
|
76 |
+``elements/contents/hello.bst``
|
|
77 |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
78 |
+ |
|
79 |
+.. literalinclude:: ../../examples/image-authoring/elements/contents/hello.bst
|
|
80 |
+ :language: yaml
|
|
81 |
+ |
|
82 |
+This contains the following script for testing purposes. This element
|
|
83 |
+is really just there to show that we're not cheating and downloading
|
|
84 |
+an alpine Linux image ;)
|
|
85 |
+ |
|
86 |
+``files/hello/hello``
|
|
87 |
+ |
|
88 |
+.. literalinclude:: ../../examples/image-authoring/files/hello/hello
|
|
89 |
+ :language: sh
|
|
90 |
+ |
|
91 |
+``elements/image-x86_64.bst``
|
|
92 |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
93 |
+ |
|
94 |
+.. literalinclude:: ../../examples/image-authoring/elements/image-x86_64.bst
|
|
95 |
+ :language: yaml
|
|
96 |
+ |
|
97 |
+This is our :ref:`x86image` element. It will do perform the actual
|
|
98 |
+image creation for us, using the image tools from
|
|
99 |
+``elements/base.bst`` and writing contents from ``image/system.bst``.
|
|
100 |
+ |
|
101 |
+Both dependencies are marked as ``build`` dependencies, since they
|
|
102 |
+will not be part of our output. This may be slightly counter-intuitive
|
|
103 |
+since ``image/system.bst`` is to represent our image contents, but the
|
|
104 |
+literal files in it will not be a part of the artifact produced by
|
|
105 |
+BuildStream.
|
|
106 |
+ |
|
107 |
+In the ``variables`` section we set up the layout of the image. We set
|
|
108 |
+up the partitioning scheme with ``boot-size``, ``root-size`` and
|
|
109 |
+``swap-size``, we set our desired ``sector-size`` and we set how our
|
|
110 |
+kernel will be invoked with ``kernel-args`` and ``kernel-name``.
|
|
111 |
+ |
|
112 |
++-----------+------------------------------+
|
|
113 |
+|boot-size |The size of the boot partition|
|
|
114 |
++-----------+------------------------------+
|
|
115 |
+|rootfs-size|The size of the rootfs |
|
|
116 |
++-----------+------------------------------+
|
|
117 |
+|sector-size|The sector size |
|
|
118 |
++-----------+------------------------------+
|
|
119 |
+|swap-size |The size of the swap partition|
|
|
120 |
++-----------+------------------------------+
|
|
121 |
+|kernel-args|The kernel args to pass on |
|
|
122 |
+| |boot |
|
|
123 |
++-----------+------------------------------+
|
|
124 |
+|kernel-name|What to name the kernel binary|
|
|
125 |
++-----------+------------------------------+
|
|
126 |
+ |
|
127 |
+ |
|
128 |
+``elements/image/linux.bst``
|
|
129 |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
130 |
+ |
|
131 |
+.. literalinclude:: ../../examples/image-authoring/elements/image/linux.bst
|
|
132 |
+ :language: yaml
|
|
133 |
+ |
|
134 |
+This element contains, well, Linux. If we're going to build an OS
|
|
135 |
+image, it might as well be Linux. This will be the kernel deployed to
|
|
136 |
+our OS image.
|
|
137 |
+ |
|
138 |
+``elements/image/initramfs/initramfs.bst``
|
|
139 |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
140 |
+ |
|
141 |
+.. literalinclude:: ../../examples/image-authoring/elements/image/initramfs/initramfs-gz.bst
|
|
142 |
+ :language: yaml
|
|
143 |
+ |
|
144 |
+FIXME: Obviously, we should be booting something bigger
|
|
145 |
+ |
|
146 |
+The initial file system loaded into the image. It currently contains a
|
|
147 |
+copy of the system, but if the system was larger this would be neat.
|
|
148 |
+ |
|
149 |
+``elements/image/initramfs/initramfs-scripts.bst``
|
|
150 |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
151 |
+ |
|
152 |
+.. literalinclude:: ../../examples/image-authoring/elements/image/initramfs/initramfs-scripts.bst
|
|
153 |
+ :language: yaml
|
|
154 |
+ |
|
155 |
+The startup scripts to be run in the initramfs:
|
|
156 |
+ |
|
157 |
+``files/initramfs-scripts/init``
|
|
158 |
+ |
|
159 |
+.. literalinclude:: ../../examples/image-authoring/files/initramfs-scripts/init
|
|
160 |
+ :language: sh
|
|
161 |
+ |
|
162 |
+``files/initramfs-scripts/shutdown``
|
|
163 |
+ |
|
164 |
+.. literalinclude:: ../../examples/image-authoring/files/initramfs-scripts/shutdown
|
|
165 |
+ :language: sh
|
|
166 |
+ |
|
167 |
+``elements/image/initramfs/initramfs-gz.bst``
|
|
168 |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
169 |
+ |
|
170 |
+.. literalinclude:: ../../examples/image-authoring/elements/image/initramfs/initramfs-gz.bst
|
|
171 |
+ :language: yaml
|
|
172 |
+ |
|
173 |
+This element will produce the initramfs' file list and gzip it. In
|
|
174 |
+essence, this is what produces the actual ``initramfs.gz`` file
|
|
175 |
+ |
|
176 |
+``elements/image/system.bst``
|
|
177 |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
178 |
+ |
|
179 |
+.. literalinclude:: ../../examples/image-authoring/elements/image/system.bst
|
|
180 |
+ :language: yaml
|
|
181 |
+ |
|
182 |
+This element stacks together all the image contents and ensures we
|
|
183 |
+have only runtime files left. This is what is actually staged onto the
|
|
184 |
+image.
|
... | ... | @@ -24,3 +24,8 @@ Contained Sources |
24 | 24 |
|
25 | 25 |
* :mod:`docker <sources.docker>`
|
26 | 26 |
* :mod:`quilt <sources.quilt>`
|
27 |
+ |
|
28 |
+Examples
|
|
29 |
+--------
|
|
30 |
+ |
|
31 |
+* :ref:`examples`
|