diff options
Diffstat (limited to 'meta/recipes-devtools/prelink')
5 files changed, 166 insertions, 0 deletions
diff --git a/meta/recipes-devtools/prelink/prelink/macros.prelink b/meta/recipes-devtools/prelink/prelink/macros.prelink new file mode 100644 index 0000000000..cb16695885 --- /dev/null +++ b/meta/recipes-devtools/prelink/prelink/macros.prelink | |||
@@ -0,0 +1,5 @@ | |||
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 new file mode 100644 index 0000000000..562f23c59d --- /dev/null +++ b/meta/recipes-devtools/prelink/prelink/prelink.conf | |||
@@ -0,0 +1,18 @@ | |||
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 new file mode 100644 index 0000000000..0b3c07322c --- /dev/null +++ b/meta/recipes-devtools/prelink/prelink/prelink.cron.daily | |||
@@ -0,0 +1,40 @@ | |||
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 new file mode 100644 index 0000000000..d8802f820a --- /dev/null +++ b/meta/recipes-devtools/prelink/prelink/prelink.default | |||
@@ -0,0 +1,22 @@ | |||
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 new file mode 100644 index 0000000000..56781a4091 --- /dev/null +++ b/meta/recipes-devtools/prelink/prelink_git.bb | |||
@@ -0,0 +1,81 @@ | |||
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 | DESCRIPTION = "The prelink package contains a utility which modifies ELF shared libraries \ | ||
7 | and executables, so that far fewer relocations need to be resolved at \ | ||
8 | runtime and thus programs come up faster." | ||
9 | LICENSE = "GPLv2" | ||
10 | LIC_FILES_CHKSUM = "file://COPYING;md5=c93c0550bd3173f4504b2cbd8991e50b" | ||
11 | SRCREV = "faa069deec99bf61418d0bab831c83d7c1b797ca" | ||
12 | PV = "1.0+git${SRCPV}" | ||
13 | |||
14 | # | ||
15 | # The cron script attempts to re-prelink the system daily -- on | ||
16 | # systems where users are adding applications, this might be reasonable | ||
17 | # but for embedded, we should be re-running prelink -a after an update. | ||
18 | # | ||
19 | # Default is prelinking is enabled. | ||
20 | # | ||
21 | SUMMARY_${PN}-cron = "Cron scripts to control automatic prelinking" | ||
22 | DESCRIPTION_${PN}-cron = "Cron scripts to control automatic prelinking. \ | ||
23 | See: ${sysconfdir}/cron.daily/prelink for configuration information." | ||
24 | |||
25 | FILES_${PN}-cron = "${sysconfdir}/cron.daily ${sysconfdir}/default" | ||
26 | |||
27 | PACKAGES =+ "${PN}-cron" | ||
28 | |||
29 | SRC_URI = "git://git.yoctoproject.org/prelink-cross.git;branch=cross_prelink \ | ||
30 | file://prelink.conf \ | ||
31 | file://prelink.cron.daily \ | ||
32 | file://prelink.default \ | ||
33 | file://macros.prelink" | ||
34 | |||
35 | TARGET_OS_ORIG := "${TARGET_OS}" | ||
36 | OVERRIDES_append = ":${TARGET_OS_ORIG}" | ||
37 | |||
38 | S = "${WORKDIR}/git/trunk" | ||
39 | |||
40 | inherit autotools | ||
41 | |||
42 | BBCLASSEXTEND = "native" | ||
43 | |||
44 | EXTRA_OECONF = "--disable-selinux --with-pkgversion=${PV}-${PR} \ | ||
45 | --with-bugurl=http://bugzilla.yoctoproject.org/" | ||
46 | |||
47 | do_configure_prepend () { | ||
48 | # Disable documentation! | ||
49 | echo "all:" > ${S}/doc/Makefile.am | ||
50 | } | ||
51 | |||
52 | do_install_append () { | ||
53 | install -d ${D}${sysconfdir}/cron.daily ${D}${sysconfdir}/default ${D}${sysconfdir}/rpm | ||
54 | install -m 0644 ${WORKDIR}/prelink.conf ${D}${sysconfdir}/prelink.conf | ||
55 | install -m 0644 ${WORKDIR}/prelink.cron.daily ${D}${sysconfdir}/cron.daily/prelink | ||
56 | install -m 0644 ${WORKDIR}/prelink.default ${D}${sysconfdir}/default/prelink | ||
57 | install -m 0644 ${WORKDIR}/macros.prelink ${D}${sysconfdir}/rpm/macros.prelink | ||
58 | } | ||
59 | |||
60 | # If we're using image-prelink, we want to skip this on the host side | ||
61 | # but still do it if the package is installed on the target... | ||
62 | pkg_postinst_prelink() { | ||
63 | #!/bin/sh | ||
64 | |||
65 | if [ "x$D" != "x" ]; then | ||
66 | ${@bb.utils.contains('USER_CLASSES', 'image-prelink', 'exit 0', 'exit 1', d)} | ||
67 | fi | ||
68 | |||
69 | prelink -a | ||
70 | } | ||
71 | |||
72 | pkg_prerm_prelink() { | ||
73 | #!/bin/sh | ||
74 | |||
75 | if [ "x$D" != "x" ]; then | ||
76 | exit 1 | ||
77 | fi | ||
78 | |||
79 | prelink -au | ||
80 | } | ||
81 | |||