diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-02-03 16:48:56 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-02-05 12:26:36 +0000 |
commit | a242274d98e6f0f8d2aa21f778df690de7b42144 (patch) | |
tree | ff784d0fb2d5ca91387da92db7379cf18ab54707 | |
parent | c98fc3933142783db2ed735d971a8c5b8408344c (diff) | |
download | poky-a242274d98e6f0f8d2aa21f778df690de7b42144.tar.gz |
prelink: Drop support for it
Prelink is being dropped by glibc in 2.36. It already causes issues with
binary corruption, has a number of open bugs and is of questionable benefit
without disabling load address randomization and PIE executables.
We disabled it by default a while back but left people able to use it.
We would be unable to maintain it alone without glibc support so remove
the remaining pieces.
(From OE-Core rev: 23c0be78106f1d1e2bb9c724174a1bb8c56c2469)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/conf/distro/include/maintainers.inc | 1 | ||||
-rw-r--r-- | meta/lib/oe/package_manager/ipk/rootfs.py | 37 | ||||
-rw-r--r-- | meta/lib/oe/utils.py | 11 | ||||
-rw-r--r-- | meta/recipes-devtools/prelink/prelink/0001-Add-MIPS-gnu-hash-support.patch | 110 | ||||
-rw-r--r-- | meta/recipes-devtools/prelink/prelink/macros.prelink | 5 | ||||
-rw-r--r-- | meta/recipes-devtools/prelink/prelink/prelink.conf | 18 | ||||
-rw-r--r-- | meta/recipes-devtools/prelink/prelink/prelink.cron.daily | 40 | ||||
-rw-r--r-- | meta/recipes-devtools/prelink/prelink/prelink.default | 22 | ||||
-rw-r--r-- | meta/recipes-devtools/prelink/prelink_git.bb | 185 | ||||
-rwxr-xr-x | scripts/sstate-sysroot-cruft.sh | 12 |
10 files changed, 0 insertions, 441 deletions
diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc index ae25287c11..6146d01f3f 100644 --- a/meta/conf/distro/include/maintainers.inc +++ b/meta/conf/distro/include/maintainers.inc | |||
@@ -577,7 +577,6 @@ RECIPE_MAINTAINER:pn-popt = "Yi Zhao <yi.zhao@windriver.com>" | |||
577 | RECIPE_MAINTAINER:pn-powertop = "Alexander Kanavin <alex.kanavin@gmail.com>" | 577 | RECIPE_MAINTAINER:pn-powertop = "Alexander Kanavin <alex.kanavin@gmail.com>" |
578 | RECIPE_MAINTAINER:pn-ppp = "Hongxu Jia <hongxu.jia@windriver.com>" | 578 | RECIPE_MAINTAINER:pn-ppp = "Hongxu Jia <hongxu.jia@windriver.com>" |
579 | RECIPE_MAINTAINER:pn-ppp-dialin = "Hongxu Jia <hongxu.jia@windriver.com>" | 579 | RECIPE_MAINTAINER:pn-ppp-dialin = "Hongxu Jia <hongxu.jia@windriver.com>" |
580 | RECIPE_MAINTAINER:pn-prelink = "Mark Hatle <mark.hatle@kernel.crashing.org>" | ||
581 | RECIPE_MAINTAINER:pn-procps = "Alexander Kanavin <alex.kanavin@gmail.com>" | 580 | RECIPE_MAINTAINER:pn-procps = "Alexander Kanavin <alex.kanavin@gmail.com>" |
582 | RECIPE_MAINTAINER:pn-pseudo = "Richard Purdie <richard.purdie@linuxfoundation.org>" | 581 | RECIPE_MAINTAINER:pn-pseudo = "Richard Purdie <richard.purdie@linuxfoundation.org>" |
583 | RECIPE_MAINTAINER:pn-psmisc = "Alexander Kanavin <alex.kanavin@gmail.com>" | 582 | RECIPE_MAINTAINER:pn-psmisc = "Alexander Kanavin <alex.kanavin@gmail.com>" |
diff --git a/meta/lib/oe/package_manager/ipk/rootfs.py b/meta/lib/oe/package_manager/ipk/rootfs.py index 26dbee6f6a..10a831994e 100644 --- a/meta/lib/oe/package_manager/ipk/rootfs.py +++ b/meta/lib/oe/package_manager/ipk/rootfs.py | |||
@@ -145,51 +145,14 @@ class PkgRootfs(DpkgOpkgRootfs): | |||
145 | self.pm.recover_packaging_data() | 145 | self.pm.recover_packaging_data() |
146 | 146 | ||
147 | bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS'), True) | 147 | bb.utils.remove(self.d.getVar('MULTILIB_TEMP_ROOTFS'), True) |
148 | |||
149 | def _prelink_file(self, root_dir, filename): | ||
150 | bb.note('prelink %s in %s' % (filename, root_dir)) | ||
151 | prelink_cfg = oe.path.join(root_dir, | ||
152 | self.d.expand('${sysconfdir}/prelink.conf')) | ||
153 | if not os.path.exists(prelink_cfg): | ||
154 | shutil.copy(self.d.expand('${STAGING_DIR_NATIVE}${sysconfdir_native}/prelink.conf'), | ||
155 | prelink_cfg) | ||
156 | |||
157 | cmd_prelink = self.d.expand('${STAGING_DIR_NATIVE}${sbindir_native}/prelink') | ||
158 | self._exec_shell_cmd([cmd_prelink, | ||
159 | '--root', | ||
160 | root_dir, | ||
161 | '-amR', | ||
162 | '-N', | ||
163 | '-c', | ||
164 | self.d.expand('${sysconfdir}/prelink.conf')]) | ||
165 | |||
166 | ''' | 148 | ''' |
167 | Compare two files with the same key twice to see if they are equal. | 149 | Compare two files with the same key twice to see if they are equal. |
168 | If they are not equal, it means they are duplicated and come from | 150 | If they are not equal, it means they are duplicated and come from |
169 | different packages. | 151 | different packages. |
170 | 1st: Comapre them directly; | ||
171 | 2nd: While incremental image creation is enabled, one of the | ||
172 | files could be probaly prelinked in the previous image | ||
173 | creation and the file has been changed, so we need to | ||
174 | prelink the other one and compare them. | ||
175 | ''' | 152 | ''' |
176 | def _file_equal(self, key, f1, f2): | 153 | def _file_equal(self, key, f1, f2): |
177 | |||
178 | # Both of them are not prelinked | ||
179 | if filecmp.cmp(f1, f2): | 154 | if filecmp.cmp(f1, f2): |
180 | return True | 155 | return True |
181 | |||
182 | if bb.data.inherits_class('image-prelink', self.d): | ||
183 | if self.image_rootfs not in f1: | ||
184 | self._prelink_file(f1.replace(key, ''), f1) | ||
185 | |||
186 | if self.image_rootfs not in f2: | ||
187 | self._prelink_file(f2.replace(key, ''), f2) | ||
188 | |||
189 | # Both of them are prelinked | ||
190 | if filecmp.cmp(f1, f2): | ||
191 | return True | ||
192 | |||
193 | # Not equal | 156 | # Not equal |
194 | return False | 157 | return False |
195 | 158 | ||
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index 136650e6f7..84790b7dff 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py | |||
@@ -537,17 +537,6 @@ class ThreadedPool: | |||
537 | for worker in self.workers: | 537 | for worker in self.workers: |
538 | worker.join() | 538 | worker.join() |
539 | 539 | ||
540 | def write_ld_so_conf(d): | ||
541 | # Some utils like prelink may not have the correct target library paths | ||
542 | # so write an ld.so.conf to help them | ||
543 | ldsoconf = d.expand("${STAGING_DIR_TARGET}${sysconfdir}/ld.so.conf") | ||
544 | if os.path.exists(ldsoconf): | ||
545 | bb.utils.remove(ldsoconf) | ||
546 | bb.utils.mkdirhier(os.path.dirname(ldsoconf)) | ||
547 | with open(ldsoconf, "w") as f: | ||
548 | f.write(d.getVar("base_libdir") + '\n') | ||
549 | f.write(d.getVar("libdir") + '\n') | ||
550 | |||
551 | class ImageQAFailed(Exception): | 540 | class ImageQAFailed(Exception): |
552 | def __init__(self, description, name=None, logfile=None): | 541 | def __init__(self, description, name=None, logfile=None): |
553 | self.description = description | 542 | self.description = description |
diff --git a/meta/recipes-devtools/prelink/prelink/0001-Add-MIPS-gnu-hash-support.patch b/meta/recipes-devtools/prelink/prelink/0001-Add-MIPS-gnu-hash-support.patch deleted file mode 100644 index da0275bfcd..0000000000 --- a/meta/recipes-devtools/prelink/prelink/0001-Add-MIPS-gnu-hash-support.patch +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
1 | From 05240e13668422c4f9118f2cde953ec875d0d68f Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 14 Jan 2020 01:37:22 -0800 | ||
4 | Subject: [PATCH] Add MIPS gnu hash support | ||
5 | |||
6 | Upstream-Status: Pending | ||
7 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
8 | --- | ||
9 | src/arch-mips.c | 1 + | ||
10 | src/prelink.c | 1 + | ||
11 | src/prelink.h | 5 +++++ | ||
12 | 3 files changed, 7 insertions(+) | ||
13 | |||
14 | --- a/src/arch-mips.c | ||
15 | +++ b/src/arch-mips.c | ||
16 | @@ -324,6 +324,7 @@ mips_adjust_dyn (DSO *dso, int n, GElf_D | ||
17 | case DT_MIPS_BASE_ADDRESS: | ||
18 | case DT_MIPS_RLD_MAP: | ||
19 | case DT_MIPS_OPTIONS: | ||
20 | + case DT_MIPS_XHASH: | ||
21 | if (dyn->d_un.d_ptr >= start) | ||
22 | dyn->d_un.d_ptr += adjust; | ||
23 | return 1; | ||
24 | --- a/src/prelink.c | ||
25 | +++ b/src/prelink.c | ||
26 | @@ -425,6 +425,7 @@ prelink_prepare (DSO *dso) | ||
27 | { | ||
28 | case SHT_HASH: | ||
29 | case SHT_GNU_HASH: | ||
30 | + case SHT_MIPS_XHASH: | ||
31 | case SHT_DYNSYM: | ||
32 | case SHT_REL: | ||
33 | case SHT_RELA: | ||
34 | --- a/src/prelink.h | ||
35 | +++ b/src/prelink.h | ||
36 | @@ -114,6 +114,11 @@ typedef uint8_t Elf64_Byte; | ||
37 | #define SHT_MIPS_ABIFLAGS 0x7000002a | ||
38 | #endif | ||
39 | |||
40 | +#ifndef SHT_MIPS_XHASH | ||
41 | +#define DT_MIPS_XHASH 0x70000036 | ||
42 | +#define SHT_MIPS_XHASH 0x7000002b | ||
43 | +#endif | ||
44 | + | ||
45 | #ifndef RSS_UNDEF | ||
46 | #define RSS_UNDEF 0 | ||
47 | #endif | ||
48 | --- a/src/dso.c | ||
49 | +++ b/src/dso.c | ||
50 | @@ -109,6 +109,11 @@ read_dynamic (DSO *dso) | ||
51 | dso->info_DT_GNU_HASH = dyn.d_un.d_val; | ||
52 | dso->info_set_mask |= (1ULL << DT_GNU_HASH_BIT); | ||
53 | } | ||
54 | + else if (dyn.d_tag == DT_MIPS_XHASH) | ||
55 | + { | ||
56 | + dso->info_DT_GNU_HASH = dyn.d_un.d_val; | ||
57 | + dso->info_set_mask |= (1ULL << DT_GNU_HASH_BIT); | ||
58 | + } | ||
59 | else if (dyn.d_tag == DT_TLSDESC_PLT) | ||
60 | { | ||
61 | dso->info_DT_TLSDESC_PLT = dyn.d_un.d_val; | ||
62 | @@ -1463,6 +1468,7 @@ adjust_dso (DSO *dso, GElf_Addr start, G | ||
63 | break; | ||
64 | case SHT_HASH: | ||
65 | case SHT_GNU_HASH: | ||
66 | + case SHT_MIPS_XHASH: | ||
67 | case SHT_NOBITS: | ||
68 | case SHT_STRTAB: | ||
69 | break; | ||
70 | --- a/src/space.c | ||
71 | +++ b/src/space.c | ||
72 | @@ -61,6 +61,7 @@ print_sections (DSO *dso, GElf_Ehdr *ehd | ||
73 | { SHT_GNU_versym, "VERSYM" }, | ||
74 | { SHT_GNU_LIBLIST, "LIBLIST" }, | ||
75 | { SHT_GNU_HASH, "GNU_HASH" }, | ||
76 | + { SHT_MIPS_XHASH, "MIPS_XHASH" }, | ||
77 | { 0, NULL } | ||
78 | }; | ||
79 | |||
80 | @@ -183,6 +184,7 @@ readonly_is_movable (DSO *dso, GElf_Ehdr | ||
81 | { | ||
82 | case SHT_HASH: | ||
83 | case SHT_GNU_HASH: | ||
84 | + case SHT_MIPS_XHASH: | ||
85 | case SHT_DYNSYM: | ||
86 | case SHT_REL: | ||
87 | case SHT_RELA: | ||
88 | @@ -558,6 +560,7 @@ find_readonly_space (DSO *dso, GElf_Shdr | ||
89 | { | ||
90 | case SHT_HASH: | ||
91 | case SHT_GNU_HASH: | ||
92 | + case SHT_MIPS_XHASH: | ||
93 | case SHT_DYNSYM: | ||
94 | case SHT_STRTAB: | ||
95 | case SHT_GNU_verdef: | ||
96 | --- a/src/exec.c | ||
97 | +++ b/src/exec.c | ||
98 | @@ -65,7 +65,11 @@ update_dynamic_tags (DSO *dso, GElf_Shdr | ||
99 | || (dynamic_info_is_set (dso, DT_GNU_HASH_BIT) | ||
100 | && dso->info_DT_GNU_HASH == old_shdr[j].sh_addr | ||
101 | && old_shdr[j].sh_type == SHT_GNU_HASH | ||
102 | - && set_dynamic (dso, DT_GNU_HASH, shdr[i].sh_addr, 1))) | ||
103 | + && set_dynamic (dso, DT_GNU_HASH, shdr[i].sh_addr, 1)) | ||
104 | + || (dynamic_info_is_set (dso, DT_GNU_HASH_BIT) | ||
105 | + && dso->info_DT_GNU_HASH == old_shdr[j].sh_addr | ||
106 | + && old_shdr[j].sh_type == SHT_MIPS_XHASH | ||
107 | + && set_dynamic (dso, DT_MIPS_XHASH, shdr[i].sh_addr, 1))) | ||
108 | return 1; | ||
109 | } | ||
110 | |||
diff --git a/meta/recipes-devtools/prelink/prelink/macros.prelink b/meta/recipes-devtools/prelink/prelink/macros.prelink deleted file mode 100644 index cb16695885..0000000000 --- a/meta/recipes-devtools/prelink/prelink/macros.prelink +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | # rpm-4.1 verifies prelinked libraries using a prelink undo helper. | ||
2 | # Note: The 2nd token is used as argv[0] and "library" is a | ||
3 | # placeholder that will be deleted and replaced with the appropriate | ||
4 | # library file path. | ||
5 | %__prelink_undo_cmd /usr/sbin/prelink prelink -y library | ||
diff --git a/meta/recipes-devtools/prelink/prelink/prelink.conf b/meta/recipes-devtools/prelink/prelink/prelink.conf deleted file mode 100644 index 562f23c59d..0000000000 --- a/meta/recipes-devtools/prelink/prelink/prelink.conf +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | # This config file contains a list of directories both with binaries | ||
2 | # and libraries prelink should consider by default. | ||
3 | # If a directory name is prefixed with `-l ', the directory hierarchy | ||
4 | # will be walked as long as filesystem boundaries are not crossed. | ||
5 | # If a directory name is prefixed with `-h ', symbolic links in a | ||
6 | # directory hierarchy are followed. | ||
7 | -l /usr/local/sbin | ||
8 | -l /sbin | ||
9 | -l /usr/sbin | ||
10 | -l /usr/local/bin | ||
11 | -l /bin | ||
12 | -l /usr/bin | ||
13 | -l /usr/X11R6/bin | ||
14 | -l /usr/games | ||
15 | -l /usr/local/lib{,32,64,x32} | ||
16 | -l /lib{,32,64,x32} | ||
17 | -l /usr/lib{,32,64,x32} | ||
18 | -l /usr/X11R6/lib{,32,64,x32} | ||
diff --git a/meta/recipes-devtools/prelink/prelink/prelink.cron.daily b/meta/recipes-devtools/prelink/prelink/prelink.cron.daily deleted file mode 100644 index 0b3c07322c..0000000000 --- a/meta/recipes-devtools/prelink/prelink/prelink.cron.daily +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | . /etc/default/prelink | ||
4 | |||
5 | renice +19 -p $$ >/dev/null 2>&1 | ||
6 | |||
7 | if [ "$PRELINKING" != yes ]; then | ||
8 | if [ -f /etc/prelink.cache ]; then | ||
9 | echo /usr/sbin/prelink -uav > /var/log/prelink.log | ||
10 | /usr/sbin/prelink -uav >> /var/log/prelink.log 2>&1 | ||
11 | rm -f /etc/prelink.cache | ||
12 | # Restart init if needed | ||
13 | [ -n "$(find `ldd /sbin/init | awk '{ print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u | ||
14 | fi | ||
15 | exit 0 | ||
16 | fi | ||
17 | |||
18 | if [ ! -f /etc/prelink.cache -o -f /var/lib/misc/prelink.force ] \ | ||
19 | || grep -q '^prelink-ELF0.[0-2]' /etc/prelink.cache; then | ||
20 | # If cache does not exist or is from older prelink versions or | ||
21 | # if we were asked to explicitely, force full prelinking | ||
22 | rm -f /etc/prelink.cache /var/lib/misc/prelink.force | ||
23 | PRELINK_OPTS="$PRELINK_OPTS -f" | ||
24 | date > /var/lib/misc/prelink.full | ||
25 | elif [ -n "$PRELINK_FULL_TIME_INTERVAL" \ | ||
26 | -a "`find /var/lib/misc/prelink.full -mtime -${PRELINK_FULL_TIME_INTERVAL} 2>/dev/null`" \ | ||
27 | = /var/lib/misc/prelink.full ]; then | ||
28 | # If prelink without -q has been run in the last | ||
29 | # PRELINK_FULL_TIME_INTERVAL days, just use quick mode | ||
30 | PRELINK_OPTS="$PRELINK_OPTS -q" | ||
31 | else | ||
32 | date > /var/lib/misc/prelink.full | ||
33 | fi | ||
34 | |||
35 | echo /usr/sbin/prelink -av $PRELINK_OPTS > /var/log/prelink.log | ||
36 | /usr/sbin/prelink -av $PRELINK_OPTS >> /var/log/prelink.log 2>&1 | ||
37 | # Restart init if needed | ||
38 | [ -n "$(find `ldd /sbin/init | awk '{ print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u | ||
39 | |||
40 | exit 0 | ||
diff --git a/meta/recipes-devtools/prelink/prelink/prelink.default b/meta/recipes-devtools/prelink/prelink/prelink.default deleted file mode 100644 index d8802f820a..0000000000 --- a/meta/recipes-devtools/prelink/prelink/prelink.default +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | # Set this to no to disable prelinking altogether | ||
2 | # or to yes to enable it. | ||
3 | # (if you change this from yes to no prelink -ua | ||
4 | # will be run next night to undo prelinking) | ||
5 | PRELINKING=yes | ||
6 | |||
7 | # Options to pass to prelink | ||
8 | # -m Try to conserve virtual memory by allowing overlapping | ||
9 | # assigned virtual memory slots for libraries which | ||
10 | # never appear together in one binary | ||
11 | # -R Randomize virtual memory slot assignments for libraries. | ||
12 | # This makes it slightly harder for various buffer overflow | ||
13 | # attacks, since library addresses will be different on each | ||
14 | # host using -R. | ||
15 | PRELINK_OPTS=-mR | ||
16 | |||
17 | # How often should full prelink be run (in days) | ||
18 | # Normally, prelink will be run in quick mode, every | ||
19 | # $PRELINK_FULL_TIME_INTERVAL days it will be run | ||
20 | # in normal mode. Comment this line out if prelink | ||
21 | # should be run in normal mode always. | ||
22 | PRELINK_FULL_TIME_INTERVAL=14 | ||
diff --git a/meta/recipes-devtools/prelink/prelink_git.bb b/meta/recipes-devtools/prelink/prelink_git.bb deleted file mode 100644 index 24713b61f8..0000000000 --- a/meta/recipes-devtools/prelink/prelink_git.bb +++ /dev/null | |||
@@ -1,185 +0,0 @@ | |||
1 | SECTION = "devel" | ||
2 | # Need binutils for libiberty.a | ||
3 | # Would need transfig-native for documentation if it wasn't disabled | ||
4 | DEPENDS = "elfutils binutils" | ||
5 | SUMMARY = "An ELF prelinking utility" | ||
6 | HOMEPAGE = "http://git.yoctoproject.org/cgit.cgi/prelink-cross/about/" | ||
7 | DESCRIPTION = "The prelink package contains a utility which modifies ELF shared libraries \ | ||
8 | and executables, so that far fewer relocations need to be resolved at \ | ||
9 | runtime and thus programs come up faster." | ||
10 | LICENSE = "GPLv2" | ||
11 | LIC_FILES_CHKSUM = "file://COPYING;md5=c93c0550bd3173f4504b2cbd8991e50b" | ||
12 | SRCREV = "f9975537dbfd9ade0fc813bd5cf5fcbe41753a37" | ||
13 | PV = "1.0+git${SRCPV}" | ||
14 | |||
15 | # | ||
16 | # The cron script attempts to re-prelink the system daily -- on | ||
17 | # systems where users are adding applications, this might be reasonable | ||
18 | # but for embedded, we should be re-running prelink -a after an update. | ||
19 | # | ||
20 | # Default is prelinking is enabled. | ||
21 | # | ||
22 | SUMMARY:${PN}-cron = "Cron scripts to control automatic prelinking" | ||
23 | DESCRIPTION:${PN}-cron = "Cron scripts to control automatic prelinking. \ | ||
24 | See: ${sysconfdir}/cron.daily/prelink for configuration information." | ||
25 | |||
26 | FILES:${PN}-cron = "${sysconfdir}/cron.daily ${sysconfdir}/default" | ||
27 | |||
28 | PACKAGES =+ "${PN}-cron" | ||
29 | |||
30 | SRC_URI = "git://git.yoctoproject.org/prelink-cross.git;branch=cross_prelink_staging \ | ||
31 | file://0001-Add-MIPS-gnu-hash-support.patch \ | ||
32 | file://prelink.conf \ | ||
33 | file://prelink.cron.daily \ | ||
34 | file://prelink.default \ | ||
35 | file://macros.prelink \ | ||
36 | " | ||
37 | UPSTREAM_CHECK_COMMITS = "1" | ||
38 | |||
39 | # error: error.h: No such file or directory | ||
40 | COMPATIBLE_HOST:libc-musl = 'null' | ||
41 | |||
42 | TARGET_OS_ORIG := "${TARGET_OS}" | ||
43 | OVERRIDES:append = ":${TARGET_OS_ORIG}" | ||
44 | |||
45 | S = "${WORKDIR}/git" | ||
46 | |||
47 | inherit autotools | ||
48 | |||
49 | BBCLASSEXTEND = "native" | ||
50 | |||
51 | EXTRA_OECONF = "--with-pkgversion=${PV}-${PR} \ | ||
52 | --with-bugurl=http://bugzilla.yoctoproject.org/" | ||
53 | |||
54 | PACKAGECONFIG ??= "" | ||
55 | PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux" | ||
56 | |||
57 | # | ||
58 | # For target prelink we need to ensure paths match the lib path layout | ||
59 | # including for any configured multilibs | ||
60 | # | ||
61 | python do_linkerpaths () { | ||
62 | values = all_multilib_tune_list(["TUNE_ARCH", "baselib", "ABIEXTENSION"], d) | ||
63 | |||
64 | arches = values["TUNE_ARCH"] | ||
65 | baselibs = values["baselib"] | ||
66 | abis = values["ABIEXTENSION"] | ||
67 | |||
68 | def replace_lines(f, search, replacement, d, firstonly = False, secondonly = False): | ||
69 | f = d.expand(f) | ||
70 | if search == replacement: | ||
71 | return | ||
72 | bb.debug(2, "Replacing %s with %s in %s" % (search, replacement, f)) | ||
73 | with open(f, "r") as data: | ||
74 | lines = data.readlines() | ||
75 | with open(f, "w") as data: | ||
76 | for line in lines: | ||
77 | if not secondonly and not firstonly: | ||
78 | line = line.replace(search, replacement) | ||
79 | elif secondonly and search in line: | ||
80 | secondonly = False | ||
81 | elif firstonly and search and search in line: | ||
82 | line = line.replace(search, replacement) | ||
83 | search = None | ||
84 | data.write(line) | ||
85 | |||
86 | def replace_lines_rtld(f, search, replacement, section, d): | ||
87 | f = d.expand(f) | ||
88 | bb.debug(2, "Replacing %s with %s in %s" % (search, replacement, f)) | ||
89 | with open(f, "r") as data: | ||
90 | lines = data.readlines() | ||
91 | found = False | ||
92 | found2 = False | ||
93 | with open(f, "w") as data: | ||
94 | for line in lines: | ||
95 | if section in line: | ||
96 | if section == "else" and "if" in line: | ||
97 | found = False | ||
98 | else: | ||
99 | found = True | ||
100 | if found and "dst_LIB =" in line: | ||
101 | found2 = True | ||
102 | elif "}" in line: | ||
103 | found = False | ||
104 | found2 = False | ||
105 | if found2: | ||
106 | line = line.replace(search, replacement) | ||
107 | data.write(line) | ||
108 | |||
109 | for i, arch in enumerate(arches): | ||
110 | tune_baselib = baselibs[i] | ||
111 | abi = abis[i] | ||
112 | |||
113 | bits = 32 | ||
114 | if arch == "powerpc": | ||
115 | replace_lines("${S}/src/arch-ppc.c", "/lib/ld.so.1", "/" + tune_baselib + "/ld.so.1", d) | ||
116 | elif arch == "powerpc64": | ||
117 | replace_lines("${S}/src/arch-ppc64.c", "/lib64/ld64.so.1", "/" + tune_baselib + "/ld64.so.1", d) | ||
118 | bits = 64 | ||
119 | elif arch == "x86_64": | ||
120 | if abi == "x32": | ||
121 | replace_lines("${S}/src/arch-x86_64.c", "/libx32/ld-linux-x32.so.2", "/" + tune_baselib + "/ld-linux-x32.so.2", d) | ||
122 | else: | ||
123 | replace_lines("${S}/src/arch-x86_64.c", "/lib64/ld-linux-x86-64.so.2", "/" + tune_baselib + "/ld-linux-x86-64.so.2", d) | ||
124 | bits = 64 | ||
125 | elif arch == "arm": | ||
126 | replace_lines("${S}/src/arch-arm.c", "/lib/ld-linux.so.3", "/" + tune_baselib + "/ld-linux.so.3", d) | ||
127 | replace_lines("${S}/src/arch-arm.c", "/lib/ld-linux-armhf.so.3", "/" + tune_baselib + "/ld-linux-armhf.so.3", d) | ||
128 | elif arch == "mips" or arch == "mipsel": | ||
129 | replace_lines("${S}/src/arch-mips.c", "/lib/ld.so.1", "/" + tune_baselib + "/ld.so.1", d, firstonly=True) | ||
130 | replace_lines("${S}/src/arch-mips.c", "/lib32/ld.so.1", "/" + tune_baselib + "/ld.so.1", d) | ||
131 | elif arch == "mips64" or arch == "mips64el": | ||
132 | replace_lines("${S}/src/arch-mips.c", "/lib/ld.so.1", "/" + tune_baselib + "/ld.so.1", d, secondonly=True) | ||
133 | replace_lines("${S}/src/arch-mips.c", "/lib64/ld.so.1", "/" + tune_baselib + "/ld.so.1", d) | ||
134 | bits = 64 | ||
135 | elif arch.endswith("86"): | ||
136 | replace_lines("${S}/src/arch-i386.c", "/lib/ld-linux.so.2", "/" + tune_baselib + "/ld-linux.so.2", d) | ||
137 | if bits == 32 and tune_baselib != "lib": | ||
138 | replace_lines_rtld("${S}/src/rtld/rtld.c", "lib", tune_baselib, "else", d) | ||
139 | if bits == 64 and tune_baselib != "lib64": | ||
140 | replace_lines_rtld("${S}/src/rtld/rtld.c", "lib64", tune_baselib, "use_64bit", d) | ||
141 | } | ||
142 | |||
143 | python () { | ||
144 | overrides = d.getVar("OVERRIDES").split(":") | ||
145 | if "class-target" in overrides: | ||
146 | bb.build.addtask('do_linkerpaths', 'do_configure', 'do_patch', d) | ||
147 | } | ||
148 | |||
149 | do_configure:prepend () { | ||
150 | # Disable documentation! | ||
151 | echo "all:" > ${S}/doc/Makefile.am | ||
152 | } | ||
153 | |||
154 | do_install:append () { | ||
155 | install -d ${D}${sysconfdir}/cron.daily ${D}${sysconfdir}/default ${D}${sysconfdir}/rpm | ||
156 | install -m 0644 ${WORKDIR}/prelink.conf ${D}${sysconfdir}/prelink.conf | ||
157 | install -m 0644 ${WORKDIR}/prelink.cron.daily ${D}${sysconfdir}/cron.daily/prelink | ||
158 | install -m 0644 ${WORKDIR}/prelink.default ${D}${sysconfdir}/default/prelink | ||
159 | install -m 0644 ${WORKDIR}/macros.prelink ${D}${sysconfdir}/rpm/macros.prelink | ||
160 | } | ||
161 | |||
162 | # If we ae doing a cross install, we want to avoid prelinking. | ||
163 | # Prelinking during a cross install should be handled by the image-prelink | ||
164 | # bbclass. If the user desires this to run on the target at first boot | ||
165 | # they will need to create a custom boot script. | ||
166 | pkg_postinst:prelink() { | ||
167 | #!/bin/sh | ||
168 | |||
169 | if [ "x$D" != "x" ]; then | ||
170 | exit 0 | ||
171 | fi | ||
172 | |||
173 | prelink -a | ||
174 | } | ||
175 | |||
176 | pkg_prerm:prelink() { | ||
177 | #!/bin/sh | ||
178 | |||
179 | if [ "x$D" != "x" ]; then | ||
180 | exit 1 | ||
181 | fi | ||
182 | |||
183 | prelink -au | ||
184 | } | ||
185 | |||
diff --git a/scripts/sstate-sysroot-cruft.sh b/scripts/sstate-sysroot-cruft.sh index fbf1ca3c43..9c948e932d 100755 --- a/scripts/sstate-sysroot-cruft.sh +++ b/scripts/sstate-sysroot-cruft.sh | |||
@@ -145,18 +145,6 @@ WHITELIST="${WHITELIST} \ | |||
145 | .*/var/cache/fontconfig/ \ | 145 | .*/var/cache/fontconfig/ \ |
146 | " | 146 | " |
147 | 147 | ||
148 | # created by oe.utils.write_ld_so_conf which is used from few bbclasses and recipes: | ||
149 | # meta/classes/image-prelink.bbclass: oe.utils.write_ld_so_conf(d) | ||
150 | # meta/classes/insane.bbclass: oe.utils.write_ld_so_conf(d) | ||
151 | # meta/classes/insane.bbclass: oe.utils.write_ld_so_conf(d) | ||
152 | # meta/recipes-gnome/gobject-introspection/gobject-introspection_1.48.0.bb: oe.utils.write_ld_so_conf(d) | ||
153 | # meta/recipes-gnome/gobject-introspection/gobject-introspection_1.48.0.bb: oe.utils.write_ld_so_conf(d) | ||
154 | # introduced in oe-core commit 7fd1d7e639c2ed7e0699937a5cb245c187b7c811 | ||
155 | # and more visible since added to gobject-introspection in 10e0c1a3a452baa05d160a92a54b2e33cf0fd061 | ||
156 | WHITELIST="${WHITELIST} \ | ||
157 | [^/]*/etc/ld.so.conf \ | ||
158 | " | ||
159 | |||
160 | SYSROOTS="`readlink -f ${tmpdir}`/sysroots/" | 148 | SYSROOTS="`readlink -f ${tmpdir}`/sysroots/" |
161 | 149 | ||
162 | mkdir ${OUTPUT} | 150 | mkdir ${OUTPUT} |