diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2008-11-03 19:14:00 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2008-11-03 19:14:00 +0100 |
commit | bebb376e62f94fec5caa1abb6141a6e6728ae95f (patch) | |
tree | 2e1cefeb324a5d0b30fe90c3619098098052e130 /meta-moblin | |
parent | 7b5d03d08e737dd3637072f60259af5b093b7f70 (diff) | |
download | poky-bebb376e62f94fec5caa1abb6141a6e6728ae95f.tar.gz |
sreadahead: Initial commit
Super readahead is an improved readahead tool.
Diffstat (limited to 'meta-moblin')
5 files changed, 125 insertions, 0 deletions
diff --git a/meta-moblin/packages/sreadahead/files/sreadahead-generate.sh b/meta-moblin/packages/sreadahead/files/sreadahead-generate.sh new file mode 100755 index 0000000000..626d7ccbe6 --- /dev/null +++ b/meta-moblin/packages/sreadahead/files/sreadahead-generate.sh | |||
@@ -0,0 +1,21 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | |||
4 | if [ -e /etc/readahead.packed ]; then | ||
5 | exit 0 | ||
6 | fi | ||
7 | |||
8 | if [ -e /etc/readahead.packed.first ]; then | ||
9 | mv /etc/readahead.packed.first /etc/readahead.packed.second | ||
10 | exit 0 | ||
11 | fi | ||
12 | |||
13 | # That's our second boot, we can generate the sreadahead file list | ||
14 | if [ -e /etc/readahead.packed.second ]; then | ||
15 | rm -f /etc/readahead.packed.second | ||
16 | find / -type f > filelist.txt | ||
17 | |||
18 | /sbin/generate_filelist filelist.txt | ||
19 | rm filelist.txt | ||
20 | mv readahead.packed /etc/ | ||
21 | fi | ||
diff --git a/meta-moblin/packages/sreadahead/files/sreadahead.sh b/meta-moblin/packages/sreadahead/files/sreadahead.sh new file mode 100755 index 0000000000..c7378284b2 --- /dev/null +++ b/meta-moblin/packages/sreadahead/files/sreadahead.sh | |||
@@ -0,0 +1,7 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # Start sreadahead, of the config file exists | ||
4 | |||
5 | if [ -e /etc/readahead.packed ]; then | ||
6 | /sbin/sreadahead | ||
7 | fi | ||
diff --git a/meta-moblin/packages/sreadahead/sreadahead-0.02/readahead_c.patch b/meta-moblin/packages/sreadahead/sreadahead-0.02/readahead_c.patch new file mode 100644 index 0000000000..a65c1088f5 --- /dev/null +++ b/meta-moblin/packages/sreadahead/sreadahead-0.02/readahead_c.patch | |||
@@ -0,0 +1,29 @@ | |||
1 | --- | ||
2 | readahead.c | 7 +++++-- | ||
3 | 1 file changed, 5 insertions(+), 2 deletions(-) | ||
4 | |||
5 | Index: sreadahead-0.02/readahead.c | ||
6 | =================================================================== | ||
7 | --- sreadahead-0.02.orig/readahead.c 2008-09-23 22:35:20.000000000 +0200 | ||
8 | +++ sreadahead-0.02/readahead.c 2008-10-27 16:27:52.000000000 +0100 | ||
9 | @@ -69,7 +69,11 @@ void *one_thread(void *ptr) | ||
10 | int main(int argc, char **argv) | ||
11 | { | ||
12 | FILE *file = fopen("/etc/readahead.packed", "r"); | ||
13 | - | ||
14 | + if (!file) { | ||
15 | + perror("Couldnt open /etc/readahead.packed"); | ||
16 | + return -errno; | ||
17 | + } | ||
18 | + | ||
19 | daemon(0,0); | ||
20 | |||
21 | total_files = fread(&files, sizeof(struct readahead), MAXR, file); | ||
22 | @@ -81,7 +85,6 @@ int main(int argc, char **argv) | ||
23 | pthread_create(&three, NULL, one_thread, NULL); | ||
24 | pthread_create(&four, NULL, one_thread, NULL); | ||
25 | |||
26 | - printf("Waiting\n"); | ||
27 | pthread_join(one, NULL); | ||
28 | pthread_join(two, NULL); | ||
29 | pthread_join(three, NULL); | ||
diff --git a/meta-moblin/packages/sreadahead/sreadahead-0.02/sreadahead-0.02-make.patch b/meta-moblin/packages/sreadahead/sreadahead-0.02/sreadahead-0.02-make.patch new file mode 100644 index 0000000000..d0ece663b5 --- /dev/null +++ b/meta-moblin/packages/sreadahead/sreadahead-0.02/sreadahead-0.02-make.patch | |||
@@ -0,0 +1,27 @@ | |||
1 | diff -Nrup sreadahead-0.02.orig/Makefile sreadahead-0.02/Makefile | ||
2 | --- sreadahead-0.02.orig/Makefile 2008-09-23 22:36:24.000000000 +0200 | ||
3 | +++ sreadahead-0.02/Makefile 2008-09-26 07:43:19.000000000 +0200 | ||
4 | @@ -1,11 +1,18 @@ | ||
5 | -all: generate_filelist sreadahead | ||
6 | +CFLAGS=-Os -g -Wall | ||
7 | +PROGS=generate_filelist sreadahead | ||
8 | + | ||
9 | +all: $(PROGS) | ||
10 | |||
11 | |||
12 | generate_filelist: readahead.h filelist.c Makefile | ||
13 | - gcc -Os -g -Wall -W filelist.c -o generate_filelist | ||
14 | + $(CC) $(CFLAGS) -W filelist.c -o generate_filelist | ||
15 | |||
16 | sreadahead: readahead.h readahead.c Makefile | ||
17 | - gcc -Os -g -Wall -lpthread -W readahead.c -o sreadahead | ||
18 | + $(CC) $(CFLAGS) -lpthread -W readahead.c -o sreadahead | ||
19 | |||
20 | clean: | ||
21 | - rm -f *~ sreadahead generate_filelist | ||
22 | \ No newline at end of file | ||
23 | + rm -f *~ sreadahead generate_filelist | ||
24 | + | ||
25 | +install: all | ||
26 | + mkdir -p $(DESTDIR)/sbin | ||
27 | + install -p -m 755 $(PROGS) $(DESTDIR)/sbin | ||
diff --git a/meta-moblin/packages/sreadahead/sreadahead_0.02.bb b/meta-moblin/packages/sreadahead/sreadahead_0.02.bb new file mode 100644 index 0000000000..ca89635776 --- /dev/null +++ b/meta-moblin/packages/sreadahead/sreadahead_0.02.bb | |||
@@ -0,0 +1,41 @@ | |||
1 | DESCRIPTION = "Super readahead, part of the fastboot tool set." | ||
2 | SECTION = "base" | ||
3 | HOMEPAGE = "http://www.moblin.org" | ||
4 | LICENSE = "GPLv2" | ||
5 | PR = "r12" | ||
6 | |||
7 | inherit update-rc.d | ||
8 | |||
9 | SRC_URI = "http://www.moblin.org/sites/all/files/sreadahead-${PV}.tar.gz \ | ||
10 | file://sreadahead-0.02-make.patch;patch=1 \ | ||
11 | file://readahead_c.patch;patch=1 \ | ||
12 | file://sreadahead-generate.sh \ | ||
13 | file://sreadahead.sh" | ||
14 | |||
15 | CFLAGS_prepend = "-I ${S}/include " | ||
16 | |||
17 | PACKAGES += "${PN}-generate" | ||
18 | FILES_${PN} = "${base_sbindir}/sreadahead ${sysconfdir}/init.d/sreadahead.sh" | ||
19 | FILES_${PN}-generate = "${base_sbindir}/generate_filelist ${sysconfdir}/init.d/sreadahead-generate.sh" | ||
20 | |||
21 | INITSCRIPT_PACKAGES = "${PN} ${PN}-generate" | ||
22 | INITSCRIPT_NAME = "sreadahead.sh" | ||
23 | INITSCRIPT_NAME_${PN}-generate = "sreadahead-generate.sh" | ||
24 | INITSCRIPT_PARAMS = "start 00 S ." | ||
25 | INITSCRIPT_PARAMS_${PN}-generate = "defaults 99" | ||
26 | |||
27 | do_install() { | ||
28 | oe_runmake install DESTDIR=${D} | ||
29 | install -d ${D}${sysconfdir}/init.d | ||
30 | install -m 755 ${WORKDIR}/sreadahead.sh ${D}${sysconfdir}/init.d/ | ||
31 | install -m 755 ${WORKDIR}/sreadahead-generate.sh ${D}${sysconfdir}/init.d/ | ||
32 | } | ||
33 | |||
34 | pkg_postinst_${PN}-generate () { | ||
35 | # can't do this offline | ||
36 | if [ "x$D" != "x" ]; then | ||
37 | exit 1 | ||
38 | fi | ||
39 | |||
40 | touch /etc/readahead.packed.first | ||
41 | } | ||