summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Bénard <eric@eukrea.com>2012-12-24 13:19:52 +0100
committerEric Bénard <eric@eukrea.com>2013-01-07 11:53:09 +0100
commit9ef11b2c062464862025a2610d312b2cea882aeb (patch)
tree2e8fec43774eb035217cb4cbcd3e5919b48341a5
parent06ea40eb6dd84922423da88f06154aba6574eedc (diff)
downloadmeta-openembedded-9ef11b2c062464862025a2610d312b2cea882aeb.tar.gz
systemd: recover previous _git recipe
Signed-off-by: Eric Bénard <eric@eukrea.com>
-rw-r--r--meta-oe/recipes-core/systemd/systemd/format-replace-m-uclibc.patch380
-rw-r--r--meta-oe/recipes-core/systemd/systemd/paper-over-mkostemp.patch19
-rw-r--r--meta-oe/recipes-core/systemd/systemd_git.bb161
3 files changed, 560 insertions, 0 deletions
diff --git a/meta-oe/recipes-core/systemd/systemd/format-replace-m-uclibc.patch b/meta-oe/recipes-core/systemd/systemd/format-replace-m-uclibc.patch
new file mode 100644
index 000000000..1c95023bb
--- /dev/null
+++ b/meta-oe/recipes-core/systemd/systemd/format-replace-m-uclibc.patch
@@ -0,0 +1,380 @@
1Patch from Henning. %m is a glibc only thing. For uclibc we need to do it
2differently. So we use static strings instead of mallocing them and free'ing
3
4I dont know if upstream systemd have plans to make systemd work on non
5glibc system libraries if not then this patch would not make sense for
6upstream
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9
10Index: git/src/mount-setup.c
11===================================================================
12--- git.orig/src/mount-setup.c 2012-01-25 21:27:23.000000000 -0800
13+++ git/src/mount-setup.c 2012-01-25 21:59:43.897031326 -0800
14@@ -182,10 +182,10 @@
15 (void) fgets(buf, sizeof(buf), f);
16
17 for (;;) {
18- char *controller;
19+ char controller[30];
20 int enabled = 0;
21
22- if (fscanf(f, "%ms %*i %*i %i", &controller, &enabled) != 2) {
23+ if (fscanf(f, "%s %*i %*i %i", controller, &enabled) != 2) {
24
25 if (feof(f))
26 break;
27@@ -196,14 +196,12 @@
28 }
29
30 if (!enabled) {
31- free(controller);
32 continue;
33 }
34
35 r = set_put(controllers, controller);
36 if (r < 0) {
37 log_error("Failed to add controller to set.");
38- free(controller);
39 goto finish;
40 }
41 }
42@@ -273,7 +271,6 @@
43 p.fatal = false;
44
45 r = mount_one(&p, true);
46- free(controller);
47 free(where);
48
49 if (r < 0) {
50Index: git/src/socket-util.c
51===================================================================
52--- git.orig/src/socket-util.c 2012-01-25 21:27:23.000000000 -0800
53+++ git/src/socket-util.c 2012-01-25 21:59:43.897031326 -0800
54@@ -192,7 +192,7 @@
55 int socket_address_parse_netlink(SocketAddress *a, const char *s) {
56 int family;
57 unsigned group = 0;
58- char* sfamily = NULL;
59+ char sfamily[50];
60 assert(a);
61 assert(s);
62
63@@ -200,17 +200,14 @@
64 a->type = SOCK_RAW;
65
66 errno = 0;
67- if (sscanf(s, "%ms %u", &sfamily, &group) < 1)
68+ if (sscanf(s, "%49s %u", &sfamily, &group) < 1)
69 return errno ? -errno : -EINVAL;
70
71 if ((family = netlink_family_from_string(sfamily)) < 0)
72 if (safe_atoi(sfamily, &family) < 0) {
73- free(sfamily);
74 return -EINVAL;
75 }
76
77- free(sfamily);
78-
79 a->sockaddr.nl.nl_family = AF_NETLINK;
80 a->sockaddr.nl.nl_groups = group;
81
82Index: git/src/swap.c
83===================================================================
84--- git.orig/src/swap.c 2012-01-25 21:27:23.000000000 -0800
85+++ git/src/swap.c 2012-01-25 21:59:43.897031326 -0800
86@@ -1049,11 +1049,12 @@
87 (void) fscanf(m->proc_swaps, "%*s %*s %*s %*s %*s\n");
88
89 for (i = 1;; i++) {
90- char *dev = NULL, *d;
91+ char *d;
92+ char dev[20];
93 int prio = 0, k;
94
95 if ((k = fscanf(m->proc_swaps,
96- "%ms " /* device/file */
97+ "%19s " /* device/file */
98 "%*s " /* type of swap */
99 "%*s " /* swap size */
100 "%*s " /* used */
101@@ -1064,12 +1065,10 @@
102 break;
103
104 log_warning("Failed to parse /proc/swaps:%u.", i);
105- free(dev);
106 continue;
107 }
108
109 d = cunescape(dev);
110- free(dev);
111
112 if (!d)
113 return -ENOMEM;
114Index: git/src/tmpfiles.c
115===================================================================
116--- git.orig/src/tmpfiles.c 2012-01-25 21:27:23.000000000 -0800
117+++ git/src/tmpfiles.c 2012-01-25 22:06:58.649052774 -0800
118@@ -73,8 +73,8 @@
119 typedef struct Item {
120 ItemType type;
121
122- char *path;
123- char *argument;
124+ char path[50];
125+ char argument[50];
126 uid_t uid;
127 gid_t gid;
128 mode_t mode;
129@@ -822,7 +822,6 @@
130 case CREATE_CHAR_DEVICE:
131 case CREATE_BLOCK_DEVICE:
132 case IGNORE_PATH:
133- case RELABEL_PATH:
134 case RECURSIVE_RELABEL_PATH:
135 case WRITE_FILE:
136 break;
137@@ -858,8 +857,6 @@
138 static void item_free(Item *i) {
139 assert(i);
140
141- free(i->path);
142- free(i->argument);
143 free(i);
144 }
145
146@@ -906,7 +903,7 @@
147
148 static int parse_line(const char *fname, unsigned line, const char *buffer) {
149 Item *i, *existing;
150- char *mode = NULL, *user = NULL, *group = NULL, *age = NULL;
151+ char mode[50], user[50], group[50], age[50];
152 char type;
153 Hashmap *h;
154 int r, n = -1;
155@@ -923,18 +920,18 @@
156
157 if (sscanf(buffer,
158 "%c "
159- "%ms "
160- "%ms "
161- "%ms "
162- "%ms "
163- "%ms "
164+ "%s "
165+ "%s "
166+ "%s "
167+ "%s "
168+ "%s "
169 "%n",
170 &type,
171 &i->path,
172- &mode,
173- &user,
174- &group,
175- &age,
176+ mode,
177+ user,
178+ group,
179+ age,
180 &n) < 2) {
181 log_error("[%s:%u] Syntax error.", fname, line);
182 r = -EIO;
183@@ -1096,11 +1093,6 @@
184 r = 0;
185
186 finish:
187- free(user);
188- free(group);
189- free(mode);
190- free(age);
191-
192 if (i)
193 item_free(i);
194
195Index: git/src/mount.c
196===================================================================
197--- git.orig/src/mount.c 2012-01-25 21:27:23.000000000 -0800
198+++ git/src/mount.c 2012-01-25 21:59:43.901031505 -0800
199@@ -24,6 +24,7 @@
200 #include <mntent.h>
201 #include <sys/epoll.h>
202 #include <signal.h>
203+#include <string.h>
204
205 #include "unit.h"
206 #include "mount.h"
207@@ -1561,7 +1562,13 @@
208 static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
209 int r = 0;
210 unsigned i;
211- char *device, *path, *options, *options2, *fstype, *d, *p, *o;
212+ char *d, *p, *o;
213+ char device[50];
214+ char path[50];
215+ char options[50];
216+ char options2[50];
217+ char fstype[50];
218+
219
220 assert(m);
221
222@@ -1570,26 +1577,26 @@
223 for (i = 1;; i++) {
224 int k;
225
226- device = path = options = options2 = fstype = d = p = o = NULL;
227+ d = p = o = NULL;
228
229 if ((k = fscanf(m->proc_self_mountinfo,
230 "%*s " /* (1) mount id */
231 "%*s " /* (2) parent id */
232 "%*s " /* (3) major:minor */
233 "%*s " /* (4) root */
234- "%ms " /* (5) mount point */
235- "%ms" /* (6) mount options */
236+ "%49s " /* (5) mount point */
237+ "%49s" /* (6) mount options */
238 "%*[^-]" /* (7) optional fields */
239 "- " /* (8) separator */
240- "%ms " /* (9) file system type */
241- "%ms" /* (10) mount source */
242- "%ms" /* (11) mount options 2 */
243+ "%49s " /* (9) file system type */
244+ "%49s" /* (10) mount source */
245+ "%49s" /* (11) mount options 2 */
246 "%*[^\n]", /* some rubbish at the end */
247- &path,
248- &options,
249- &fstype,
250- &device,
251- &options2)) != 5) {
252+ path,
253+ options,
254+ fstype,
255+ device,
256+ options2)) != 5) {
257
258 if (k == EOF)
259 break;
260@@ -1613,22 +1620,12 @@
261 r = k;
262
263 clean_up:
264- free(device);
265- free(path);
266- free(options);
267- free(options2);
268- free(fstype);
269 free(d);
270 free(p);
271 free(o);
272 }
273
274 finish:
275- free(device);
276- free(path);
277- free(options);
278- free(options2);
279- free(fstype);
280 free(d);
281 free(p);
282 free(o);
283Index: git/src/umount.c
284===================================================================
285--- git.orig/src/umount.c 2012-01-25 21:27:23.000000000 -0800
286+++ git/src/umount.c 2012-01-25 21:59:43.901031505 -0800
287@@ -60,7 +60,9 @@
288
289 static int mount_points_list_get(MountPoint **head) {
290 FILE *proc_self_mountinfo;
291- char *path, *p;
292+ char *p;
293+ char path[50];
294+
295 unsigned int i;
296 int r;
297
298@@ -72,17 +74,17 @@
299 for (i = 1;; i++) {
300 int k;
301 MountPoint *m;
302- char *root;
303+ char root[50];
304 bool skip_ro;
305
306- path = p = NULL;
307+ p = NULL;
308
309 if ((k = fscanf(proc_self_mountinfo,
310 "%*s " /* (1) mount id */
311 "%*s " /* (2) parent id */
312 "%*s " /* (3) major:minor */
313- "%ms " /* (4) root */
314- "%ms " /* (5) mount point */
315+ "%49s " /* (4) root */
316+ "%49s " /* (5) mount point */
317 "%*s" /* (6) mount options */
318 "%*[^-]" /* (7) optional fields */
319 "- " /* (8) separator */
320@@ -90,24 +92,21 @@
321 "%*s" /* (10) mount source */
322 "%*s" /* (11) mount options 2 */
323 "%*[^\n]", /* some rubbish at the end */
324- &root,
325- &path)) != 2) {
326+ root,
327+ path)) != 2) {
328 if (k == EOF)
329 break;
330
331 log_warning("Failed to parse /proc/self/mountinfo:%u.", i);
332
333- free(path);
334 continue;
335 }
336
337 /* If we encounter a bind mount, don't try to remount
338 * the source dir too early */
339 skip_ro = !streq(root, "/");
340- free(root);
341
342 p = cunescape(path);
343- free(path);
344
345 if (!p) {
346 r = -ENOMEM;
347@@ -152,28 +151,28 @@
348
349 for (i = 2;; i++) {
350 MountPoint *swap;
351- char *dev = NULL, *d;
352+ char *d;
353+ char dev[50];
354+
355 int k;
356
357 if ((k = fscanf(proc_swaps,
358- "%ms " /* device/file */
359+ "%50s " /* device/file */
360 "%*s " /* type of swap */
361 "%*s " /* swap size */
362 "%*s " /* used */
363 "%*s\n", /* priority */
364- &dev)) != 1) {
365+ dev)) != 1) {
366
367 if (k == EOF)
368 break;
369
370 log_warning("Failed to parse /proc/swaps:%u.", i);
371
372- free(dev);
373 continue;
374 }
375
376 if (endswith(dev, "(deleted)")) {
377- free(dev);
378 continue;
379 }
380
diff --git a/meta-oe/recipes-core/systemd/systemd/paper-over-mkostemp.patch b/meta-oe/recipes-core/systemd/systemd/paper-over-mkostemp.patch
new file mode 100644
index 000000000..ca10440a8
--- /dev/null
+++ b/meta-oe/recipes-core/systemd/systemd/paper-over-mkostemp.patch
@@ -0,0 +1,19 @@
1uclibc does not have mkostemp() so we redefine it to use mkstemp()
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4
5Index: git/src/macro.h
6===================================================================
7--- git.orig/src/macro.h 2011-06-30 10:33:53.000000000 -0700
8+++ git/src/macro.h 2011-06-30 15:07:28.285270006 -0700
9@@ -27,6 +27,10 @@
10 #include <sys/uio.h>
11 #include <inttypes.h>
12
13+#ifdef __UCLIBC__
14+/* uclibc does not implement mkostemp GNU extention */
15+#define mkostemp(x,y) mkstemp(x)
16+#endif
17 #define _printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
18 #define _sentinel_ __attribute__ ((sentinel))
19 #define _noreturn_ __attribute__((noreturn))
diff --git a/meta-oe/recipes-core/systemd/systemd_git.bb b/meta-oe/recipes-core/systemd/systemd_git.bb
new file mode 100644
index 000000000..fd10aa721
--- /dev/null
+++ b/meta-oe/recipes-core/systemd/systemd_git.bb
@@ -0,0 +1,161 @@
1DESCRIPTION = "Systemd a init replacement"
2HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd"
3LICENSE = "GPLv2+"
4LIC_FILES_CHKSUM = "file://LICENSE;md5=751419260aa954499f7abaabaa882bbe"
5
6DEPENDS = "xz kmod docbook-sgml-dtd-4.1-native intltool-native gperf-native acl readline udev dbus libcap libcgroup tcp-wrappers"
7DEPENDS += "${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
8
9DEFAULT_PREFERENCE = "2"
10
11SERIAL_CONSOLE ?= "115200 /dev/ttyS0"
12
13SECTION = "base/shell"
14
15inherit gitpkgv
16PKGV = "v${GITPKGVTAG}"
17
18PV = "git"
19PR = "r28"
20
21inherit useradd pkgconfig autotools vala perlnative
22
23SRCREV = "3eff4208ffecedd778fec260f0d4b18e94dab443"
24
25SRC_URI = "git://anongit.freedesktop.org/systemd/systemd;protocol=git \
26 ${UCLIBCPATCHES} \
27 file://var-run.conf \
28 "
29UCLIBCPATCHES = ""
30UCLIBCPATCHES_libc-uclibc = "file://paper-over-mkostemp.patch \
31 file://format-replace-m-uclibc.patch \
32 "
33
34LDFLAGS_libc-uclibc_append = " -lrt"
35
36S = "${WORKDIR}/git"
37
38SYSTEMDDISTRO ?= "debian"
39SYSTEMDDISTRO_angstrom = "angstrom"
40
41# The gtk+ tools should get built as a separate recipe e.g. systemd-tools
42EXTRA_OECONF = " --with-distro=${SYSTEMDDISTRO} \
43 --with-rootprefix=${base_prefix} \
44 --with-rootlibdir=${base_libdir} \
45 ${@base_contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)} \
46 --disable-gtk \
47 --enable-xz \
48 --disable-manpages \
49 --disable-coredump \
50 "
51
52# There's no docbook-xsl-native, so for the xsltproc check to false
53do_configure_prepend() {
54 sed -i /xsltproc/d configure.ac
55
56 # we only have /home/root, not /root
57 sed -i -e 's:=/root:=/home/root:g' units/*.service*
58}
59
60do_install() {
61 autotools_do_install
62 # provided by a seperate recipe
63 rm ${D}${systemd_unitdir}/system/serial-getty* -f
64
65 # provide support for initramfs
66 ln -s ${systemd_unitdir}/systemd ${D}/init
67
68 # create dir for journal
69 install -d ${D}${localstatedir}/log/journal
70
71 # create machine-id
72 # 20:12 < mezcalero> koen: you have three options: a) run systemd-machine-id-setup at install time, b) have / read-only and an empty file there (for stateless) and c) boot with / writable
73 touch ${D}${sysconfdir}/machine-id
74
75 install -m 0644 ${WORKDIR}/var-run.conf ${D}${sysconfdir}/tmpfiles.d/
76}
77
78python populate_packages_prepend (){
79 systemdlibdir = d.getVar("base_libdir", True)
80 do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True)
81}
82
83PACKAGES =+ "${PN}-gui ${PN}-vconsole-setup ${PN}-initramfs ${PN}-analyze"
84
85USERADD_PACKAGES = "${PN}"
86GROUPADD_PARAM_${PN} = "-r lock"
87
88FILES_${PN}-analyze = "${bindir}/systemd-analyze"
89RDEPENDS_${PN}-analyze = "python-dbus"
90RRECOMMENDS_${PN}-analyze = "python-pycairo"
91
92FILES_${PN}-initramfs = "/init"
93RDEPENDS_${PN}-initramfs = "${PN}"
94
95FILES_${PN}-gui = "${bindir}/systemadm"
96
97FILES_${PN}-vconsole-setup = "${systemd_unitdir}/systemd-vconsole-setup \
98 ${systemd_unitdir}/system/systemd-vconsole-setup.service \
99 ${systemd_unitdir}/system/sysinit.target.wants/systemd-vconsole-setup.service"
100
101RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts"
102
103FILES_${PN} = " ${base_bindir}/* \
104 ${datadir}/dbus-1/services \
105 ${datadir}/dbus-1/system-services \
106 ${datadir}/polkit-1 \
107 ${datadir}/${PN} \
108 ${sysconfdir} \
109 ${systemd_unitdir}/* \
110 ${systemd_unitdir}/system/* \
111 ${base_libdir}/udev/rules.d \
112 ${base_libdir}/security/*.so \
113 /cgroup \
114 ${bindir}/systemd* \
115 ${libdir}/tmpfiles.d/*.conf \
116 ${libdir}/systemd \
117 ${libdir}/binfmt.d \
118 ${libdir}/modules-load.d \
119 ${libdir}/sysctl.d \
120 ${localstatedir} \
121 ${libexecdir} \
122 "
123
124FILES_${PN}-dbg += "${systemd_unitdir}/.debug ${systemd_unitdir}/*/.debug ${base_libdir}/security/.debug/"
125FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/"
126
127RDEPENDS_${PN} += "dbus-systemd udev-systemd"
128
129# kbd -> loadkeys,setfont
130# systemd calls 'modprobe -sab --', which busybox doesn't support due to lack
131# of blacklist support, so use proper modprobe from module-init-tools
132# And pull in the kernel modules mentioned in INSTALL
133# swapon -p is also not supported by busybox
134# busybox mount is broken
135RRECOMMENDS_${PN} += "systemd-serialgetty \
136 util-linux-agetty \
137 util-linux-swaponoff \
138 util-linux-fsck e2fsprogs-e2fsck \
139 module-init-tools \
140 util-linux-mount util-linux-umount \
141 kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 \
142"
143
144# TODO:
145# u-a for runlevel and telinit
146
147pkg_postinst_systemd () {
148update-alternatives --install ${base_sbindir}/init init ${systemd_unitdir}/systemd 300
149update-alternatives --install ${base_sbindir}/halt halt ${base_bindir}/systemctl 300
150update-alternatives --install ${base_sbindir}/reboot reboot ${base_bindir}/systemctl 300
151update-alternatives --install ${base_sbindir}/shutdown shutdown ${base_bindir}/systemctl 300
152update-alternatives --install ${base_sbindir}/poweroff poweroff ${base_bindir}/systemctl 300
153}
154
155pkg_prerm_systemd () {
156update-alternatives --remove init ${systemd_unitdir}/systemd
157update-alternatives --remove halt ${base_bindir}/systemctl
158update-alternatives --remove reboot ${base_bindir}/systemctl
159update-alternatives --remove shutdown ${base_bindir}/systemctl
160update-alternatives --remove poweroff ${base_bindir}/systemctl
161}