Re: [systemd-devel] [PATCH] netns: unix: only allow to find out unix socket in same net namespace
cc libvirt-list On 08/21/2013 01:30 PM, Eric W. Biederman wrote: Gao feng gaof...@cn.fujitsu.com writes: Unix sockets are private resources of net namespace, allowing one net namespace to access to other netns's unix sockets is meaningless. Allowing one net namespace to access another netns's unix socket is deliberate behavior. This is a desired and useful feature, and only a misconfiguration of visible files would allow this to be a problem. I'm researching a problem about shutdown from container, if the cotainer shares the same file /run/systemd/private with host, when we run shutdown -h xxx in container, the shutdown message will be send to the systemd-shutdownd through unix socket /run/systemd/private, and because systemd-shutdownd is running in host, so finally, the host will become shutdown. The simple answer is don't do that then. I can see no reason to share /run outside of the container unless you want this kind of behavior. Quite frankly I want this behavior if I am using network namespaces to support multiple routing contexts. That is if I am using scripts like: ip netns add other ip netns exec other script I don't want to have to remember to say ip netns orig exec shutdown -h now There are more compelling uses and there is no cost in supporting this in the kernel. What kind of misconfiguration caused someone to complain about this? libvirt lxc allows user to set up a container which shares the same root directory with host. seems like the unix sockets whose sun_path is an abstract socket address are net namespace aware. Should we use abstract type of address instead of a file system pathname for systemd in this case? ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] netns: unix: only allow to find out unix socket in same net namespace
Gao feng gaof...@cn.fujitsu.com writes: cc libvirt-list On 08/21/2013 01:30 PM, Eric W. Biederman wrote: Gao feng gaof...@cn.fujitsu.com writes: Unix sockets are private resources of net namespace, allowing one net namespace to access to other netns's unix sockets is meaningless. Allowing one net namespace to access another netns's unix socket is deliberate behavior. This is a desired and useful feature, and only a misconfiguration of visible files would allow this to be a problem. I'm researching a problem about shutdown from container, if the cotainer shares the same file /run/systemd/private with host, when we run shutdown -h xxx in container, the shutdown message will be send to the systemd-shutdownd through unix socket /run/systemd/private, and because systemd-shutdownd is running in host, so finally, the host will become shutdown. The simple answer is don't do that then. I can see no reason to share /run outside of the container unless you want this kind of behavior. Quite frankly I want this behavior if I am using network namespaces to support multiple routing contexts. That is if I am using scripts like: ip netns add other ip netns exec other script I don't want to have to remember to say ip netns orig exec shutdown -h now There are more compelling uses and there is no cost in supporting this in the kernel. What kind of misconfiguration caused someone to complain about this? libvirt lxc allows user to set up a container which shares the same root directory with host. seems like the unix sockets whose sun_path is an abstract socket address are net namespace aware. Should we use abstract type of address instead of a file system pathname for systemd in this case? I suspect libvirt should simply not share /run or any other normally writable directory with the host. Sharing /run /var/run or even /tmp seems extremely dubious if you want some kind of containment, and without strange things spilling through. Eric ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] netns: unix: only allow to find out unix socket in same net namespace
On 08/21/2013 03:06 PM, Eric W. Biederman wrote: Gao feng gaof...@cn.fujitsu.com writes: cc libvirt-list On 08/21/2013 01:30 PM, Eric W. Biederman wrote: Gao feng gaof...@cn.fujitsu.com writes: Unix sockets are private resources of net namespace, allowing one net namespace to access to other netns's unix sockets is meaningless. Allowing one net namespace to access another netns's unix socket is deliberate behavior. This is a desired and useful feature, and only a misconfiguration of visible files would allow this to be a problem. I'm researching a problem about shutdown from container, if the cotainer shares the same file /run/systemd/private with host, when we run shutdown -h xxx in container, the shutdown message will be send to the systemd-shutdownd through unix socket /run/systemd/private, and because systemd-shutdownd is running in host, so finally, the host will become shutdown. The simple answer is don't do that then. I can see no reason to share /run outside of the container unless you want this kind of behavior. Quite frankly I want this behavior if I am using network namespaces to support multiple routing contexts. That is if I am using scripts like: ip netns add other ip netns exec other script I don't want to have to remember to say ip netns orig exec shutdown -h now There are more compelling uses and there is no cost in supporting this in the kernel. What kind of misconfiguration caused someone to complain about this? libvirt lxc allows user to set up a container which shares the same root directory with host. seems like the unix sockets whose sun_path is an abstract socket address are net namespace aware. Should we use abstract type of address instead of a file system pathname for systemd in this case? I suspect libvirt should simply not share /run or any other normally writable directory with the host. Sharing /run /var/run or even /tmp seems extremely dubious if you want some kind of containment, and without strange things spilling through. right now I only take note of the unix socket /run/systemd/private, but there may have many similar unix sockets, they can exist in any path. the strange problems will still happen. anyway, I will send a patch to setup a fresh tmpfs for the /run directory of container first. Eric, Thanks for your help! ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Question on debugging getty 'runlevel 3' issue.
'Twas brillig, and Ben Greear at 20/08/13 22:46 did gyre and gimble: Does anyone know what package or thing was doing the text prompt on the serial console? It happens automatically based on kernel command line params as far as I know... Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited http://www.tribalogic.net/ Open Source: Mageia Contributor http://www.mageia.org/ PulseAudio Hacker http://www.pulseaudio.org/ Trac Hacker http://trac.edgewall.org/ ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] netns: unix: only allow to find out unix socket in same net namespace
On Wed, Aug 21, 2013 at 9:22 AM, Gao feng gaof...@cn.fujitsu.com wrote: On 08/21/2013 03:06 PM, Eric W. Biederman wrote: I suspect libvirt should simply not share /run or any other normally writable directory with the host. Sharing /run /var/run or even /tmp seems extremely dubious if you want some kind of containment, and without strange things spilling through. Right, /run or /var cannot be shared. It's not only about sockets, many other things will also go really wrong that way. right now I only take note of the unix socket /run/systemd/private, but there may have many similar unix sockets, they can exist in any path. the strange problems will still happen. anyway, I will send a patch to setup a fresh tmpfs for the /run directory of container first. This is what systemd-nspawn does for a container setup: http://cgit.freedesktop.org/systemd/systemd/tree/src/nspawn/nspawn.c#n350 Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Question on debugging getty 'runlevel 3' issue.
On Wed, Aug 21, 2013 at 11:49 AM, Colin Guthrie gm...@colin.guthr.ie wrote: 'Twas brillig, and Ben Greear at 20/08/13 22:46 did gyre and gimble: Does anyone know what package or thing was doing the text prompt on the serial console? It happens automatically based on kernel command line params as far as I know... Check: $ cat /proc/cmdline if there is console=, if yes, then something probably added this to your boot loader config. Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] netns: unix: only allow to find out unix socket in same net namespace
On Wed, Aug 21, 2013 at 11:51:53AM +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 9:22 AM, Gao feng gaof...@cn.fujitsu.com wrote: On 08/21/2013 03:06 PM, Eric W. Biederman wrote: I suspect libvirt should simply not share /run or any other normally writable directory with the host. Sharing /run /var/run or even /tmp seems extremely dubious if you want some kind of containment, and without strange things spilling through. Right, /run or /var cannot be shared. It's not only about sockets, many other things will also go really wrong that way. Libvirt already allows the app defining the container config to set private mounts for any directory including /run and /var. If an admin or app wants to run systemd inside a container, it is their responsibility to ensure they setup the filesystem in a suitable manner. Libvirt is not going to enforce use of a private /run or /var, since that's a policy decision for a specific use case. Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] prevent unmount of single partitions on shutdown
'Twas brillig, and Zbigniew Jędrzejewski-Szmek at 21/08/13 04:38 did gyre and gimble: On Wed, Aug 21, 2013 at 05:21:59AM +0200, Stephan Raue wrote: Hi, i try to port systemd on a own embedded OS which is stored in a squashfs file. This file is on a fat partition (later mounted as /flash) on the drive. In our own initramfs (which dont uses systemd) /flash will be mounted and then the Squashfs file as /sysroot. later we do a switch_root and start systemd. On shutdown systemd trys now (5 times) to unmount /flash and times out later with a error message. This delays the shutdown/reboot much. Systemd also trys to cleanup /dev/loop0. I need to prevent systemd to unmount /flash and clean /dev/loop0 (which is the / mount from the squashfs file). can i actually prevent this in some way and if nout could i request a feature to add a mount option which if avaible prevents systemd from unmounting single partitions and cleanup /dev/loopX if its still mounted as / ? I need this as mount option or a systemd unit file but for fstab based systems it would be usefull as a fstab option too (we dont use fstab) I don't think it's possible currently with fstab. But with a mount unit, I think DefaultDependencies=no RequiredBy=-.mount should work. Have you tried something like that? Hmm, I thought the umount logic was such that it just tries to unmount everything from/proc/mounts rather than looking at units etc. I asked a similar question a while back and we figured at the time that adding a mount option might be a solution as there is already a fstab option to indicate a given filesystem should be mounted in the initrd, and it would make sense to honor that during shutdown (by not trying to umount it), but the problem was the umount loop doesn't read fstab or any mount options to check... See http://thread.gmane.org/gmane.comp.sysutils.systemd.devel/11210 and more recently http://comments.gmane.org/gmane.comp.sysutils.systemd.devel/12048 for similar topics. Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited http://www.tribalogic.net/ Open Source: Mageia Contributor http://www.mageia.org/ PulseAudio Hacker http://www.pulseaudio.org/ Trac Hacker http://trac.edgewall.org/ ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] prevent unmount of single partitions on shutdown
On Wed, Aug 21, 2013 at 5:56 PM, Colin Guthrie gm...@colin.guthr.ie wrote: 'Twas brillig, and Zbigniew Jędrzejewski-Szmek at 21/08/13 04:38 did gyre and gimble: On Wed, Aug 21, 2013 at 05:21:59AM +0200, Stephan Raue wrote: Hi, i try to port systemd on a own embedded OS which is stored in a squashfs file. This file is on a fat partition (later mounted as /flash) on the drive. In our own initramfs (which dont uses systemd) /flash will be mounted and then the Squashfs file as /sysroot. later we do a switch_root and start systemd. On shutdown systemd trys now (5 times) to unmount /flash and times out later with a error message. This delays the shutdown/reboot much. Systemd also trys to cleanup /dev/loop0. I need to prevent systemd to unmount /flash and clean /dev/loop0 (which is the / mount from the squashfs file). can i actually prevent this in some way and if nout could i request a feature to add a mount option which if avaible prevents systemd from unmounting single partitions and cleanup /dev/loopX if its still mounted as / ? I need this as mount option or a systemd unit file but for fstab based systems it would be usefull as a fstab option too (we dont use fstab) I don't think it's possible currently with fstab. But with a mount unit, I think DefaultDependencies=no RequiredBy=-.mount should work. Have you tried something like that? Hmm, I thought the umount logic was such that it just tries to unmount everything from/proc/mounts rather than looking at units etc. I asked a similar question a while back and we figured at the time that adding a mount option might be a solution as there is already a fstab option to indicate a given filesystem should be mounted in the initrd, and it would make sense to honor that during shutdown (by not trying to umount it), but the problem was the umount loop doesn't read fstab or any mount options to check... I have also been thinking of this problem recently. I have some patches to not add a conflict with umount.target when a mount is marked with x-initrd.mount, but as you point out we need to do something to also cover the final umount loop. One option is to simply jump to the shutdown ramfs straight away if it exists and let that do all the final unmounting/killing, which should always work. -t ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] Replace hasprefix() with startswith()
On Wed, Aug 21, 2013 at 8:36 AM, WANG Chao chaow...@redhat.com wrote: --- a/TODO +++ b/TODO @@ -96,8 +96,6 @@ Features: -* do we really need both hasprefix() and startswith()? It needs a little bit more: - the open-coded startswith seems really slow, it should not get more users - hasprefix can no longer be compile-time optimized, which is not good We might want something like this: http://lists.freedesktop.org/archives/systemd-devel/2013-July/011860.html Thanks, Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] netns: unix: only allow to find out unix socket in same net namespace
Gao feng gaof...@cn.fujitsu.com writes: right now I only take note of the unix socket /run/systemd/private, but there may have many similar unix sockets, they can exist in any path. the strange problems will still happen. It could just as easily have been a fifo in the filesystem, and the result would have been the same. The network namespace are all about communicating between network namespaces and that is what was allowed here. If you don't want a socket or a fifo or any other file to be used by a container don't give it access to it. It really is that simple. Eric ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] units: disable kmod-static-nodes.service in containers
Hi Zbyszek, Regarding http://cgit.freedesktop.org/systemd/systemd/commit/?id=219061dc524368179b2e65cfe91d4d6b23396ba8: Would it make sense to use ConditionCapability=CAP_MKNOD instead? This would match what is done in systemd-tmpfiles-setup-dev.service. The effect is currently the same (I think), but might as well be consistent in case things change in the future. Cheers, Tom ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] units: disable kmod-static-nodes.service in containers
On Wed, Aug 21, 2013 at 1:00 PM, Tom Gundersen t...@jklm.no wrote: Regarding http://cgit.freedesktop.org/systemd/systemd/commit/?id=219061dc524368179b2e65cfe91d4d6b23396ba8: Would it make sense to use ConditionCapability=CAP_MKNOD instead? This would match what is done in systemd-tmpfiles-setup-dev.service. The effect is currently the same (I think), but might as well be consistent in case things change in the future. Yeah, as the service is actually creating device nodes, it seems to fit here. Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] units: disable kmod-static-nodes.service in containers
On 08/21/2013 11:00 AM, Tom Gundersen wrote: Hi Zbyszek, Regarding http://cgit.freedesktop.org/systemd/systemd/commit/?id=219061dc524368179b2e65cfe91d4d6b23396ba8: Would it make sense to use ConditionCapability=CAP_MKNOD instead? This would match what is done in systemd-tmpfiles-setup-dev.service. The effect is currently the same (I think), but might as well be consistent in case things change in the future. Adding ConditionCapability=CAP_MKNO to the kmod-static-nodes.service in the test container I got here running does not trigger kmod-static-nodes.service: main process exited, code=exited, status=203/EXEC [FAILED] Failed to start Create list of required static device nodes for the current kernel. See 'systemctl status kmod-static-nodes.service' for details. Unit kmod-static-nodes.service entered failed state. Error at bootup. So this indeed works to fix that JBG ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [RFC] mount: improve DefaultDependencies and use in generator
Hi guys, I'd like to move some of the default dependency logic from the fstab generator to core. This should remove some redundancy and also improve consistency between mount units and fstab entries. The first patch simply enables default dependencies in the generator, and removes some things that are then made redundant. The second patch moves the handling of device dependencies from the generator to core's default dependencies. Lastly, we improve the Conflicts=umount.target logic by taking the mount option x-initrd.mount into account: if something was mounted in the initrd we should not try to stop the mount unit on shutdown. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/3] fstab-generator: use DefaultDependencies=yes
This removes some redundancy between the generator and the core mount handling. --- TODO | 2 -- src/fstab-generator/fstab-generator.c | 52 --- 2 files changed, 6 insertions(+), 48 deletions(-) diff --git a/TODO b/TODO index 9bc14fd..40d5261 100644 --- a/TODO +++ b/TODO @@ -221,8 +221,6 @@ Features: /etc should always override /run+/usr and also any symlink destination. -* remove duplicate default deps logic from fstab-generator vs. mount.c - * when isolating, try to figure out a way how we implicitly can order all units we stop before the isolating unit... diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c index 2a779bb..6f352d1 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c @@ -116,10 +116,7 @@ static int add_swap(const char *what, struct mntent *me) { fputs(# Automatically generated by systemd-fstab-generator\n\n [Unit]\n - SourcePath=/etc/fstab\n - DefaultDependencies=no\n - Conflicts= SPECIAL_UMOUNT_TARGET \n - Before= SPECIAL_UMOUNT_TARGET \n, f); + SourcePath=/etc/fstab\n, f); if (!noauto !nofail) fputs(Before= SPECIAL_SWAP_TARGET \n, f); @@ -209,9 +206,6 @@ static int add_mount( bool nofail, bool automount, bool isbind, -const char *pre, -const char *pre2, -const char *online, const char *post, const char *source) { _cleanup_free_ char @@ -258,33 +252,9 @@ static int add_mount( fprintf(f, # Automatically generated by systemd-fstab-generator\n\n [Unit]\n - SourcePath=%s\n - DefaultDependencies=no\n, + SourcePath=%s\n, source); -if (!path_equal(where, /)) { -if (pre) -fprintf(f, -After=%s\n, -pre); - -if (pre2) -fprintf(f, -After=%s\n, -pre2); - -if (online) -fprintf(f, -After=%s\n -Wants=%s\n, -online, -online); - -fprintf(f, -Conflicts= SPECIAL_UMOUNT_TARGET \n -Before= SPECIAL_UMOUNT_TARGET \n); -} - if (post !noauto !nofail !automount) fprintf(f, Before=%s\n, @@ -368,10 +338,7 @@ static int add_mount( fprintf(f, # Automatically generated by systemd-fstab-generator\n\n [Unit]\n -SourcePath=%s\n -DefaultDependencies=no\n -Conflicts= SPECIAL_UMOUNT_TARGET \n -Before= SPECIAL_UMOUNT_TARGET \n, +SourcePath=%s\n, source); if (post) @@ -447,7 +414,7 @@ static int parse_fstab(const char *prefix, bool initrd) { k = add_swap(what, me); else { bool noauto, nofail, automount, isbind; -const char *pre, *pre2, *post, *online; +const char *post; noauto = !!hasmntopt(me, noauto); nofail = !!hasmntopt(me, nofail); @@ -457,25 +424,18 @@ static int parse_fstab(const char *prefix, bool initrd) { isbind = mount_is_bind(me); if (initrd) { -pre = pre2 = online = NULL; post = SPECIAL_INITRD_FS_TARGET; } else if (mount_in_initrd(me)) { -pre = pre2 = online = NULL; post = SPECIAL_INITRD_ROOT_FS_TARGET; } else if (mount_is_network(me)) { -pre = SPECIAL_REMOTE_FS_PRE_TARGET; -pre2 = SPECIAL_NETWORK_TARGET; -online = SPECIAL_NETWORK_ONLINE_TARGET; post = SPECIAL_REMOTE_FS_TARGET; } else { -pre = SPECIAL_LOCAL_FS_PRE_TARGET; -pre2 = online = NULL; post = SPECIAL_LOCAL_FS_TARGET; } k = add_mount(what, where, me-mnt_type, me-mnt_opts, me-mnt_passno,
[systemd-devel] [PATCH 2/3] mount: move device links handling from generator
Now, when default dependencies are enabled for a mount unit it will be WantedBy the respective devices. --- src/core/mount.c | 13 +++- src/fstab-generator/fstab-generator.c | 40 +++ 2 files changed, 15 insertions(+), 38 deletions(-) diff --git a/src/core/mount.c b/src/core/mount.c index c7d29b0..566b3f6 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -338,6 +338,12 @@ static bool mount_is_bind(MountParameters *p) { return false; } +static bool mount_is_auto(MountParameters *p) { +assert(p); + +return !mount_test_option(p-options, noauto); +} + static bool needs_quota(MountParameters *p) { assert(p); @@ -356,6 +362,7 @@ static bool needs_quota(MountParameters *p) { static int mount_add_device_links(Mount *m) { MountParameters *p; +bool device_wants_mount = false; int r; assert(m); @@ -376,7 +383,11 @@ static int mount_add_device_links(Mount *m) { if (path_equal(m-where, /)) return 0; -r = unit_add_node_link(UNIT(m), p-what, false); +if (UNIT(m)-default_dependencies mount_is_auto(p) +UNIT(m)-manager-running_as == SYSTEMD_SYSTEM) +device_wants_mount = true; + +r = unit_add_node_link(UNIT(m), p-what, device_wants_mount); if (r 0) return r; diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c index 6f352d1..e780018 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c @@ -170,16 +170,6 @@ static int add_swap(const char *what, struct mntent *me) { return 0; } -static bool mount_is_bind(struct mntent *me) { -assert(me); - -return -hasmntopt(me, bind) || -streq(me-mnt_type, bind) || -hasmntopt(me, rbind) || -streq(me-mnt_type, rbind); -} - static bool mount_is_network(struct mntent *me) { assert(me); @@ -205,14 +195,12 @@ static int add_mount( bool noauto, bool nofail, bool automount, -bool isbind, const char *post, const char *source) { _cleanup_free_ char *name = NULL, *unit = NULL, *lnk = NULL, *device = NULL, *automount_name = NULL, *automount_unit = NULL; _cleanup_fclose_ FILE *f = NULL; -int r; assert(what); assert(where); @@ -296,27 +284,6 @@ static int add_mount( return -errno; } } - -if (!isbind -!path_equal(where, /)) { - -r = device_name(what, device); -if (r 0) -return r; - -if (r 0) { -free(lnk); -lnk = strjoin(arg_dest, /, device, .wants/, name, NULL); -if (!lnk) -return log_oom(); - -mkdir_parents_label(lnk, 0755); -if (symlink(unit, lnk) 0) { -log_error(Failed to create symlink %s: %m, lnk); -return -errno; -} -} -} } if (automount !path_equal(where, /)) { @@ -413,7 +380,7 @@ static int parse_fstab(const char *prefix, bool initrd) { if (streq(me-mnt_type, swap)) k = add_swap(what, me); else { -bool noauto, nofail, automount, isbind; +bool noauto, nofail, automount; const char *post; noauto = !!hasmntopt(me, noauto); @@ -421,7 +388,6 @@ static int parse_fstab(const char *prefix, bool initrd) { automount = hasmntopt(me, comment=systemd.automount) || hasmntopt(me, x-systemd.automount); -isbind = mount_is_bind(me); if (initrd) { post = SPECIAL_INITRD_FS_TARGET; @@ -435,7 +401,7 @@ static int parse_fstab(const char *prefix, bool initrd) { k = add_mount(what, where, me-mnt_type, me-mnt_opts, me-mnt_passno, noauto, nofail, automount, - isbind, post, fstab_path); + post, fstab_path); } if (k 0) @@ -523,7 +489,7 @@ static int parse_new_root_from_proc_cmdline(void) { log_debug(Found entry
[systemd-devel] [PATCH 3/3] mount: x-initrd.mount should not conflict with umount.target
These mounts were mounted in the initrd and should be unmounted there as well. Currently, we will still attempt to umount these in the final kill spree, but we should consider avoiding that too. --- src/core/mount.c | 26 +- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/core/mount.c b/src/core/mount.c index 566b3f6..fcca677 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -448,6 +448,21 @@ static int mount_add_quota_links(Mount *m) { return 0; } +static bool should_umount(Mount *m) { +MountParameters *p; + +if (path_equal(m-where, /) || +path_equal(m-where, /usr)) +return false; + +p = get_mount_parameters(m); +if (p mount_test_option(p-options, x-initrd.mount) +!in_initrd()) +return false; + +return true; +} + static int mount_add_default_dependencies(Mount *m) { const char *after, *after2, *online; MountParameters *p; @@ -492,9 +507,11 @@ static int mount_add_default_dependencies(Mount *m) { return r; } -r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true); -if (r 0) -return r; +if (should_umount(m)) { +r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true); +if (r 0) +return r; +} return 0; } @@ -1554,8 +1571,7 @@ static int mount_add_one( if (r 0) goto fail; -if (!path_equal(where, /) -!path_equal(where, /usr)) { +if (should_umount(MOUNT(u))) { r = unit_add_dependency_by_name(u, UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true); if (r 0) goto fail; -- 1.8.3.4 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 2/3] mount: move device links handling from generator
On 08/21/2013 01:53 PM, Tom Gundersen wrote: -if (!isbind -!path_equal(where, /)) { - -r = device_name(what, device); -if (r 0) -return r; - -if (r 0) { -free(lnk); -lnk = strjoin(arg_dest, /, device, .wants/, name, NULL); -if (!lnk) -return log_oom(); - -mkdir_parents_label(lnk, 0755); -if (symlink(unit, lnk) 0) { -log_error(Failed to create symlink %s: %m, lnk); -return -errno; -} -} -} Hmm, why is this not needed anymore? ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] prevent unmount of single partitions on shutdown
On Wed, Aug 21, 2013 at 06:03:34PM +0800, Tom Gundersen wrote: On Wed, Aug 21, 2013 at 5:56 PM, Colin Guthrie gm...@colin.guthr.ie wrote: 'Twas brillig, and Zbigniew Jędrzejewski-Szmek at 21/08/13 04:38 did gyre and gimble: On Wed, Aug 21, 2013 at 05:21:59AM +0200, Stephan Raue wrote: Hi, i try to port systemd on a own embedded OS which is stored in a squashfs file. This file is on a fat partition (later mounted as /flash) on the drive. In our own initramfs (which dont uses systemd) /flash will be mounted and then the Squashfs file as /sysroot. later we do a switch_root and start systemd. On shutdown systemd trys now (5 times) to unmount /flash and times out later with a error message. This delays the shutdown/reboot much. Systemd also trys to cleanup /dev/loop0. I need to prevent systemd to unmount /flash and clean /dev/loop0 (which is the / mount from the squashfs file). can i actually prevent this in some way and if nout could i request a feature to add a mount option which if avaible prevents systemd from unmounting single partitions and cleanup /dev/loopX if its still mounted as / ? I need this as mount option or a systemd unit file but for fstab based systems it would be usefull as a fstab option too (we dont use fstab) I don't think it's possible currently with fstab. But with a mount unit, I think DefaultDependencies=no RequiredBy=-.mount should work. Have you tried something like that? Hmm, I thought the umount logic was such that it just tries to unmount everything from/proc/mounts rather than looking at units etc. OTOH, if systemd manages to unmount something on top of which another filesystem is mounted, is a kernel bug, no? I asked a similar question a while back and we figured at the time that adding a mount option might be a solution as there is already a fstab option to indicate a given filesystem should be mounted in the initrd, and it would make sense to honor that during shutdown (by not trying to umount it), but the problem was the umount loop doesn't read fstab or any mount options to check... I have also been thinking of this problem recently. I have some patches to not add a conflict with umount.target when a mount is marked with x-initrd.mount, but as you point out we need to do something to also cover the final umount loop. One option is to simply jump to the shutdown ramfs straight away if it exists and let that do all the final unmounting/killing, which should always work. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 2/3] mount: move device links handling from generator
On Wed, Aug 21, 2013 at 8:50 PM, Harald Hoyer harald.ho...@gmail.com wrote: On 08/21/2013 01:53 PM, Tom Gundersen wrote: -if (!isbind -!path_equal(where, /)) { - -r = device_name(what, device); -if (r 0) -return r; - -if (r 0) { -free(lnk); -lnk = strjoin(arg_dest, /, device, .wants/, name, NULL); -if (!lnk) -return log_oom(); - -mkdir_parents_label(lnk, 0755); -if (symlink(unit, lnk) 0) { -log_error(Failed to create symlink %s: %m, lnk); -return -errno; -} -} -} Hmm, why is this not needed anymore? It is now taken care of by: @@ -376,7 +383,11 @@ static int mount_add_device_links(Mount *m) { if (path_equal(m-where, /)) return 0; -r = unit_add_node_link(UNIT(m), p-what, false); +if (UNIT(m)-default_dependencies mount_is_auto(p) +UNIT(m)-manager-running_as == SYSTEMD_SYSTEM) +device_wants_mount = true; + +r = unit_add_node_link(UNIT(m), p-what, device_wants_mount); if (r 0) return r; Or am I missing something? -t ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] units: disable kmod-static-nodes.service in containers
On Wed, Aug 21, 2013 at 11:03:31AM +, Jóhann B. Guðmundsson wrote: On 08/21/2013 11:00 AM, Tom Gundersen wrote: Hi Zbyszek, Regarding http://cgit.freedesktop.org/systemd/systemd/commit/?id=219061dc524368179b2e65cfe91d4d6b23396ba8: Would it make sense to use ConditionCapability=CAP_MKNOD instead? This would match what is done in systemd-tmpfiles-setup-dev.service. The effect is currently the same (I think), but might as well be consistent in case things change in the future. I don't have too strong of an opinion. Whatever works... Adding ConditionCapability=CAP_MKNO to the kmod-static-nodes.service in the test container I got here running does not trigger kmod-static-nodes.service: main process exited, code=exited, status=203/EXEC [FAILED] Failed to start Create list of required static device nodes for the current kernel. See 'systemctl status kmod-static-nodes.service' for details. Unit kmod-static-nodes.service entered failed state. Error at bootup. So this indeed works to fix that Hm, Jóhann, are you saying that my ConditionCapability=CAP_MKNOD does not work, or that ConditionVirtualization=!container that I added does not work? Or that it works? Zbyszek ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [RFC] mount: improve DefaultDependencies and use in generator
Am 21.08.2013 13:53, schrieb Tom Gundersen: I'd like to move some of the default dependency logic from the fstab generator to core. This should remove some redundancy and also improve consistency between mount units and fstab entries. The first patch simply enables default dependencies in the generator, and removes some things that are then made redundant. The second patch moves the handling of device dependencies from the generator to core's default dependencies. DefaultDependencies=yes implicitly adds Before=foo.target for every target foo that wants or requires the unit. This has a negative effect on auto,x-systemd.automount mounts: Enabling DefaultDependencies will make the generated .mount unit Before=local-fs.target, which will remove the speed-up gained by delaying the mount. signature.asc Description: OpenPGP digital signature ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] prevent unmount of single partitions on shutdown
'Twas brillig, and Zbigniew Jędrzejewski-Szmek at 21/08/13 14:17 did gyre and gimble: On Wed, Aug 21, 2013 at 06:03:34PM +0800, Tom Gundersen wrote: On Wed, Aug 21, 2013 at 5:56 PM, Colin Guthrie gm...@colin.guthr.ie wrote: 'Twas brillig, and Zbigniew Jędrzejewski-Szmek at 21/08/13 04:38 did gyre and gimble: On Wed, Aug 21, 2013 at 05:21:59AM +0200, Stephan Raue wrote: Hi, i try to port systemd on a own embedded OS which is stored in a squashfs file. This file is on a fat partition (later mounted as /flash) on the drive. In our own initramfs (which dont uses systemd) /flash will be mounted and then the Squashfs file as /sysroot. later we do a switch_root and start systemd. On shutdown systemd trys now (5 times) to unmount /flash and times out later with a error message. This delays the shutdown/reboot much. Systemd also trys to cleanup /dev/loop0. I need to prevent systemd to unmount /flash and clean /dev/loop0 (which is the / mount from the squashfs file). can i actually prevent this in some way and if nout could i request a feature to add a mount option which if avaible prevents systemd from unmounting single partitions and cleanup /dev/loopX if its still mounted as / ? I need this as mount option or a systemd unit file but for fstab based systems it would be usefull as a fstab option too (we dont use fstab) I don't think it's possible currently with fstab. But with a mount unit, I think DefaultDependencies=no RequiredBy=-.mount should work. Have you tried something like that? Hmm, I thought the umount logic was such that it just tries to unmount everything from/proc/mounts rather than looking at units etc. OTOH, if systemd manages to unmount something on top of which another filesystem is mounted, is a kernel bug, no? I would say so yes, but that's not what's happening here unless I misunderstand something? That said, I guess the umount loop itself shouldn't delay the reboot as the commands there shouldn't take much time to fail (in theory at least) so perhaps your sugguestion would indeed solve the delay problem. Col -- Colin Guthrie gmane(at)colin.guthr.ie http://colin.guthr.ie/ Day Job: Tribalogic Limited http://www.tribalogic.net/ Open Source: Mageia Contributor http://www.mageia.org/ PulseAudio Hacker http://www.pulseaudio.org/ Trac Hacker http://trac.edgewall.org/ ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] - prefix for InaccessibleDirectories and ReadOnlyDirectories
--- TODO | 3 --- src/core/namespace.c | 12 +++- src/shared/conf-parser.c | 27 +-- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/TODO b/TODO index 9bc14fd..97f2bcf 100644 --- a/TODO +++ b/TODO @@ -287,9 +287,6 @@ Features: * timedate: have global on/off switches for auto-time (NTP), and auto-timezone that connman can subscribe to. -* Honour - prefix for InaccessibleDirectories= and ReadOnlyDirectories= to - suppress errors of the specified path doesn't exist - * dev-setup.c: when running in a container, create a tiny stub udev database with the systemd tag set for all network interfaces found, so that libudev reports them as present, and systemd's .device units diff --git a/src/core/namespace.c b/src/core/namespace.c index 7e33d84..16b132b 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -51,6 +51,7 @@ typedef struct BindMount { const char *path; MountMode mode; bool done; +bool ignore; } BindMount; static int append_mounts(BindMount **p, char **strv, MountMode mode) { @@ -58,6 +59,13 @@ static int append_mounts(BindMount **p, char **strv, MountMode mode) { STRV_FOREACH(i, strv) { +(*p)-ignore = false; + +if ((mode == INACCESSIBLE || mode == READONLY) (*i)[0] == '-') { +(*p)-ignore = true; +(*i)++; +} + if (!path_is_absolute(*i)) return -EINVAL; @@ -155,6 +163,8 @@ static int apply_mount( r = mount(what, m-path, NULL, MS_BIND|MS_REC, NULL); if (r = 0) log_debug(Successfully mounted %s to %s, what, m-path); +else if (m-ignore errno == ENOENT) +r = 0; return r; } @@ -168,7 +178,7 @@ static int make_read_only(BindMount *m) { return 0; r = mount(NULL, m-path, NULL, MS_BIND|MS_REMOUNT|MS_RDONLY|MS_REC, NULL); -if (r 0) +if (r 0 !(m-ignore errno == ENOENT)) return -errno; return 0; diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index 2303d9a..b27c7eb 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -611,11 +611,11 @@ int config_parse_path(const char *unit, return 0; } -if (!path_is_absolute(rvalue)) { -log_syntax(unit, LOG_ERR, filename, line, EINVAL, - Not an absolute path, ignoring: %s, rvalue); -return 0; -} +if (streq(lvalue, InaccessibleDirectories) || streq(lvalue, ReadOnlyDirectories)) { +if (!path_is_absolute(rvalue) (rvalue[0] != '-' || !path_is_absolute(rvalue+1))) +goto fail; +} else if (!path_is_absolute(rvalue)) +goto fail; n = strdup(rvalue); if (!n) @@ -627,6 +627,9 @@ int config_parse_path(const char *unit, *s = n; return 0; +fail: +log_syntax(unit, LOG_ERR, filename, line, EINVAL, Not an absolute path, ignoring: %s, rvalue); +return 0; } int config_parse_strv(const char *unit, @@ -724,11 +727,11 @@ int config_parse_path_strv(const char *unit, continue; } -if (!path_is_absolute(n)) { -log_syntax(unit, LOG_ERR, filename, line, EINVAL, - Not an absolute path, ignoring: %s, rvalue); -continue; -} +if (streq(lvalue, InaccessibleDirectories) || streq(lvalue, ReadOnlyDirectories)) { +if (!path_is_absolute(n) (n[0] != '-' || !path_is_absolute(n+1))) +goto fail; +} else if (!path_is_absolute(n)) +goto fail; path_kill_slashes(n); r = strv_extend(sv, n); @@ -737,6 +740,10 @@ int config_parse_path_strv(const char *unit, } return 0; + +fail: +log_syntax(unit, LOG_ERR, filename, line, EINVAL, Not an absolute path, ignoring: %s, rvalue); +return 0; } int config_parse_mode(const char *unit, -- 1.8.3.4 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] units: disable kmod-static-nodes.service in containers
On 08/21/2013 02:02 PM, Zbigniew Jędrzejewski-Szmek wrote: Hm, Jóhann, are you saying that my ConditionCapability=CAP_MKNOD does not work, or that ConditionVirtualization=!container that I added does not work? Or that it works? I'm was confirming adding ConditionCapability=CAP_MKNOD to the kmod-static-nodes.service worked to fix this. I also agree with Tom that we should use that instead for consistency ;) JBG ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCHv2] - prefix for InaccessibleDirectories and ReadOnlyDirectories
--- v2: - modify manpage --- TODO | 3 --- man/systemd.exec.xml | 6 +- src/core/namespace.c | 12 +++- src/shared/conf-parser.c | 27 +-- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/TODO b/TODO index 9bc14fd..97f2bcf 100644 --- a/TODO +++ b/TODO @@ -287,9 +287,6 @@ Features: * timedate: have global on/off switches for auto-time (NTP), and auto-timezone that connman can subscribe to. -* Honour - prefix for InaccessibleDirectories= and ReadOnlyDirectories= to - suppress errors of the specified path doesn't exist - * dev-setup.c: when running in a container, create a tiny stub udev database with the systemd tag set for all network interfaces found, so that libudev reports them as present, and systemd's .device units diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml index c0e1d86..93be660 100644 --- a/man/systemd.exec.xml +++ b/man/systemd.exec.xml @@ -828,7 +828,11 @@ the empty string is assigned to this option the specific list is reset, and all prior assignments have no -effect./para/listitem +effect./para +paraIf paths in varnameReadOnlyDirectories=/varname +or varnameInaccessibleDirectories=/varname +start with -, then errors will be +supressed if path doesn't exist./para/listitem /varlistentry varlistentry diff --git a/src/core/namespace.c b/src/core/namespace.c index 7e33d84..16b132b 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -51,6 +51,7 @@ typedef struct BindMount { const char *path; MountMode mode; bool done; +bool ignore; } BindMount; static int append_mounts(BindMount **p, char **strv, MountMode mode) { @@ -58,6 +59,13 @@ static int append_mounts(BindMount **p, char **strv, MountMode mode) { STRV_FOREACH(i, strv) { +(*p)-ignore = false; + +if ((mode == INACCESSIBLE || mode == READONLY) (*i)[0] == '-') { +(*p)-ignore = true; +(*i)++; +} + if (!path_is_absolute(*i)) return -EINVAL; @@ -155,6 +163,8 @@ static int apply_mount( r = mount(what, m-path, NULL, MS_BIND|MS_REC, NULL); if (r = 0) log_debug(Successfully mounted %s to %s, what, m-path); +else if (m-ignore errno == ENOENT) +r = 0; return r; } @@ -168,7 +178,7 @@ static int make_read_only(BindMount *m) { return 0; r = mount(NULL, m-path, NULL, MS_BIND|MS_REMOUNT|MS_RDONLY|MS_REC, NULL); -if (r 0) +if (r 0 !(m-ignore errno == ENOENT)) return -errno; return 0; diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index 2303d9a..b27c7eb 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -611,11 +611,11 @@ int config_parse_path(const char *unit, return 0; } -if (!path_is_absolute(rvalue)) { -log_syntax(unit, LOG_ERR, filename, line, EINVAL, - Not an absolute path, ignoring: %s, rvalue); -return 0; -} +if (streq(lvalue, InaccessibleDirectories) || streq(lvalue, ReadOnlyDirectories)) { +if (!path_is_absolute(rvalue) (rvalue[0] != '-' || !path_is_absolute(rvalue+1))) +goto fail; +} else if (!path_is_absolute(rvalue)) +goto fail; n = strdup(rvalue); if (!n) @@ -627,6 +627,9 @@ int config_parse_path(const char *unit, *s = n; return 0; +fail: +log_syntax(unit, LOG_ERR, filename, line, EINVAL, Not an absolute path, ignoring: %s, rvalue); +return 0; } int config_parse_strv(const char *unit, @@ -724,11 +727,11 @@ int config_parse_path_strv(const char *unit, continue; } -if (!path_is_absolute(n)) { -log_syntax(unit, LOG_ERR, filename, line, EINVAL, - Not an absolute path, ignoring: %s, rvalue); -continue; -} +if (streq(lvalue, InaccessibleDirectories) || streq(lvalue, ReadOnlyDirectories)) { +if (!path_is_absolute(n) (n[0] != '-' || !path_is_absolute(n+1))) +goto fail; +} else if (!path_is_absolute(n)) +goto fail; path_kill_slashes(n); r = strv_extend(sv, n); @@ -737,6 +740,10 @@ int
Re: [systemd-devel] Please pass 'fsck.mode=force' on the kernel command line rather than creating /forcefsck on the root file system
On Thu, Aug 15, 2013 at 11:04:39PM +0200, Reindl Harald wrote: Please pass 'fsck.mode=force' on the kernel command line rather than creating /forcefsck on the root file system please drop this deprectaion, it is disturbing and useless if you want a forced fsck for *whatever* reason you do *not* want to edit the grub-config and need to remove it after pass to prevent on the next boot a unintented fsck nor do you want to struggle with the boot-menu on remote-machines this warning is pointless and useless All the comments which mention that this (a) modifies the filesystem to be checked, (b) requires it to be writable, (c) is specific to /, notwithstanding, I agree that this is a useful hack and we shouldn't remove the support. The warning is harmless though. Zbyszek signature.asc Description: Digital signature ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] gummiboot: Add 32 bit compatible rdtsc asm
Gcc's inline asm constraints have different meanings on x86_64 and ia32. Include a 32 bit version for the rdtsc function. Drop the empty 32 bit version of time_usec as it and the cpuid function both function properly when compiled for 32 bit systems. Tested on the following CPU: Intel(R) Atom(TM) CPU E640 @ 1.00GHz A value of 10 was detected. Signed-off-by: Darren Hart dvh...@linux.intel.com Cc: Ylinen, Mikko mikko.yli...@intel.com --- src/efi/gummiboot.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c index 844ce5f..9f2f31d 100644 --- a/src/efi/gummiboot.c +++ b/src/efi/gummiboot.c @@ -90,6 +90,13 @@ static UINT64 ticks_read(void) { __asm__ volatile (rdtsc : =a (a), =d (d)); return (d 32) | a; } +#else +static UINT64 ticks_read(void) { +UINT64 val; +__asm__ volatile (rdtsc : =A (val)); +return val; +} +#endif static void cpuid_read(UINT32 info, UINT32 *eax, UINT32 *ebx, UINT32 *ecx, UINT32 *edx) { *eax = info; @@ -187,9 +194,6 @@ static UINT64 time_usec(void) { return 1000 * 1000 * ticks / cpufreq; } -#else -static UINT64 time_usec(void) { return 0; } -#endif static EFI_STATUS efivar_set_raw(const EFI_GUID *vendor, CHAR16 *name, CHAR8 *buf, UINTN size, BOOLEAN persistent) { UINT32 flags; -- 1.8.3.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] Replace hasprefix() with startswith()
Hi, Kay! On 08/21/13 at 12:05pm, Kay Sievers wrote: On Wed, Aug 21, 2013 at 8:36 AM, WANG Chao chaow...@redhat.com wrote: --- a/TODO +++ b/TODO @@ -96,8 +96,6 @@ Features: -* do we really need both hasprefix() and startswith()? It needs a little bit more: - the open-coded startswith seems really slow, it should not get more users - hasprefix can no longer be compile-time optimized, which is not good Apart from the overflow issue hasprefix has, may I ask why hasprefix can't be complile-time optimized now? What changed? We might want something like this: http://lists.freedesktop.org/archives/systemd-devel/2013-July/011860.html It looks like Lennart has already figured out an optimized startswith: #define startswith(s, prefix) ({ \ size_t _l; \ _l = strlen(prefix); \ strncmp(s, prefix, _l) == 0 ? s + _l : NULL; \ }) IMHO, using strncmp() is fast enough. What do you think? Thanks! WANG Chao ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] Replace hasprefix() with startswith()
On Wed, Aug 21, 2013 at 6:53 PM, WANG Chao chaow...@redhat.com wrote: On 08/21/13 at 12:05pm, Kay Sievers wrote: On Wed, Aug 21, 2013 at 8:36 AM, WANG Chao chaow...@redhat.com wrote: --- a/TODO +++ b/TODO @@ -96,8 +96,6 @@ Features: -* do we really need both hasprefix() and startswith()? It needs a little bit more: - the open-coded startswith seems really slow, it should not get more users - hasprefix can no longer be compile-time optimized, which is not good Apart from the overflow issue hasprefix has, may I ask why hasprefix can't be complile-time optimized now? What changed? Your patch replaced hasprefix with startswith. hasprefix was just a define, it operated on static strings with static length, which the compiler can optimize away. startswith is an open-coded function with a counter, which has to be called and cannot really be optimized-away by the compiler. We might want something like this: http://lists.freedesktop.org/archives/systemd-devel/2013-July/011860.html It looks like Lennart has already figured out an optimized startswith: #define startswith(s, prefix) ({ \ size_t _l; \ _l = strlen(prefix); \ strncmp(s, prefix, _l) == 0 ? s + _l : NULL; \ }) IMHO, using strncmp() is fast enough. What do you think? strncmp sounds fine instead of the open-coded loop in hasprefix, yes. Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] man: make reference to bind(2) explicit
--- man/systemd.socket.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml index 852010b..1fc28c5 100644 --- a/man/systemd.socket.xml +++ b/man/systemd.socket.xml @@ -510,7 +510,7 @@ varlistentry termvarnameReusePort=/varname/term listitemparaTakes a boolean -value. If true, allows multiple bind()s +value. If true, allows multiple citerefentryrefentrytitlebind/refentrytitlemanvolnum2/manvolnum/citerefentrys to this TCP or UDP port. This controls the SO_REUSEPORT socket option. See -- 1.8.4.rc3 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] gummiboot: Add 32 bit compatible rdtsc asm
On Wed, Aug 21, 2013 at 6:31 PM, Darren Hart dvh...@linux.intel.com wrote: Gcc's inline asm constraints have different meanings on x86_64 and ia32. Include a 32 bit version for the rdtsc function. Drop the empty 32 bit version of time_usec as it and the cpuid function both function properly when compiled for 32 bit systems. Applied. Thanks, Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] Replace hasprefix() with startswith()
On 08/21/13 at 06:58pm, Kay Sievers wrote: On Wed, Aug 21, 2013 at 6:53 PM, WANG Chao chaow...@redhat.com wrote: On 08/21/13 at 12:05pm, Kay Sievers wrote: On Wed, Aug 21, 2013 at 8:36 AM, WANG Chao chaow...@redhat.com wrote: --- a/TODO +++ b/TODO @@ -96,8 +96,6 @@ Features: -* do we really need both hasprefix() and startswith()? It needs a little bit more: - the open-coded startswith seems really slow, it should not get more users - hasprefix can no longer be compile-time optimized, which is not good Apart from the overflow issue hasprefix has, may I ask why hasprefix can't be complile-time optimized now? What changed? Your patch replaced hasprefix with startswith. hasprefix was just a define, it operated on static strings with static length, which the compiler can optimize away. startswith is an open-coded function with a counter, which has to be called and cannot really be optimized-away by the compiler. Thanks for clarify, I'll send two patches, one for macro startswith, another for the replacement. Thanks We might want something like this: http://lists.freedesktop.org/archives/systemd-devel/2013-July/011860.html It looks like Lennart has already figured out an optimized startswith: #define startswith(s, prefix) ({ \ size_t _l; \ _l = strlen(prefix); \ strncmp(s, prefix, _l) == 0 ? s + _l : NULL; \ }) IMHO, using strncmp() is fast enough. What do you think? strncmp sounds fine instead of the open-coded loop in hasprefix, yes. Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Inconsistencies in the systemd.mount documentation
In the manpage for systemd.mount(5), the following section is included: COMPATIBILITY OPTIONS The following option is also available in the [Mount] section, but exists purely for compatibility reasons and should not be used in newly written mount files. FsckPassNo= The pass number for the file system checking service for this mount. See systemd.service(5) for more information on this setting. However, if you omit the FsckPassNo= option from a mount unit, no dependency upon the correct systemd-fsck@ instance is created. So in fact, the option has a function. I'm not sure if this is intended, but in my opinion, DefaultDependencies=yes in a .mount unit should create that dependency, not the presence of a compatibility options. Does anyone know more? signature.asc Description: OpenPGP digital signature ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 0/5] gummiboot: Crosscompile fixes and 32b boot target support
I was carrying these patches in my yocto project recipe for gummiboot as well. Apologies, I should have included these along with the previous ia32 tsc patch. Thanks, Darren Hart ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 2/5] configure.ac: Use AC_CHECK_HEADER to detect the efi includes
While cross-compiling, AC_CHECK_FILE will abort the configure. The gnu-efi sources don't use relative paths and require the user to explicitly include -I/usr/include/efi/${ARCH}. I haven't found a way to do this with AC_CHECK_HEADER. However, since the existing test was not testing for usability (conftest.c compilation), we don't lose much by just not looking for efi.h and assume it exists if we can find and use efibind.h. Signed-off-by: Darren Hart dvh...@linux.intel.com --- configure.ac | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 6ee4520..d8dca1e 100644 --- a/configure.ac +++ b/configure.ac @@ -75,11 +75,12 @@ fi AM_CONDITIONAL(ENABLE_BIOSTEST, [test x$enable_biostest = xyes]) # -- -dnl Compile EFI stuff is so tricky that it's probably better to check for the -dnl include files that try to use AC_CHECK_HEADERS to compile any conftest.c -AC_CHECK_FILES([/usr/include/efi/efi.h -/usr/include/efi/${ARCH}/efibind.h], [], -[AC_MSG_ERROR([*** GNU Efi headers not found])]) +dnl GNU EFI doesn't use relative paths: efi.h includes efibind.h which is in +dnl ${ARCH} relative to efi.h. I can't find a way to get AC_CHECK_HEADERS to +dnl add -I/usr/include/efi/${ARCH} to the conftest.c build. So, just test for +dnl efibind.h as the chances of efi.h not existing if it does are very low. +AC_CHECK_HEADER(efi/${ARCH}/efibind.h, [], +[AC_MSG_ERROR([*** GNU EFI header efibind.h not found])]) efiroot=$(echo $(cd /usr/lib/$(gcc -print-multi-os-directory); pwd)) GNUEFI_LIBS=-L $efiroot -- 1.8.3.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 4/5] configure.ac: Allow for more than just i686 for ia32
Expand the ARCH_I686 to include i*86* (specifically to catch i586). Rename ARCH_I686 to ARCH_IA32 as that is more accurately what we are testing for. Signed-off-by: Darren Hart dvh...@linux.intel.com --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index d8dca1e..68999c6 100644 --- a/configure.ac +++ b/configure.ac @@ -49,13 +49,13 @@ AC_PATH_PROG([XSLTPROC], [xsltproc]) AC_PATH_PROG([QEMU_KVM], [qemu-kvm]) dnl Define ARCH_NAME conditionals -SET_ARCH(I686, i686*) +SET_ARCH(IA32, i*86*) SET_ARCH(X86_64, x86_64*) SET_ARCH(IA64, ia64*) ARCH=`echo $host | sed s/\(-\).*$//` -AM_COND_IF(ARCH_I686, [ +AM_COND_IF(ARCH_IA32, [ ARCH=ia32 MACHINE_TYPE_NAME=ia32]) -- 1.8.3.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 3/5] Makefile.am: Allow for user override of EFI include dir
Enable cross-compiling by allowing the user to specify an alternative to the /usr/include directory for the EFI includes. Add a variable INCDIR defaulting to /usr/include, but still allowing the user to provide their own value. Signed-off-by: Darren Hart dvh...@linux.intel.com --- Makefile.am | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index c3dfcb2..5dc9493 100644 --- a/Makefile.am +++ b/Makefile.am @@ -72,10 +72,11 @@ CLEANFILES += man/gummiboot.8 efi_loadername = gummiboot$(MACHINE_TYPE_NAME).efi efi_sources = src/efi/gummiboot.c +INCDIR := /usr/include efi_cppflags = \ -I$(top_builddir) -include config.h \ - -I/usr/include/efi \ - -I/usr/include/efi/$(ARCH) + -I$(INCDIR)/efi \ + -I$(INCDIR)/efi/$(ARCH) efi_cflags = \ -Wall \ -- 1.8.3.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/2] Optimize startswith() to macro
Take this optimized code from Lennart[1]. Now startswith is a macro using strncmp and should be fast enough. [1]: http://lists.freedesktop.org/archives/systemd-devel/2013-July/011860.html --- src/shared/macro.h | 5 + src/shared/util.c | 17 - 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/shared/macro.h b/src/shared/macro.h index 0d3ff1c..6053a0c 100644 --- a/src/shared/macro.h +++ b/src/shared/macro.h @@ -188,6 +188,11 @@ static inline size_t ALIGN_TO(size_t l, size_t ali) { #define hasprefix(s, prefix) (memcmp(s, prefix, strlen(prefix)) == 0) +#define startswith(s, prefix) ({ \ +size_t _l = strlen(prefix); \ +strncmp(s, prefix, _l) == 0 ? s + _l : NULL; \ +}) + #define IOVEC_SET_STRING(i, s) \ do {\ struct iovec *_i = (i);\ diff --git a/src/shared/util.c b/src/shared/util.c index ca9c2eb..fc89cec 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -128,23 +128,6 @@ char* endswith(const char *s, const char *postfix) { return (char*) s + sl - pl; } -char* startswith(const char *s, const char *prefix) { -const char *a, *b; - -assert(s); -assert(prefix); - -a = s, b = prefix; -for (;;) { -if (*b == 0) -return (char*) a; -if (*a != *b) -return NULL; - -a++, b++; -} -} - char* startswith_no_case(const char *s, const char *prefix) { const char *a, *b; -- 1.8.3.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 2/2] Replace hasprefix() with optimized startswith()
--- TODO | 2 -- src/journal/journal-send.c | 2 +- src/journal/journald-native.c | 12 ++-- src/libsystemd-bus/bus-match.c | 26 +- src/shared/logs-show.c | 2 +- src/shared/macro.h | 2 -- 6 files changed, 21 insertions(+), 25 deletions(-) diff --git a/TODO b/TODO index 9bc14fd..3800ce4 100644 --- a/TODO +++ b/TODO @@ -96,8 +96,6 @@ Features: * systemctl list-unit-files should list generated files (and probably with a new state generated for them, or so) -* do we really need both hasprefix() and startswith()? - * journald: when we drop syslog messages because the syslog socket is full, make sure to write how many messages are lost as first thing to syslog when it works again. diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c index fef66fc..d00e26f 100644 --- a/src/journal/journal-send.c +++ b/src/journal/journal-send.c @@ -245,7 +245,7 @@ _public_ int sd_journal_sendv(const struct iovec *iov, int n) { have_syslog_identifier = have_syslog_identifier || (c == (char *) iov[i].iov_base + 17 - hasprefix(iov[i].iov_base, SYSLOG_IDENTIFIER)); + startswith(iov[i].iov_base, SYSLOG_IDENTIFIER)); nl = memchr(iov[i].iov_base, '\n', iov[i].iov_len); if (nl) { diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c index 0f9af37..c50cf64 100644 --- a/src/journal/journald-native.c +++ b/src/journal/journald-native.c @@ -154,23 +154,23 @@ void server_process_native_message( * of this entry for the rate limiting * logic */ if (l == 10 -hasprefix(p, PRIORITY=) +startswith(p, PRIORITY=) p[9] = '0' p[9] = '9') priority = (priority LOG_FACMASK) | (p[9] - '0'); else if (l == 17 - hasprefix(p, SYSLOG_FACILITY=) + startswith(p, SYSLOG_FACILITY=) p[16] = '0' p[16] = '9') priority = (priority LOG_PRIMASK) | ((p[16] - '0') 3); else if (l == 18 - hasprefix(p, SYSLOG_FACILITY=) + startswith(p, SYSLOG_FACILITY=) p[16] = '0' p[16] = '9' p[17] = '0' p[17] = '9') priority = (priority LOG_PRIMASK) | (((p[16] - '0')*10 + (p[17] - '0')) 3); else if (l = 19 - hasprefix(p, SYSLOG_IDENTIFIER=)) { + startswith(p, SYSLOG_IDENTIFIER=)) { char *t; t = strndup(p + 18, l - 18); @@ -179,7 +179,7 @@ void server_process_native_message( identifier = t; } } else if (l = 8 - hasprefix(p, MESSAGE=)) { + startswith(p, MESSAGE=)) { char *t; t = strndup(p + 8, l - 8); @@ -189,7 +189,7 @@ void server_process_native_message( } } else if (l strlen(OBJECT_PID=) l strlen(OBJECT_PID=) + DECIMAL_STR_MAX(pid_t) - hasprefix(p, OBJECT_PID=) + startswith(p, OBJECT_PID=) allow_object_pid(ucred)) { char buf[DECIMAL_STR_MAX(pid_t)]; memcpy(buf, p + strlen(OBJECT_PID=), l - strlen(OBJECT_PID=)); diff --git a/src/libsystemd-bus/bus-match.c b/src/libsystemd-bus/bus-match.c index 750acfe..1411167 100644 --- a/src/libsystemd-bus/bus-match.c +++ b/src/libsystemd-bus/bus-match.c @@ -555,22 +555,22 @@ static int bus_match_find_leaf( enum bus_match_node_type bus_match_node_type_from_string(const char *k, size_t n) { assert(k); -if (n == 4 hasprefix(k, type)) +if (n == 4 startswith(k, type)) return BUS_MATCH_MESSAGE_TYPE; -if (n == 6 hasprefix(k, sender)) +if (n == 6 startswith(k, sender)) return BUS_MATCH_SENDER; -
Re: [systemd-devel] [PATCH 5/5] Auto detect both x64 and ia32 boot*.efi payloads
On Wed, Aug 21, 2013 at 8:13 PM, Darren Hart dvh...@linux.intel.com wrote: The EFI specification documents /EFI/BOOT/bootx64.efi for x86_64 machines and /EFI/BOOT/bootia32.efi for ia32 machines. Update the auto detection to allow for both. Signed-off-by: Darren Hart dvh...@linux.intel.com --- src/efi/gummiboot.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c index 9f2f31d..32e6f32 100644 --- a/src/efi/gummiboot.c +++ b/src/efi/gummiboot.c @@ -2199,7 +2199,10 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, Lauto-efi-shell, 's', LEFI Shell, L\\shellx64.efi); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default, '\0', LEFI Default Loader, L\\EFI\\BOOT\\BOOTX64.EFI); + Lauto-efi-default-64, '\0', LEFI Default Loader (x64), L\\EFI\\BOOT\\BOOTX64.EFI); +config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, + Lauto-efi-default-32, '\0', LEFI Default Loader (ia32), L\\EFI\\BOOT\\BOOTIA32.EFI); + Does it make sense to show both? Can EFI even start the non-native one? Shouldn't we just look for the native one, by composing the string at compile time? Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/5] configure.ac: Add option to disable configuring the BIOS test
On Wed, Aug 21, 2013 at 8:13 PM, Darren Hart dvh...@linux.intel.com wrote: When cross-compiling, AC_CHECK_FILE aborts configure. Provide a means to avoid even attempting to configure the BIOS test. Signed-off-by: Darren Hart dvh...@linux.intel.com --- configure.ac | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index ca5a383..6ee4520 100644 --- a/configure.ac +++ b/configure.ac @@ -66,9 +66,13 @@ AC_SUBST([ARCH]) AC_SUBST([MACHINE_TYPE_NAME]) # test bios -AC_CHECK_FILE([/usr/lib/qemu-bios],[BIOS=/usr/lib/qemu-bios]) -AC_CHECK_FILE([/usr/share/qemu-ovmf/bios], [BIOS=/usr/share/qemu-ovmf/bios]) -AC_SUBST([BIOS]) +AC_ARG_ENABLE(biostest, AS_HELP_STRING([--disable-biostest], [disable building BIOS test])) +if test x$enable_biostest != xno; then + AC_CHECK_FILE([/usr/lib/qemu-bios],[BIOS=/usr/lib/qemu-bios]) + AC_CHECK_FILE([/usr/share/qemu-ovmf/bios], [BIOS=/usr/share/qemu-ovmf/bios]) + AC_SUBST([BIOS]) +fi +AM_CONDITIONAL(ENABLE_BIOSTEST, [test x$enable_biostest = xyes]) This is commonly done with $cross_compiling. Any specific reason to have a new switch? http://www.gnu.org/software/autoconf/manual/autoconf.html#index-cross_005fcompiling-1186 Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 4/5] configure.ac: Allow for more than just i686 for ia32
On Wed, Aug 21, 2013 at 8:13 PM, Darren Hart dvh...@linux.intel.com wrote: Expand the ARCH_I686 to include i*86* (specifically to catch i586). Rename ARCH_I686 to ARCH_IA32 as that is more accurately what we are testing for. Applied. Thanks, Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 2/5] configure.ac: Use AC_CHECK_HEADER to detect the efi includes
On Wed, Aug 21, 2013 at 8:13 PM, Darren Hart dvh...@linux.intel.com wrote: While cross-compiling, AC_CHECK_FILE will abort the configure. The gnu-efi sources don't use relative paths and require the user to explicitly include -I/usr/include/efi/${ARCH}. I haven't found a way to do this with AC_CHECK_HEADER. However, since the existing test was not testing for usability (conftest.c compilation), we don't lose much by just not looking for efi.h and assume it exists if we can find and use efibind.h. Applied. Thanks, Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 5/5] Auto detect both x64 and ia32 boot*.efi payloads
On Wed, 2013-08-21 at 20:59 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 8:13 PM, Darren Hart dvh...@linux.intel.com wrote: The EFI specification documents /EFI/BOOT/bootx64.efi for x86_64 machines and /EFI/BOOT/bootia32.efi for ia32 machines. Update the auto detection to allow for both. Signed-off-by: Darren Hart dvh...@linux.intel.com --- src/efi/gummiboot.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c index 9f2f31d..32e6f32 100644 --- a/src/efi/gummiboot.c +++ b/src/efi/gummiboot.c @@ -2199,7 +2199,10 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, Lauto-efi-shell, 's', LEFI Shell, L\\shellx64.efi); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default, '\0', LEFI Default Loader, L\\EFI\\BOOT\\BOOTX64.EFI); + Lauto-efi-default-64, '\0', LEFI Default Loader (x64), L\\EFI\\BOOT\\BOOTX64.EFI); +config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, + Lauto-efi-default-32, '\0', LEFI Default Loader (ia32), L\\EFI\\BOOT\\BOOTIA32.EFI); + Does it make sense to show both? Can EFI even start the non-native one? Shouldn't we just look for the native one, by composing the string at compile time? Hrm, good point. In my environment, I only have OR the other, and no distros currently support IA32 EFI :-) But they should! So, yes, this should be improved as you say. Should this just be an #ifdef/#else? on the arch as is done for the ia32 tsc asm read function -- Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/5] configure.ac: Add option to disable configuring the BIOS test
On Wed, 2013-08-21 at 21:15 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 8:13 PM, Darren Hart dvh...@linux.intel.com wrote: When cross-compiling, AC_CHECK_FILE aborts configure. Provide a means to avoid even attempting to configure the BIOS test. Signed-off-by: Darren Hart dvh...@linux.intel.com --- configure.ac | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index ca5a383..6ee4520 100644 --- a/configure.ac +++ b/configure.ac @@ -66,9 +66,13 @@ AC_SUBST([ARCH]) AC_SUBST([MACHINE_TYPE_NAME]) # test bios -AC_CHECK_FILE([/usr/lib/qemu-bios],[BIOS=/usr/lib/qemu-bios]) -AC_CHECK_FILE([/usr/share/qemu-ovmf/bios], [BIOS=/usr/share/qemu-ovmf/bios]) -AC_SUBST([BIOS]) +AC_ARG_ENABLE(biostest, AS_HELP_STRING([--disable-biostest], [disable building BIOS test])) +if test x$enable_biostest != xno; then + AC_CHECK_FILE([/usr/lib/qemu-bios], [BIOS=/usr/lib/qemu-bios]) + AC_CHECK_FILE([/usr/share/qemu-ovmf/bios], [BIOS=/usr/share/qemu-ovmf/bios]) + AC_SUBST([BIOS]) +fi +AM_CONDITIONAL(ENABLE_BIOSTEST, [test x$enable_biostest = xyes]) This is commonly done with $cross_compiling. Any specific reason to have a new switch? http://www.gnu.org/software/autoconf/manual/autoconf.html#index-cross_005fcompiling-1186 No good reason, I'd be fine using the cross_compiling switch as well. -- Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 5/5] Auto detect both x64 and ia32 boot*.efi payloads
On Wed, Aug 21, 2013 at 9:26 PM, Darren Hart dvh...@linux.intel.com wrote: On Wed, 2013-08-21 at 20:59 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 8:13 PM, Darren Hart dvh...@linux.intel.com wrote: The EFI specification documents /EFI/BOOT/bootx64.efi for x86_64 machines and /EFI/BOOT/bootia32.efi for ia32 machines. Update the auto detection to allow for both. Signed-off-by: Darren Hart dvh...@linux.intel.com --- src/efi/gummiboot.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c index 9f2f31d..32e6f32 100644 --- a/src/efi/gummiboot.c +++ b/src/efi/gummiboot.c @@ -2199,7 +2199,10 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, Lauto-efi-shell, 's', LEFI Shell, L\\shellx64.efi); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default, '\0', LEFI Default Loader, L\\EFI\\BOOT\\BOOTX64.EFI); + Lauto-efi-default-64, '\0', LEFI Default Loader (x64), L\\EFI\\BOOT\\BOOTX64.EFI); +config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, + Lauto-efi-default-32, '\0', LEFI Default Loader (ia32), L\\EFI\\BOOT\\BOOTIA32.EFI); + Does it make sense to show both? Can EFI even start the non-native one? Shouldn't we just look for the native one, by composing the string at compile time? Hrm, good point. In my environment, I only have OR the other, and no distros currently support IA32 EFI :-) But they should! So, yes, this should be improved as you say. Should this just be an #ifdef/#else? on the arch as is done for the ia32 tsc asm read function MACHINE_TYPE_NAME might just work. It's a define from the build system. Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/5] configure.ac: Add option to disable configuring the BIOS test
On Wed, 2013-08-21 at 11:13 -0700, Darren Hart wrote: +if test x$enable_biostest != xno; then Use AS_IF() please; systemd's current configure.ac is not consistent in this respect, but it will save debugging painful m4 crap later: https://bugzilla.gnome.org/show_bug.cgi?id=681413 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/5] configure.ac: Add option to disable configuring the BIOS test
On Wed, 2013-08-21 at 15:57 -0400, Colin Walters wrote: On Wed, 2013-08-21 at 11:13 -0700, Darren Hart wrote: +if test x$enable_biostest != xno; then Use AS_IF() please; systemd's current configure.ac is not consistent in this respect, but it will save debugging painful m4 crap later: https://bugzilla.gnome.org/show_bug.cgi?id=681413 Thanks. I'll keep that in mind while I'm reworking these. AC build stuff takes me a long time though ;-) Hopefully today -- Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 5/5] Auto detect both x64 and ia32 boot*.efi payloads
On Wed, 2013-08-21 at 21:31 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 9:26 PM, Darren Hart dvh...@linux.intel.com wrote: On Wed, 2013-08-21 at 20:59 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 8:13 PM, Darren Hart dvh...@linux.intel.com wrote: The EFI specification documents /EFI/BOOT/bootx64.efi for x86_64 machines and /EFI/BOOT/bootia32.efi for ia32 machines. Update the auto detection to allow for both. Signed-off-by: Darren Hart dvh...@linux.intel.com --- src/efi/gummiboot.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c index 9f2f31d..32e6f32 100644 --- a/src/efi/gummiboot.c +++ b/src/efi/gummiboot.c @@ -2199,7 +2199,10 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, Lauto-efi-shell, 's', LEFI Shell, L\\shellx64.efi); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default, '\0', LEFI Default Loader, L\\EFI\\BOOT\\BOOTX64.EFI); + Lauto-efi-default-64, '\0', LEFI Default Loader (x64), L\\EFI\\BOOT\\BOOTX64.EFI); +config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, + Lauto-efi-default-32, '\0', LEFI Default Loader (ia32), L\\EFI\\BOOT\\BOOTIA32.EFI); + Does it make sense to show both? Can EFI even start the non-native one? Shouldn't we just look for the native one, by composing the string at compile time? Hrm, good point. In my environment, I only have OR the other, and no distros currently support IA32 EFI :-) But they should! So, yes, this should be improved as you say. Should this just be an #ifdef/#else? on the arch as is done for the ia32 tsc asm read function MACHINE_TYPE_NAME might just work. It's a define from the build system. OK, hoping you can save me some time here. I'm trying something like this (I believe the filenames are case insensitive?): $ git diff diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c index 32e6f32..edfab72 100644 --- a/src/efi/gummiboot.c +++ b/src/efi/gummiboot.c @@ -2196,12 +2196,16 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { /* if we find some well-known loaders, add them to the end of the list */ config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, Lauto-windows, 'w', LWindows Boot Manager, L\\EFI\\Microsoft\\Boot\\bootmgfw.efi); + +s = PoolPrint(L\\shell%s.efi, MACHINE_TYPE_NAME); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-shell, 's', LEFI Shell, L\\shellx64.efi); -config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default-64, '\0', LEFI Default Loader (x64), L\\EFI\\BOOT\\BOOTX64.EFI); + Lauto-efi-shell, 's', LEFI Shell, s); +FreePool(s); + +s = PoolPrint(LEFI Default Loader, L\\EFI\\BOOT\\BOOT%s.EFI, MACHINE_TYPE_NAME); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default-32, '\0', LEFI Default Loader (ia32), L\\EFI\\BOOT\\BOOTIA32.EFI); + Lauto-efi-default, '\0', LEFI Default Loader, s); +FreePool(s); config_entry_add_osx(config); efivar_set(LLoaderEntriesAuto, config.entries_auto, FALSE); But the build complains about MACHINE_TYPE_NAME not being defined: $ make make --no-print-directory all-am CC src/efi/gummiboot.o src/efi/gummiboot.c: In function ‘efi_main’: src/efi/gummiboot.c:2200:41: error: ‘MACHINE_TYPE_NAME’ undeclared (first use in this function) s = PoolPrint(L\\shell%s.efi, MACHINE_TYPE_NAME); ^ src/efi/gummiboot.c:2200:41: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [src/efi/gummiboot.o] Error 1 make: *** [all] Error 2 I see it in the gummiboot_CFLAGS, what do I have to do to get that to src/efi/gummiboot.c? -- Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/2] Optimize startswith() to macro
On Wed, Aug 21, 2013 at 8:15 PM, WANG Chao chaow...@redhat.com wrote: Take this optimized code from Lennart[1]. Now startswith is a macro using strncmp and should be fast enough. [1]: http://lists.freedesktop.org/archives/systemd-devel/2013-July/011860.html --- src/shared/macro.h | 5 + src/shared/util.c | 17 - 2 files changed, 5 insertions(+), 17 deletions(-) It fails to compile, there are the prototypes in util.h still. Also quite a few places do not include macro.h ... I guess it's easier and cleaner anyway to use simple static inline functions instead of defines. Patch attached. Thanks, Kay 0001-replace-startswith-loop-with-optimizable-inline-fuct.patch Description: Binary data ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 5/5] Auto detect both x64 and ia32 boot*.efi payloads
On Wed, Aug 21, 2013 at 10:16 PM, Darren Hart dvh...@linux.intel.com wrote: On Wed, 2013-08-21 at 21:31 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 9:26 PM, Darren Hart dvh...@linux.intel.com wrote: On Wed, 2013-08-21 at 20:59 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 8:13 PM, Darren Hart dvh...@linux.intel.com wrote: The EFI specification documents /EFI/BOOT/bootx64.efi for x86_64 machines and /EFI/BOOT/bootia32.efi for ia32 machines. Update the auto detection to allow for both. Signed-off-by: Darren Hart dvh...@linux.intel.com --- src/efi/gummiboot.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c index 9f2f31d..32e6f32 100644 --- a/src/efi/gummiboot.c +++ b/src/efi/gummiboot.c @@ -2199,7 +2199,10 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, Lauto-efi-shell, 's', LEFI Shell, L\\shellx64.efi); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default, '\0', LEFI Default Loader, L\\EFI\\BOOT\\BOOTX64.EFI); + Lauto-efi-default-64, '\0', LEFI Default Loader (x64), L\\EFI\\BOOT\\BOOTX64.EFI); +config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, + Lauto-efi-default-32, '\0', LEFI Default Loader (ia32), L\\EFI\\BOOT\\BOOTIA32.EFI); + Does it make sense to show both? Can EFI even start the non-native one? Shouldn't we just look for the native one, by composing the string at compile time? Hrm, good point. In my environment, I only have OR the other, and no distros currently support IA32 EFI :-) But they should! So, yes, this should be improved as you say. Should this just be an #ifdef/#else? on the arch as is done for the ia32 tsc asm read function MACHINE_TYPE_NAME might just work. It's a define from the build system. OK, hoping you can save me some time here. I'm trying something like this (I believe the filenames are case insensitive?): Yeah, it's all on FAT, has no case, really. $ git diff diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c index 32e6f32..edfab72 100644 --- a/src/efi/gummiboot.c +++ b/src/efi/gummiboot.c @@ -2196,12 +2196,16 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { /* if we find some well-known loaders, add them to the end of the list */ config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, Lauto-windows, 'w', LWindows Boot Manager, L\\EFI\\Microsoft\\Boot\\bootmgfw.efi); + +s = PoolPrint(L\\shell%s.efi, MACHINE_TYPE_NAME); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-shell, 's', LEFI Shell, L\\shellx64.efi); -config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default-64, '\0', LEFI Default Loader (x64), L\\EFI\\BOOT\\BOOTX64.EFI); + Lauto-efi-shell, 's', LEFI Shell, s); +FreePool(s); + +s = PoolPrint(LEFI Default Loader, L\\EFI\\BOOT\\BOOT%s.EFI, MACHINE_TYPE_NAME); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default-32, '\0', LEFI Default Loader (ia32), L\\EFI\\BOOT\\BOOTIA32.EFI); + Lauto-efi-default, '\0', LEFI Default Loader, s); +FreePool(s); config_entry_add_osx(config); efivar_set(LLoaderEntriesAuto, config.entries_auto, FALSE); But the build complains about MACHINE_TYPE_NAME not being defined: $ make make --no-print-directory all-am CC src/efi/gummiboot.o src/efi/gummiboot.c: In function ‘efi_main’: src/efi/gummiboot.c:2200:41: error: ‘MACHINE_TYPE_NAME’ undeclared (first use in this function) s = PoolPrint(L\\shell%s.efi, MACHINE_TYPE_NAME); ^ src/efi/gummiboot.c:2200:41: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [src/efi/gummiboot.o] Error 1 make: *** [all] Error 2 I see it in the gummiboot_CFLAGS, what do I have to do to get that to src/efi/gummiboot.c? Patch attached. Does this work? Only compile-tested ... Kay machine-type.patch Description: Binary data ___ systemd-devel mailing list
Re: [systemd-devel] [PATCH 5/5] Auto detect both x64 and ia32 boot*.efi payloads
On Wed, 2013-08-21 at 13:16 -0700, Darren Hart wrote: On Wed, 2013-08-21 at 21:31 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 9:26 PM, Darren Hart dvh...@linux.intel.com wrote: On Wed, 2013-08-21 at 20:59 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 8:13 PM, Darren Hart dvh...@linux.intel.com wrote: The EFI specification documents /EFI/BOOT/bootx64.efi for x86_64 machines and /EFI/BOOT/bootia32.efi for ia32 machines. Update the auto detection to allow for both. Signed-off-by: Darren Hart dvh...@linux.intel.com --- src/efi/gummiboot.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c index 9f2f31d..32e6f32 100644 --- a/src/efi/gummiboot.c +++ b/src/efi/gummiboot.c @@ -2199,7 +2199,10 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, Lauto-efi-shell, 's', LEFI Shell, L\\shellx64.efi); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default, '\0', LEFI Default Loader, L\\EFI\\BOOT\\BOOTX64.EFI); + Lauto-efi-default-64, '\0', LEFI Default Loader (x64), L\\EFI\\BOOT\\BOOTX64.EFI); +config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, + Lauto-efi-default-32, '\0', LEFI Default Loader (ia32), L\\EFI\\BOOT\\BOOTIA32.EFI); + Does it make sense to show both? Can EFI even start the non-native one? Shouldn't we just look for the native one, by composing the string at compile time? Hrm, good point. In my environment, I only have OR the other, and no distros currently support IA32 EFI :-) But they should! So, yes, this should be improved as you say. Should this just be an #ifdef/#else? on the arch as is done for the ia32 tsc asm read function MACHINE_TYPE_NAME might just work. It's a define from the build system. OK, hoping you can save me some time here. I'm trying something like this (I believe the filenames are case insensitive?): $ git diff diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c index 32e6f32..edfab72 100644 --- a/src/efi/gummiboot.c +++ b/src/efi/gummiboot.c @@ -2196,12 +2196,16 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { /* if we find some well-known loaders, add them to the end of the list */ config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, Lauto-windows, 'w', LWindows Boot Manager, L\\EFI\\Microsoft\\Boot\\bootmgfw.efi); + +s = PoolPrint(L\\shell%s.efi, MACHINE_TYPE_NAME); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-shell, 's', LEFI Shell, L\\shellx64.efi); -config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default-64, '\0', LEFI Default Loader (x64), L\\EFI\\BOOT\\BOOTX64.EFI); + Lauto-efi-shell, 's', LEFI Shell, s); +FreePool(s); + +s = PoolPrint(LEFI Default Loader, L\\EFI\\BOOT\\BOOT%s.EFI, MACHINE_TYPE_NAME); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default-32, '\0', LEFI Default Loader (ia32), L\\EFI\\BOOT\\BOOTIA32.EFI); + Lauto-efi-default, '\0', LEFI Default Loader, s); +FreePool(s); config_entry_add_osx(config); efivar_set(LLoaderEntriesAuto, config.entries_auto, FALSE); But the build complains about MACHINE_TYPE_NAME not being defined: $ make make --no-print-directory all-am CC src/efi/gummiboot.o src/efi/gummiboot.c: In function ‘efi_main’: src/efi/gummiboot.c:2200:41: error: ‘MACHINE_TYPE_NAME’ undeclared (first use in this function) s = PoolPrint(L\\shell%s.efi, MACHINE_TYPE_NAME); ^ src/efi/gummiboot.c:2200:41: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [src/efi/gummiboot.o] Error 1 make: *** [all] Error 2 I see it in the gummiboot_CFLAGS, what do I have to do to get that to src/efi/gummiboot.c? Nevermind, found it: $ git diff diff --git a/Makefile.am b/Makefile.am index 5dc9493..dcf4334 100644 --- a/Makefile.am +++ b/Makefile.am @@ -91,7 +91,8 @@ efi_cflags = \ -fno-stack-protector \
Re: [systemd-devel] [PATCH 5/5] Auto detect both x64 and ia32 boot*.efi payloads
On Wed, 2013-08-21 at 22:25 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 10:16 PM, Darren Hart dvh...@linux.intel.com wrote: On Wed, 2013-08-21 at 21:31 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 9:26 PM, Darren Hart dvh...@linux.intel.com wrote: On Wed, 2013-08-21 at 20:59 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 8:13 PM, Darren Hart dvh...@linux.intel.com wrote: The EFI specification documents /EFI/BOOT/bootx64.efi for x86_64 machines and /EFI/BOOT/bootia32.efi for ia32 machines. Update the auto detection to allow for both. Signed-off-by: Darren Hart dvh...@linux.intel.com --- src/efi/gummiboot.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c index 9f2f31d..32e6f32 100644 --- a/src/efi/gummiboot.c +++ b/src/efi/gummiboot.c @@ -2199,7 +2199,10 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, Lauto-efi-shell, 's', LEFI Shell, L\\shellx64.efi); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default, '\0', LEFI Default Loader, L\\EFI\\BOOT\\BOOTX64.EFI); + Lauto-efi-default-64, '\0', LEFI Default Loader (x64), L\\EFI\\BOOT\\BOOTX64.EFI); +config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, + Lauto-efi-default-32, '\0', LEFI Default Loader (ia32), L\\EFI\\BOOT\\BOOTIA32.EFI); + Does it make sense to show both? Can EFI even start the non-native one? Shouldn't we just look for the native one, by composing the string at compile time? Hrm, good point. In my environment, I only have OR the other, and no distros currently support IA32 EFI :-) But they should! So, yes, this should be improved as you say. Should this just be an #ifdef/#else? on the arch as is done for the ia32 tsc asm read function MACHINE_TYPE_NAME might just work. It's a define from the build system. OK, hoping you can save me some time here. I'm trying something like this (I believe the filenames are case insensitive?): Yeah, it's all on FAT, has no case, really. $ git diff diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c index 32e6f32..edfab72 100644 --- a/src/efi/gummiboot.c +++ b/src/efi/gummiboot.c @@ -2196,12 +2196,16 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { /* if we find some well-known loaders, add them to the end of the list */ config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, Lauto-windows, 'w', LWindows Boot Manager, L\\EFI\\Microsoft\\Boot\\bootmgfw.efi); + +s = PoolPrint(L\\shell%s.efi, MACHINE_TYPE_NAME); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-shell, 's', LEFI Shell, L\\shellx64.efi); -config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default-64, '\0', LEFI Default Loader (x64), L\\EFI\\BOOT\\BOOTX64.EFI); + Lauto-efi-shell, 's', LEFI Shell, s); +FreePool(s); + +s = PoolPrint(LEFI Default Loader, L\\EFI\\BOOT\\BOOT%s.EFI, MACHINE_TYPE_NAME); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default-32, '\0', LEFI Default Loader (ia32), L\\EFI\\BOOT\\BOOTIA32.EFI); + Lauto-efi-default, '\0', LEFI Default Loader, s); +FreePool(s); config_entry_add_osx(config); efivar_set(LLoaderEntriesAuto, config.entries_auto, FALSE); But the build complains about MACHINE_TYPE_NAME not being defined: $ make make --no-print-directory all-am CC src/efi/gummiboot.o src/efi/gummiboot.c: In function ‘efi_main’: src/efi/gummiboot.c:2200:41: error: ‘MACHINE_TYPE_NAME’ undeclared (first use in this function) s = PoolPrint(L\\shell%s.efi, MACHINE_TYPE_NAME); ^ src/efi/gummiboot.c:2200:41: note: each undeclared identifier is reported only once for each function it appears in make[1]: *** [src/efi/gummiboot.o] Error 1 make: *** [all] Error 2 I see it in the gummiboot_CFLAGS, what do I have to do to get that to src/efi/gummiboot.c? Patch attached. Does this
Re: [systemd-devel] Question on debugging getty 'runlevel 3' issue.
On 08/21/2013 06:40 AM, Ben Greear wrote: On 08/21/2013 02:53 AM, Kay Sievers wrote: On Wed, Aug 21, 2013 at 11:49 AM, Colin Guthrie gm...@colin.guthr.ie wrote: 'Twas brillig, and Ben Greear at 20/08/13 22:46 did gyre and gimble: Does anyone know what package or thing was doing the text prompt on the serial console? It happens automatically based on kernel command line params as far as I know... Check: $ cat /proc/cmdline if there is console=, if yes, then something probably added this to your boot loader config. No, I understand perfectly why serial console is active. I want to know what thing is doing that initial config logic instead of a normal login prompt. I want to manually force the initial config logic to run and/or just disable it with some sort of script so that users don't *have* to connect to the serial console to get a login prompt at runlevel 3. I'll go grep the file system today and try to find it... Looks like I hit this bug in the initial-setup package: https://bugzilla.redhat.com/show_bug.cgi?id=979174 I left a comment in that bug...hopefully the next person will have a quicker time finding the root cause!. Thanks, Ben -- Ben Greear gree...@candelatech.com Candela Technologies Inc http://www.candelatech.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 5/5] Auto detect both x64 and ia32 boot*.efi payloads
On Wed, 2013-08-21 at 13:41 -0700, Darren Hart wrote: On Wed, 2013-08-21 at 22:25 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 10:16 PM, Darren Hart dvh...@linux.intel.com wrote: On Wed, 2013-08-21 at 21:31 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 9:26 PM, Darren Hart dvh...@linux.intel.com wrote: On Wed, 2013-08-21 at 20:59 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 8:13 PM, Darren Hart dvh...@linux.intel.com wrote: The EFI specification documents /EFI/BOOT/bootx64.efi for x86_64 machines and /EFI/BOOT/bootia32.efi for ia32 machines. Update the auto detection to allow for both. Signed-off-by: Darren Hart dvh...@linux.intel.com --- src/efi/gummiboot.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c index 9f2f31d..32e6f32 100644 --- a/src/efi/gummiboot.c +++ b/src/efi/gummiboot.c @@ -2199,7 +2199,10 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, Lauto-efi-shell, 's', LEFI Shell, L\\shellx64.efi); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default, '\0', LEFI Default Loader, L\\EFI\\BOOT\\BOOTX64.EFI); + Lauto-efi-default-64, '\0', LEFI Default Loader (x64), L\\EFI\\BOOT\\BOOTX64.EFI); +config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, + Lauto-efi-default-32, '\0', LEFI Default Loader (ia32), L\\EFI\\BOOT\\BOOTIA32.EFI); + Does it make sense to show both? Can EFI even start the non-native one? Shouldn't we just look for the native one, by composing the string at compile time? Hrm, good point. In my environment, I only have OR the other, and no distros currently support IA32 EFI :-) But they should! So, yes, this should be improved as you say. Should this just be an #ifdef/#else? on the arch as is done for the ia32 tsc asm read function MACHINE_TYPE_NAME might just work. It's a define from the build system. OK, hoping you can save me some time here. I'm trying something like this (I believe the filenames are case insensitive?): Yeah, it's all on FAT, has no case, really. $ git diff diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c index 32e6f32..edfab72 100644 --- a/src/efi/gummiboot.c +++ b/src/efi/gummiboot.c @@ -2196,12 +2196,16 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { /* if we find some well-known loaders, add them to the end of the list */ config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, Lauto-windows, 'w', LWindows Boot Manager, L\\EFI\\Microsoft\\Boot\\bootmgfw.efi); + +s = PoolPrint(L\\shell%s.efi, MACHINE_TYPE_NAME); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-shell, 's', LEFI Shell, L\\shellx64.efi); -config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default-64, '\0', LEFI Default Loader (x64), L\\EFI\\BOOT\\BOOTX64.EFI); + Lauto-efi-shell, 's', LEFI Shell, s); +FreePool(s); + +s = PoolPrint(LEFI Default Loader, L\\EFI\\BOOT\\BOOT%s.EFI, MACHINE_TYPE_NAME); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default-32, '\0', LEFI Default Loader (ia32), L\\EFI\\BOOT\\BOOTIA32.EFI); + Lauto-efi-default, '\0', LEFI Default Loader, s); +FreePool(s); config_entry_add_osx(config); efivar_set(LLoaderEntriesAuto, config.entries_auto, FALSE); But the build complains about MACHINE_TYPE_NAME not being defined: $ make make --no-print-directory all-am CC src/efi/gummiboot.o src/efi/gummiboot.c: In function ‘efi_main’: src/efi/gummiboot.c:2200:41: error: ‘MACHINE_TYPE_NAME’ undeclared (first use in this function) s = PoolPrint(L\\shell%s.efi, MACHINE_TYPE_NAME); ^ src/efi/gummiboot.c:2200:41: note: each undeclared identifier is reported only once for each function it appears in make[1]: ***
Re: [systemd-devel] [PATCH 5/5] Auto detect both x64 and ia32 boot*.efi payloads
On Wed, 2013-08-21 at 23:37 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 11:34 PM, Darren Hart dvh...@linux.intel.com wrote: Hrm, actually no that fails finding VERSION ins setup.c. Did you ./autogen.sh before building? Oh, sorry, it probably just misses: +gummiboot_CPPFLAGS = \ + $(AM_CPPFLAGS) \ Kay OK, so you'd prefer to move the -D* args to the CPPFLAGS? I can respin with that with only minimal build testing as that was failing on the host as well. -- Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 5/5] Auto detect both x64 and ia32 boot*.efi payloads
On Thu, Aug 22, 2013 at 12:07 AM, Darren Hart dvh...@linux.intel.com wrote: On Wed, 2013-08-21 at 23:37 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 11:34 PM, Darren Hart dvh...@linux.intel.com wrote: Hrm, actually no that fails finding VERSION ins setup.c. Did you ./autogen.sh before building? Oh, sorry, it probably just misses: +gummiboot_CPPFLAGS = \ + $(AM_CPPFLAGS) \ OK, so you'd prefer to move the -D* args to the CPPFLAGS? I can respin with that with only minimal build testing as that was failing on the host as well. Yeah, that's where they technically belong. I've just committed the setup.c part, and added a bunch of EFI* variable to be able to add stuff at build time. Builds fine here. The stuff for gummiboot.efi should be simple to add on top now. Thanks, Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 3/5] Makefile.am: Allow for user override of EFI include dir
On Wed, Aug 21, 2013 at 9:02 PM, Kay Sievers k...@vrfy.org wrote: On Wed, Aug 21, 2013 at 8:13 PM, Darren Hart dvh...@linux.intel.com wrote: Enable cross-compiling by allowing the user to specify an alternative to the /usr/include directory for the EFI includes. Add a variable INCDIR defaulting to /usr/include, but still allowing the user to provide their own value. We separate the setup tool options from the efi stuff with an efi_ prefix. I've added a few more variables including this one, which is called EFI_INCDIR now. Thanks, Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 5/5] Auto detect both x64 and ia32 boot*.efi payloads
On Thu, 2013-08-22 at 00:20 +0200, Kay Sievers wrote: On Thu, Aug 22, 2013 at 12:07 AM, Darren Hart dvh...@linux.intel.com wrote: On Wed, 2013-08-21 at 23:37 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 11:34 PM, Darren Hart dvh...@linux.intel.com wrote: Hrm, actually no that fails finding VERSION ins setup.c. Did you ./autogen.sh before building? Oh, sorry, it probably just misses: +gummiboot_CPPFLAGS = \ + $(AM_CPPFLAGS) \ OK, so you'd prefer to move the -D* args to the CPPFLAGS? I can respin with that with only minimal build testing as that was failing on the host as well. Yeah, that's where they technically belong. I've just committed the setup.c part, and added a bunch of EFI* variable to be able to add stuff at build time. Builds fine here. The stuff for gummiboot.efi should be simple to add on top now. Ack, will respin. And thanks for the prompt responses here. -- Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 3/5] Makefile.am: Allow for user override of EFI include dir
On Wed, Aug 21, 2013 at 11:13:41AM -0700, Darren Hart wrote: Enable cross-compiling by allowing the user to specify an alternative to the /usr/include directory for the EFI includes. Add a variable INCDIR defaulting to /usr/include, but still allowing the user to provide their own value. Signed-off-by: Darren Hart dvh...@linux.intel.com --- Makefile.am | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index c3dfcb2..5dc9493 100644 --- a/Makefile.am +++ b/Makefile.am @@ -72,10 +72,11 @@ CLEANFILES += man/gummiboot.8 efi_loadername = gummiboot$(MACHINE_TYPE_NAME).efi efi_sources = src/efi/gummiboot.c +INCDIR := /usr/include Please not like this. There's no reason to use :=, and this should be an AC_ARG_VAR defined in configure.ac, so that it is properly advertised and remembered. Zbyszek ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 0/2 V2] gummiboot: Cross compile and IA32 support
Updated with feedback from Kay and Colin. I've boot tested this, then rebased to use Kay's updated CPP flags, and build tested. I am using a laoder/* config, so I wasn't sure where the BOOTIA32.EFI string came into play. Is that only used if no loader is provided. If gummiboot is typically BOOTIA32.EFI seems odd to include something that would effectively just restart the bootloader Thanks, Darren ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/2] Autodetect both x64 and ia32 boot*.efi payloads
The EFI specification documents /EFI/BOOT/bootx64.efi for x86_64 machines and /EFI/BOOT/bootia32.efi for ia32 machines. Update the auto detection to allow for both. Add the MACHINE_TYPE_NAME define to the efi/src build so we can use it as the standard suffix for the EFI payloads (ia32 or x64). Signed-off-by: Darren Hart dvh...@linux.intel.com --- Makefile.am | 3 ++- src/efi/gummiboot.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2678ab3..062f83e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -80,7 +80,8 @@ efi_cppflags = \ $(EFI_CPPFLAGS) \ -I$(top_builddir) -include config.h \ -I$(EFI_INCDIR)/efi \ - -I$(EFI_INCDIR)/efi/$(ARCH) + -I$(EFI_INCDIR)/efi/$(ARCH) \ + -DMACHINE_TYPE_NAME=\$(MACHINE_TYPE_NAME)\ efi_cflags = \ $(EFI_CFLAGS) \ diff --git a/src/efi/gummiboot.c b/src/efi/gummiboot.c index 9f2f31d..123433f 100644 --- a/src/efi/gummiboot.c +++ b/src/efi/gummiboot.c @@ -2197,9 +2197,9 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, Lauto-windows, 'w', LWindows Boot Manager, L\\EFI\\Microsoft\\Boot\\bootmgfw.efi); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-shell, 's', LEFI Shell, L\\shellx64.efi); + Lauto-efi-shell, 's', LEFI Shell, L\\shell MACHINE_TYPE_NAME .efi); config_entry_add_loader_auto(config, loaded_image-DeviceHandle, root_dir, loaded_image_path, - Lauto-efi-default, '\0', LEFI Default Loader, L\\EFI\\BOOT\\BOOTX64.EFI); + Lauto-efi-default, '\0', LEFI Default Loader, L\\EFI\\BOOT\\BOOT MACHINE_TYPE_NAME .EFI); config_entry_add_osx(config); efivar_set(LLoaderEntriesAuto, config.entries_auto, FALSE); -- 1.8.3.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 2/2] configure.ac: Disable the QEMU BIOS test when cross compiling
When cross-compiling, AC_CHECK_FILE aborts configure. Skip it when cross compiling. Signed-off-by: Darren Hart dvh...@linux.intel.com Cc: Colin Walters walt...@verbum.org --- configure.ac | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 137580a..a9534be 100644 --- a/configure.ac +++ b/configure.ac @@ -65,10 +65,12 @@ AM_COND_IF(ARCH_X86_64, [ AC_SUBST([ARCH]) AC_SUBST([MACHINE_TYPE_NAME]) -# test bios -AC_CHECK_FILE([/usr/lib/qemu-bios],[BIOS=/usr/lib/qemu-bios]) -AC_CHECK_FILE([/usr/share/qemu-ovmf/bios], [BIOS=/usr/share/qemu-ovmf/bios]) -AC_SUBST([BIOS]) +dnl Do not test for bios when cross compiling +AS_IF([test x$cross_compiling = xno], [ + AC_CHECK_FILE([/usr/lib/qemu-bios],[BIOS=/usr/lib/qemu-bios]) + AC_CHECK_FILE([/usr/share/qemu-ovmf/bios], [BIOS=/usr/share/qemu-ovmf/bios]) + AC_SUBST([BIOS]) +]) # -- dnl GNU EFI doesn't use relative paths: efi.h includes efibind.h which is in -- 1.8.3.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 5/5] Auto detect both x64 and ia32 boot*.efi payloads
On Wed, Aug 21, 2013 at 03:07:24PM -0700, Darren Hart wrote: On Wed, 2013-08-21 at 23:37 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 11:34 PM, Darren Hart dvh...@linux.intel.com wrote: Hrm, actually no that fails finding VERSION ins setup.c. Did you ./autogen.sh before building? Oh, sorry, it probably just misses: +gummiboot_CPPFLAGS = \ + $(AM_CPPFLAGS) \ Kay OK, so you'd prefer to move the -D* args to the CPPFLAGS? I can respin with that with only minimal build testing as that was failing on the host as well. Or better append the define on line 173 in Makefile.am, with all other defines. We only define per-target cflags when the name is not generic enough. Zbyszek ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 3/5] Makefile.am: Allow for user override of EFI include dir
On Thu, 2013-08-22 at 00:32 +0200, Zbigniew Jędrzejewski-Szmek wrote: On Wed, Aug 21, 2013 at 11:13:41AM -0700, Darren Hart wrote: Enable cross-compiling by allowing the user to specify an alternative to the /usr/include directory for the EFI includes. Add a variable INCDIR defaulting to /usr/include, but still allowing the user to provide their own value. Signed-off-by: Darren Hart dvh...@linux.intel.com --- Makefile.am | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index c3dfcb2..5dc9493 100644 --- a/Makefile.am +++ b/Makefile.am @@ -72,10 +72,11 @@ CLEANFILES += man/gummiboot.8 efi_loadername = gummiboot$(MACHINE_TYPE_NAME).efi efi_sources = src/efi/gummiboot.c +INCDIR := /usr/include Please not like this. There's no reason to use :=, and Why not? In a cross compilation environment, this may need to be overridden... this should be an AC_ARG_VAR defined in configure.ac, so that it is properly advertised and remembered. Zbyszek -- Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 2/2] configure.ac: Disable the QEMU BIOS test when cross compiling
On Thu, Aug 22, 2013 at 12:38 AM, Darren Hart dvh...@linux.intel.com wrote: When cross-compiling, AC_CHECK_FILE aborts configure. Skip it when cross compiling. Signed-off-by: Darren Hart dvh...@linux.intel.com Cc: Colin Walters walt...@verbum.org --- configure.ac | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 137580a..a9534be 100644 --- a/configure.ac +++ b/configure.ac @@ -65,10 +65,12 @@ AM_COND_IF(ARCH_X86_64, [ AC_SUBST([ARCH]) AC_SUBST([MACHINE_TYPE_NAME]) -# test bios -AC_CHECK_FILE([/usr/lib/qemu-bios],[BIOS=/usr/lib/qemu-bios]) -AC_CHECK_FILE([/usr/share/qemu-ovmf/bios], [BIOS=/usr/share/qemu-ovmf/bios]) -AC_SUBST([BIOS]) +dnl Do not test for bios when cross compiling +AS_IF([test x$cross_compiling = xno], [ + AC_CHECK_FILE([/usr/lib/qemu-bios],[BIOS=/usr/lib/qemu-bios]) + AC_CHECK_FILE([/usr/share/qemu-ovmf/bios], [BIOS=/usr/share/qemu-ovmf/bios]) + AC_SUBST([BIOS]) +]) Oh, sorry, I just committed it already. I was expecting you were still busy with the other thing. :) Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 3/5] Makefile.am: Allow for user override of EFI include dir
On Thu, Aug 22, 2013 at 12:28 AM, Jan Engelhardt jeng...@inai.de wrote: On Wednesday 2013-08-21 21:02, Kay Sievers wrote: On Wed, Aug 21, 2013 at 8:13 PM, Darren Hart dvh...@linux.intel.com wrote: --- a/Makefile.am +++ b/Makefile.am @@ -72,10 +72,11 @@ CLEANFILES += man/gummiboot.8 efi_loadername = gummiboot$(MACHINE_TYPE_NAME).efi efi_sources = src/efi/gummiboot.c +INCDIR := /usr/include efi_cppflags = \ -I$(top_builddir) -include config.h \ - -I/usr/include/efi \ - -I/usr/include/efi/$(ARCH) + -I$(INCDIR)/efi \ + -I$(INCDIR)/efi/$(ARCH) Hmm, how do other projects do this? Is'n autoconfs: ./configure --includedir supposed to do that? No, --includedir= specifies where the headers for use with just-built software goes. See AC_ARG_WITH(kbd-loadkeys ... in configure.ac for what should be used to specify some value used during build. Ah, right, it's the installation dir, not the one to read from. Thanks, Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 5/5] Auto detect both x64 and ia32 boot*.efi payloads
On Thu, Aug 22, 2013 at 1:12 AM, Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl wrote: On Thu, Aug 22, 2013 at 12:49:55AM +0200, Kay Sievers wrote: On Thu, Aug 22, 2013 at 12:38 AM, Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl wrote: On Wed, Aug 21, 2013 at 03:07:24PM -0700, Darren Hart wrote: On Wed, 2013-08-21 at 23:37 +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 11:34 PM, Darren Hart dvh...@linux.intel.com wrote: Hrm, actually no that fails finding VERSION ins setup.c. Did you ./autogen.sh before building? Oh, sorry, it probably just misses: +gummiboot_CPPFLAGS = \ + $(AM_CPPFLAGS) \ Kay OK, so you'd prefer to move the -D* args to the CPPFLAGS? I can respin with that with only minimal build testing as that was failing on the host as well. Or better append the define on line 173 in Makefile.am, with all other defines. We only define per-target cflags when the name is not generic enough. 173? This is gummiboot.git, you are looking at systemd? Wait, gummiboot hasn't been incorporated into systemd yet? No, not so far. :) OK, then please disregard my comments. Yeah, I was thinking about systemd, and didn't know that gummiboot doesn't use autotools. gummiboot uses autotools, but the EFI build is somewhat special and we bypass most of the autofoo stuff: http://cgit.freedesktop.org/gummiboot/tree/Makefile.am#n71 There is a /usr/bin/gummiboot tool though, in the same source tree, and it uses the normal autofoo stuff. Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] remove hasprefix(), use startswith()
memcmp() could read from uninitilized memory if string is at the end of a page boundry and shorter than prefix --- TODO | 2 -- src/journal/journal-send.c | 2 +- src/journal/journald-native.c | 12 ++-- src/libsystemd-bus/bus-match.c | 26 +- src/shared/logs-show.c | 2 +- src/shared/macro.h | 2 -- 6 files changed, 21 insertions(+), 25 deletions(-) diff --git a/TODO b/TODO index 9bc14fd..3800ce4 100644 --- a/TODO +++ b/TODO @@ -96,8 +96,6 @@ Features: * systemctl list-unit-files should list generated files (and probably with a new state generated for them, or so) -* do we really need both hasprefix() and startswith()? - * journald: when we drop syslog messages because the syslog socket is full, make sure to write how many messages are lost as first thing to syslog when it works again. diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c index fef66fc..d00e26f 100644 --- a/src/journal/journal-send.c +++ b/src/journal/journal-send.c @@ -245,7 +245,7 @@ _public_ int sd_journal_sendv(const struct iovec *iov, int n) { have_syslog_identifier = have_syslog_identifier || (c == (char *) iov[i].iov_base + 17 - hasprefix(iov[i].iov_base, SYSLOG_IDENTIFIER)); + startswith(iov[i].iov_base, SYSLOG_IDENTIFIER)); nl = memchr(iov[i].iov_base, '\n', iov[i].iov_len); if (nl) { diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c index 0f9af37..c50cf64 100644 --- a/src/journal/journald-native.c +++ b/src/journal/journald-native.c @@ -154,23 +154,23 @@ void server_process_native_message( * of this entry for the rate limiting * logic */ if (l == 10 -hasprefix(p, PRIORITY=) +startswith(p, PRIORITY=) p[9] = '0' p[9] = '9') priority = (priority LOG_FACMASK) | (p[9] - '0'); else if (l == 17 - hasprefix(p, SYSLOG_FACILITY=) + startswith(p, SYSLOG_FACILITY=) p[16] = '0' p[16] = '9') priority = (priority LOG_PRIMASK) | ((p[16] - '0') 3); else if (l == 18 - hasprefix(p, SYSLOG_FACILITY=) + startswith(p, SYSLOG_FACILITY=) p[16] = '0' p[16] = '9' p[17] = '0' p[17] = '9') priority = (priority LOG_PRIMASK) | (((p[16] - '0')*10 + (p[17] - '0')) 3); else if (l = 19 - hasprefix(p, SYSLOG_IDENTIFIER=)) { + startswith(p, SYSLOG_IDENTIFIER=)) { char *t; t = strndup(p + 18, l - 18); @@ -179,7 +179,7 @@ void server_process_native_message( identifier = t; } } else if (l = 8 - hasprefix(p, MESSAGE=)) { + startswith(p, MESSAGE=)) { char *t; t = strndup(p + 8, l - 8); @@ -189,7 +189,7 @@ void server_process_native_message( } } else if (l strlen(OBJECT_PID=) l strlen(OBJECT_PID=) + DECIMAL_STR_MAX(pid_t) - hasprefix(p, OBJECT_PID=) + startswith(p, OBJECT_PID=) allow_object_pid(ucred)) { char buf[DECIMAL_STR_MAX(pid_t)]; memcpy(buf, p + strlen(OBJECT_PID=), l - strlen(OBJECT_PID=)); diff --git a/src/libsystemd-bus/bus-match.c b/src/libsystemd-bus/bus-match.c index 750acfe..1411167 100644 --- a/src/libsystemd-bus/bus-match.c +++ b/src/libsystemd-bus/bus-match.c @@ -555,22 +555,22 @@ static int bus_match_find_leaf( enum bus_match_node_type bus_match_node_type_from_string(const char *k, size_t n) { assert(k); -if (n == 4 hasprefix(k, type)) +if (n == 4 startswith(k, type)) return BUS_MATCH_MESSAGE_TYPE; -if (n == 6
Re: [systemd-devel] [PATCH 1/2] Optimize startswith() to macro
On Wed, Aug 21, 2013 at 10:16 PM, Kay Sievers k...@vrfy.org wrote: On Wed, Aug 21, 2013 at 8:15 PM, WANG Chao chaow...@redhat.com wrote: Take this optimized code from Lennart[1]. Now startswith is a macro using strncmp and should be fast enough. [1]: http://lists.freedesktop.org/archives/systemd-devel/2013-July/011860.html --- src/shared/macro.h | 5 + src/shared/util.c | 17 - 2 files changed, 5 insertions(+), 17 deletions(-) It fails to compile, there are the prototypes in util.h still. Also quite a few places do not include macro.h ... I guess it's easier and cleaner anyway to use simple static inline functions instead of defines. Patch attached. Zbigniew, mind checking if that patch makes sense? You added the hasprefix a while ago, and you also proposed a version to unify the both. We really should get that topic sorted out now. :) Kay ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [RFC] mount: improve DefaultDependencies and use in generator
On Wed, Aug 21, 2013 at 10:06 PM, Thomas Bächler tho...@archlinux.org wrote: Am 21.08.2013 13:53, schrieb Tom Gundersen: I'd like to move some of the default dependency logic from the fstab generator to core. This should remove some redundancy and also improve consistency between mount units and fstab entries. The first patch simply enables default dependencies in the generator, and removes some things that are then made redundant. The second patch moves the handling of device dependencies from the generator to core's default dependencies. DefaultDependencies=yes implicitly adds Before=foo.target for every target foo that wants or requires the unit. This has a negative effect on auto,x-systemd.automount mounts: Enabling DefaultDependencies will make the generated .mount unit Before=local-fs.target, which will remove the speed-up gained by delaying the mount. Good catch. Any objections to making the mount targets DefaultDependencies=no (and add a conflict with shutdown.target)? Just reading the manpages (and not checking all the code paths), this should not have any adverse effects. Comments? Tom ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] use CAP_MKNOD ConditionCapability
Fixes errors seen when booting VMs on QEMU like systemd[1]: kmod-static-nodes.service: main process exited, code=exited, status=203/EXEC systemd[1]: Failed to start Create list of required static device nodes for the current kernel. systemd[1]: Unit kmod-static-nodes.service entered failed state. Make sure that mknod capability is available Signed-off-by: Khem Raj raj.k...@gmail.com --- units/kmod-static-nodes.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/units/kmod-static-nodes.service.in b/units/kmod-static-nodes.service.in index 98664ea..d8a8420 100644 --- a/units/kmod-static-nodes.service.in +++ b/units/kmod-static-nodes.service.in @@ -9,7 +9,7 @@ Description=Create list of required static device nodes for the current kernel DefaultDependencies=no Before=sysinit.target systemd-tmpfiles-setup-dev.service -ConditionVirtualization=!container +ConditionCapability=CAP_MKNOD [Service] Type=oneshot -- 1.8.3.4 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 0/2 V2] gummiboot: Cross compile and IA32 support
On Thu, 2013-08-22 at 00:53 +0200, Kay Sievers wrote: On Thu, Aug 22, 2013 at 12:38 AM, Darren Hart dvh...@linux.intel.com wrote: Updated with feedback from Kay and Colin. I've boot tested this, then rebased to use Kay's updated CPP flags, and build tested. It's all in git now, right? Anything missing? Looks like we're good. The only thing I'm slightly confused about is the EFI_INCDIR. Zbyszek and Jan suggested using AC_ARG_WITH(...) instead. What are your plans with this bit? Should I wait for an update to this before fixing up my meta-data in the build system to deal with EFI_INCDIR, or is EFI_INCDIR here to stay? Thanks a lot Kay, -- Darren Hart Intel Open Source Technology Center Yocto Project - Linux Kernel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] remove hasprefix(), use startswith()
On Wed, Aug 21, 2013 at 06:20:55PM -0700, Shawn Landden wrote: memcmp() could read from uninitilized memory if string is at the end of a page boundry and shorter than prefix Applied, but without this description, since it is misleading: afaict, in all cases it was firsst checked that the string is long enough. Zbyszek ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/2] Optimize startswith() to macro
On Thu, Aug 22, 2013 at 03:52:29AM +0200, Kay Sievers wrote: On Wed, Aug 21, 2013 at 10:16 PM, Kay Sievers k...@vrfy.org wrote: On Wed, Aug 21, 2013 at 8:15 PM, WANG Chao chaow...@redhat.com wrote: Take this optimized code from Lennart[1]. Now startswith is a macro using strncmp and should be fast enough. [1]: http://lists.freedesktop.org/archives/systemd-devel/2013-July/011860.html --- src/shared/macro.h | 5 + src/shared/util.c | 17 - 2 files changed, 5 insertions(+), 17 deletions(-) It fails to compile, there are the prototypes in util.h still. Also quite a few places do not include macro.h ... I guess it's easier and cleaner anyway to use simple static inline functions instead of defines. Patch attached. Zbigniew, mind checking if that patch makes sense? You added the hasprefix a while ago, and you also proposed a version to unify the both. We really should get that topic sorted out now. :) Looks correct, pushed this along with Shawn's patch. Zbyszek ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] use CAP_MKNOD ConditionCapability
On Wed, Aug 21, 2013 at 08:35:44PM -0700, Khem Raj wrote: Fixes errors seen when booting VMs on QEMU like systemd[1]: kmod-static-nodes.service: main process exited, code=exited, status=203/EXEC systemd[1]: Failed to start Create list of required static device nodes for the current kernel. systemd[1]: Unit kmod-static-nodes.service entered failed state. Make sure that mknod capability is available Signed-off-by: Khem Raj raj.k...@gmail.com Applied. Zbyszek ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel