diff options
-rw-r--r-- | meta/classes/image.bbclass | 5 | ||||
-rw-r--r-- | meta/lib/oe/rootfs.py | 57 |
2 files changed, 61 insertions, 1 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 01f8b3fc19..58b4add8fa 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass | |||
@@ -24,6 +24,9 @@ IMAGE_FEATURES ?= "" | |||
24 | IMAGE_FEATURES[type] = "list" | 24 | IMAGE_FEATURES[type] = "list" |
25 | IMAGE_FEATURES[validitems] += "debug-tweaks read-only-rootfs empty-root-password allow-empty-password post-install-logging" | 25 | IMAGE_FEATURES[validitems] += "debug-tweaks read-only-rootfs empty-root-password allow-empty-password post-install-logging" |
26 | 26 | ||
27 | # Generate companion debugfs? | ||
28 | IMAGE_GEN_DEBUGFS ?= "0" | ||
29 | |||
27 | # rootfs bootstrap install | 30 | # rootfs bootstrap install |
28 | ROOTFS_BOOTSTRAP_INSTALL = "${@bb.utils.contains("IMAGE_FEATURES", "package-management", "", "${ROOTFS_PKGMANAGE_BOOTSTRAP}",d)}" | 31 | ROOTFS_BOOTSTRAP_INSTALL = "${@bb.utils.contains("IMAGE_FEATURES", "package-management", "", "${ROOTFS_PKGMANAGE_BOOTSTRAP}",d)}" |
29 | 32 | ||
@@ -108,7 +111,7 @@ def rootfs_variables(d): | |||
108 | 'SDK_OUTPUT','SDKPATHNATIVE','SDKTARGETSYSROOT','SDK_DIR','SDK_VENDOR','SDKIMAGE_INSTALL_COMPLEMENTARY','SDK_PACKAGE_ARCHS','SDK_OUTPUT','SDKTARGETSYSROOT','MULTILIBRE_ALLOW_REP', | 111 | 'SDK_OUTPUT','SDKPATHNATIVE','SDKTARGETSYSROOT','SDK_DIR','SDK_VENDOR','SDKIMAGE_INSTALL_COMPLEMENTARY','SDK_PACKAGE_ARCHS','SDK_OUTPUT','SDKTARGETSYSROOT','MULTILIBRE_ALLOW_REP', |
109 | 'MULTILIB_TEMP_ROOTFS','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS','PACKAGE_ARCHS', | 112 | 'MULTILIB_TEMP_ROOTFS','MULTILIB_VARIANTS','MULTILIBS','ALL_MULTILIB_PACKAGE_ARCHS','MULTILIB_GLOBAL_VARIANTS','BAD_RECOMMENDATIONS','NO_RECOMMENDATIONS','PACKAGE_ARCHS', |
110 | 'PACKAGE_CLASSES','TARGET_VENDOR','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','OVERRIDES','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI','INTERCEPT_DIR','USE_DEVFS', | 113 | 'PACKAGE_CLASSES','TARGET_VENDOR','TARGET_VENDOR','TARGET_ARCH','TARGET_OS','OVERRIDES','BBEXTENDVARIANT','FEED_DEPLOYDIR_BASE_URI','INTERCEPT_DIR','USE_DEVFS', |
111 | 'COMPRESSIONTYPES'] | 114 | 'COMPRESSIONTYPES', 'IMAGE_GEN_DEBUGFS'] |
112 | variables.extend(command_variables(d)) | 115 | variables.extend(command_variables(d)) |
113 | variables.extend(variable_depends(d)) | 116 | variables.extend(variable_depends(d)) |
114 | return " ".join(variables) | 117 | return " ".join(variables) |
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index a9a6c85a2c..5f1f7b3e5d 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py | |||
@@ -95,6 +95,57 @@ class Rootfs(object): | |||
95 | def _cleanup(self): | 95 | def _cleanup(self): |
96 | pass | 96 | pass |
97 | 97 | ||
98 | def _setup_dbg_rootfs(self, dirs): | ||
99 | gen_debugfs = self.d.getVar('IMAGE_GEN_DEBUGFS', True) or '0' | ||
100 | if gen_debugfs != '1': | ||
101 | return | ||
102 | |||
103 | bb.note(" Renaming the original rootfs...") | ||
104 | try: | ||
105 | shutil.rmtree(self.image_rootfs + '-orig') | ||
106 | except: | ||
107 | pass | ||
108 | os.rename(self.image_rootfs, self.image_rootfs + '-orig') | ||
109 | |||
110 | bb.note(" Creating debug rootfs...") | ||
111 | bb.utils.mkdirhier(self.image_rootfs) | ||
112 | |||
113 | bb.note(" Copying back package database...") | ||
114 | for dir in dirs: | ||
115 | bb.utils.mkdirhier(self.image_rootfs + os.path.dirname(dir)) | ||
116 | shutil.copytree(self.image_rootfs + '-orig' + dir, self.image_rootfs + dir) | ||
117 | |||
118 | cpath = oe.cachedpath.CachedPath() | ||
119 | # Copy files located in /usr/lib/debug or /usr/src/debug | ||
120 | for dir in ["/usr/lib/debug", "/usr/src/debug"]: | ||
121 | src = self.image_rootfs + '-orig' + dir | ||
122 | if cpath.exists(src): | ||
123 | dst = self.image_rootfs + dir | ||
124 | bb.utils.mkdirhier(os.path.dirname(dst)) | ||
125 | shutil.copytree(src, dst) | ||
126 | |||
127 | # Copy files with suffix '.debug' or located in '.debug' dir. | ||
128 | for root, dirs, files in cpath.walk(self.image_rootfs + '-orig'): | ||
129 | relative_dir = root[len(self.image_rootfs + '-orig'):] | ||
130 | for f in files: | ||
131 | if f.endswith('.debug') or '/.debug' in relative_dir: | ||
132 | bb.utils.mkdirhier(self.image_rootfs + relative_dir) | ||
133 | shutil.copy(os.path.join(root, f), | ||
134 | self.image_rootfs + relative_dir) | ||
135 | |||
136 | bb.note(" Install complementary '*-dbg' packages...") | ||
137 | self.pm.install_complementary('*-dbg') | ||
138 | |||
139 | bb.note(" Rename debug rootfs...") | ||
140 | try: | ||
141 | shutil.rmtree(self.image_rootfs + '-dbg') | ||
142 | except: | ||
143 | pass | ||
144 | os.rename(self.image_rootfs, self.image_rootfs + '-dbg') | ||
145 | |||
146 | bb.note(" Restoreing original rootfs...") | ||
147 | os.rename(self.image_rootfs + '-orig', self.image_rootfs) | ||
148 | |||
98 | def _exec_shell_cmd(self, cmd): | 149 | def _exec_shell_cmd(self, cmd): |
99 | fakerootcmd = self.d.getVar('FAKEROOT', True) | 150 | fakerootcmd = self.d.getVar('FAKEROOT', True) |
100 | if fakerootcmd is not None: | 151 | if fakerootcmd is not None: |
@@ -369,6 +420,8 @@ class RpmRootfs(Rootfs): | |||
369 | 420 | ||
370 | self.pm.install_complementary() | 421 | self.pm.install_complementary() |
371 | 422 | ||
423 | self._setup_dbg_rootfs(['/etc/rpm', '/var/lib/rpm', '/var/lib/smart']) | ||
424 | |||
372 | if self.inc_rpm_image_gen == "1": | 425 | if self.inc_rpm_image_gen == "1": |
373 | self.pm.backup_packaging_data() | 426 | self.pm.backup_packaging_data() |
374 | 427 | ||
@@ -475,6 +528,8 @@ class DpkgRootfs(Rootfs): | |||
475 | 528 | ||
476 | self.pm.install_complementary() | 529 | self.pm.install_complementary() |
477 | 530 | ||
531 | self._setup_dbg_rootfs(['/var/lib/dpkg']) | ||
532 | |||
478 | self.pm.fix_broken_dependencies() | 533 | self.pm.fix_broken_dependencies() |
479 | 534 | ||
480 | self.pm.mark_packages("installed") | 535 | self.pm.mark_packages("installed") |
@@ -743,6 +798,8 @@ class OpkgRootfs(Rootfs): | |||
743 | 798 | ||
744 | self.pm.install_complementary() | 799 | self.pm.install_complementary() |
745 | 800 | ||
801 | self._setup_dbg_rootfs(['/var/lib/opkg']) | ||
802 | |||
746 | execute_pre_post_process(self.d, opkg_post_process_cmds) | 803 | execute_pre_post_process(self.d, opkg_post_process_cmds) |
747 | execute_pre_post_process(self.d, rootfs_post_install_cmds) | 804 | execute_pre_post_process(self.d, rootfs_post_install_cmds) |
748 | 805 | ||