Browse code

Reduce the initrd size

* Removing unnecessary packages from the initrd images
* Remove header files and some unnecessary files from the initrd image

Mahmoud Bassiouny authored on 2015/07/23 20:05:28
Showing 3 changed files
... ...
@@ -1,17 +1,17 @@
1 1
 {
2 2
     "packages":["glibc", "zlib", "filesystem",
3
-                "binutils", "gmp", "mpfr", "libgcc", "libstdc++", 
4
-                "sed", "bzip2", "pkg-config", "readline", "ncurses", "bash",
5
-                "cracklib", "cracklib-dicts", "cracklib-python", "shadow", "procps-ng", 
6
-                "coreutils", "iana-etc", "grep", "bc", "libtool",
7
-                "inetutils", "findutils",
8
-                "xz", "grub", "iproute2", "kmod",
3
+                "libgcc", "libstdc++", 
4
+                "sed", "pkg-config", "readline", "ncurses", "bash",
5
+                "cracklib", "cracklib-dicts", "cracklib-python", "shadow", 
6
+                "coreutils", "grep",
7
+                "findutils",
8
+                "xz", "grub", "kmod",
9 9
                 "util-linux", "e2fsprogs",
10
-                "libffi", "expat",
10
+                "expat",
11 11
                 "linux", "cpio",
12 12
                 "Linux-PAM", "attr", "libcap", "systemd", "dbus",
13 13
                 "elfutils-libelf", "sqlite-autoconf", "nspr", "nss", "popt", "lua", "rpm",
14
-                "gptfdisk", "tar", "gzip", "openssl", "python2", "python2-libs", "python-requests",
14
+                "gptfdisk", "gzip", "openssl", "python2", "python2-libs", "python-requests",
15 15
                 "pcre",
16 16
                 "libgsystem", "ostree","device-mapper","device-mapper-libs","libsepol","libselinux", 
17 17
                 "db", "libsolv", "hawkey", "python-hawkey"]
... ...
@@ -271,10 +271,10 @@ class Installer(object):
271 271
         retval = process.wait()
272 272
         if self.iso_installer:
273 273
             # just copy the initramfs /boot -> /photon_mnt/boot
274
-            shutil.copy('/boot/initrd.img-no-kmods', self.photon_root + '/boot/')
274
+            shutil.copy('boot/initrd.img-no-kmods', self.photon_root + '/boot/')
275 275
         else:
276 276
             #Build the initramfs
277
-            process = subprocess.Popen([self.chroot_command, '-w', self.photon_root, './mkinitramfs', '-n', '/boot/initrd.img-no-kmods'],  stdout=self.output)
277
+            process = subprocess.Popen([self.chroot_command, '-w', self.photon_root, './mkinitramfs', '-n', 'boot/initrd.img-no-kmods'],  stdout=self.output)
278 278
             retval = process.wait()
279 279
 
280 280
 
... ...
@@ -106,9 +106,17 @@ createrepo --database ${WORKINGDIR}/RPMS
106 106
 
107 107
 rm -rf ${BUILDROOT}/LOGS
108 108
 
109
+# Cleaning up
109 110
 #Remove our rpm database as it fills up the ramdisk
110 111
 rm -rf ${BUILDROOT}/home/*
111 112
 rm -rf ${BUILDROOT}/var/lib/rpm
113
+
114
+# Remove the boot directory
115
+rm -rf ${BUILDROOT}/boot
116
+
117
+#Remove the include files.
118
+rm -rf ${BUILDROOT}/usr/include
119
+
112 120
 # TODO: mbassiouny, Find a clean way to do that
113 121
 for i in `ls ${BUILDROOT}/usr/share/`; do
114 122
 	if [ $i != 'terminfo' -a $i != 'cracklib' -a $i != 'grub' ]; then