diff options
author | Will Woods <wwoods@redhat.com> | 2012-06-17 13:47:16 -0400 |
---|---|---|
committer | Will Woods <wwoods@redhat.com> | 2012-06-19 17:02:45 -0400 |
commit | ef891e486e77f7e43b9bd0ee2df92776bf7640fd (patch) | |
tree | f6f0fdedcdf845ef7bf9d533e2dc2c7b81fe9841 /data | |
parent | 100e2588b5ab6415857914f49186bf4f69d2dd27 (diff) | |
download | anaconda-ef891e486e77f7e43b9bd0ee2df92776bf7640fd.tar.gz anaconda-ef891e486e77f7e43b9bd0ee2df92776bf7640fd.tar.xz anaconda-ef891e486e77f7e43b9bd0ee2df92776bf7640fd.zip |
Add anaconda-cleanup-initramfs.service
This adds anaconda-cleanup-initramfs.service, so we can clean
unnecessary/redundant files out of /run/initramfs to save RAM.
The initial cleanup strategy is to remove kernel modules, firmware, and
the ssl certificate store, because the anaconda runtime has all these
things already. This saves about 40MB RAM.
Diffstat (limited to 'data')
-rw-r--r-- | data/systemd/Makefile.am | 12 | ||||
-rwxr-xr-x | data/systemd/anaconda-cleanup-initramfs | 18 | ||||
-rw-r--r-- | data/systemd/anaconda-cleanup-initramfs.service | 10 |
3 files changed, 39 insertions, 1 deletions
diff --git a/data/systemd/Makefile.am b/data/systemd/Makefile.am index 108d7e528..8579ece04 100644 --- a/data/systemd/Makefile.am +++ b/data/systemd/Makefile.am @@ -19,6 +19,16 @@ systemddir = /lib/systemd/system generatordir = /lib/systemd/system-generators -dist_systemd_DATA = anaconda-shell@.service anaconda.target anaconda@.service instperf.service anaconda-sshd.service + +dist_systemd_DATA = anaconda@.service \ + anaconda.target \ + anaconda-shell@.service \ + instperf.service \ + anaconda-sshd.service \ + anaconda-cleanup-initramfs.service + dist_generator_SCRIPTS = anaconda-generator + +dist_sbin_SCRIPTS = anaconda-cleanup-initramfs + MAINTAINERCLEANFILES = Makefile.in diff --git a/data/systemd/anaconda-cleanup-initramfs b/data/systemd/anaconda-cleanup-initramfs new file mode 100755 index 000000000..66b6e0785 --- /dev/null +++ b/data/systemd/anaconda-cleanup-initramfs @@ -0,0 +1,18 @@ +#!/bin/bash +# anaconda-cleanup-initramfs - clean up initramfs to save RAM. +# +# Normal systems just throw away the initramfs after boot, since they have a +# copy of it in /boot/initramfs-$(uname -r).img that they can unpack and use +# to shut down the system cleanly. (See dracut-shutdown.service.) +# +# We have to keep initramfs because we don't have it laying around in /boot, +# and we might want to read some files out of it (e.g. /etc/cmdline*) +# +# There are still redundant/unneeded files, though, and we can save RAM by +# cleaning those up. + +systemd-notify --pid --status="Removing unneeded files..." +# the runtime has all the firmware/modules we need. +# removing the ssl certs saves another easy ~1MB. +rm -rf /run/initramfs/usr/lib/{firmware,modules} \ + /run/initramfs/etc/ssl diff --git a/data/systemd/anaconda-cleanup-initramfs.service b/data/systemd/anaconda-cleanup-initramfs.service new file mode 100644 index 000000000..5bed880dd --- /dev/null +++ b/data/systemd/anaconda-cleanup-initramfs.service @@ -0,0 +1,10 @@ +[Unit] +Description=Clean Up Initramfs +Before=anaconda@.service +ConditionPathIsDirectory=/run/initramfs/usr/lib/modules + +[Service] +Type=notify +NotifyAccess=all +RemainAfterExit=yes +ExecStart=/usr/sbin/anaconda-cleanup-initramfs |