summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2008-11-03 19:14:00 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2008-11-03 19:14:00 +0100
commitbebb376e62f94fec5caa1abb6141a6e6728ae95f (patch)
tree2e1cefeb324a5d0b30fe90c3619098098052e130
parent7b5d03d08e737dd3637072f60259af5b093b7f70 (diff)
downloadopenembedded-core-bebb376e62f94fec5caa1abb6141a6e6728ae95f.tar.gz
openembedded-core-bebb376e62f94fec5caa1abb6141a6e6728ae95f.tar.bz2
openembedded-core-bebb376e62f94fec5caa1abb6141a6e6728ae95f.tar.xz
openembedded-core-bebb376e62f94fec5caa1abb6141a6e6728ae95f.zip
sreadahead: Initial commit
Super readahead is an improved readahead tool.
-rwxr-xr-xmeta-moblin/packages/sreadahead/files/sreadahead-generate.sh21
-rwxr-xr-xmeta-moblin/packages/sreadahead/files/sreadahead.sh7
-rw-r--r--meta-moblin/packages/sreadahead/sreadahead-0.02/readahead_c.patch29
-rw-r--r--meta-moblin/packages/sreadahead/sreadahead-0.02/sreadahead-0.02-make.patch27
-rw-r--r--meta-moblin/packages/sreadahead/sreadahead_0.02.bb41
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 000000000..626d7ccbe
--- /dev/null
+++ b/meta-moblin/packages/sreadahead/files/sreadahead-generate.sh
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+
+if [ -e /etc/readahead.packed ]; then
+ exit 0
+fi
+
+if [ -e /etc/readahead.packed.first ]; then
+ mv /etc/readahead.packed.first /etc/readahead.packed.second
+ exit 0
+fi
+
+# That's our second boot, we can generate the sreadahead file list
+if [ -e /etc/readahead.packed.second ]; then
+ rm -f /etc/readahead.packed.second
+ find / -type f > filelist.txt
+
+ /sbin/generate_filelist filelist.txt
+ rm filelist.txt
+ mv readahead.packed /etc/
+fi
diff --git a/meta-moblin/packages/sreadahead/files/sreadahead.sh b/meta-moblin/packages/sreadahead/files/sreadahead.sh
new file mode 100755
index 000000000..c7378284b
--- /dev/null
+++ b/meta-moblin/packages/sreadahead/files/sreadahead.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+#
+# Start sreadahead, of the config file exists
+
+if [ -e /etc/readahead.packed ]; then
+ /sbin/sreadahead
+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 000000000..a65c1088f
--- /dev/null
+++ b/meta-moblin/packages/sreadahead/sreadahead-0.02/readahead_c.patch
@@ -0,0 +1,29 @@
+---
+ readahead.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+Index: sreadahead-0.02/readahead.c
+===================================================================
+--- sreadahead-0.02.orig/readahead.c 2008-09-23 22:35:20.000000000 +0200
++++ sreadahead-0.02/readahead.c 2008-10-27 16:27:52.000000000 +0100
+@@ -69,7 +69,11 @@ void *one_thread(void *ptr)
+ int main(int argc, char **argv)
+ {
+ FILE *file = fopen("/etc/readahead.packed", "r");
+-
++ if (!file) {
++ perror("Couldnt open /etc/readahead.packed");
++ return -errno;
++ }
++
+ daemon(0,0);
+
+ total_files = fread(&files, sizeof(struct readahead), MAXR, file);
+@@ -81,7 +85,6 @@ int main(int argc, char **argv)
+ pthread_create(&three, NULL, one_thread, NULL);
+ pthread_create(&four, NULL, one_thread, NULL);
+
+- printf("Waiting\n");
+ pthread_join(one, NULL);
+ pthread_join(two, NULL);
+ 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 000000000..d0ece663b
--- /dev/null
+++ b/meta-moblin/packages/sreadahead/sreadahead-0.02/sreadahead-0.02-make.patch
@@ -0,0 +1,27 @@
+diff -Nrup sreadahead-0.02.orig/Makefile sreadahead-0.02/Makefile
+--- sreadahead-0.02.orig/Makefile 2008-09-23 22:36:24.000000000 +0200
++++ sreadahead-0.02/Makefile 2008-09-26 07:43:19.000000000 +0200
+@@ -1,11 +1,18 @@
+-all: generate_filelist sreadahead
++CFLAGS=-Os -g -Wall
++PROGS=generate_filelist sreadahead
++
++all: $(PROGS)
+
+
+ generate_filelist: readahead.h filelist.c Makefile
+- gcc -Os -g -Wall -W filelist.c -o generate_filelist
++ $(CC) $(CFLAGS) -W filelist.c -o generate_filelist
+
+ sreadahead: readahead.h readahead.c Makefile
+- gcc -Os -g -Wall -lpthread -W readahead.c -o sreadahead
++ $(CC) $(CFLAGS) -lpthread -W readahead.c -o sreadahead
+
+ clean:
+- rm -f *~ sreadahead generate_filelist
+\ No newline at end of file
++ rm -f *~ sreadahead generate_filelist
++
++install: all
++ mkdir -p $(DESTDIR)/sbin
++ 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 000000000..ca8963577
--- /dev/null
+++ b/meta-moblin/packages/sreadahead/sreadahead_0.02.bb
@@ -0,0 +1,41 @@
+DESCRIPTION = "Super readahead, part of the fastboot tool set."
+SECTION = "base"
+HOMEPAGE = "http://www.moblin.org"
+LICENSE = "GPLv2"
+PR = "r12"
+
+inherit update-rc.d
+
+SRC_URI = "http://www.moblin.org/sites/all/files/sreadahead-${PV}.tar.gz \
+ file://sreadahead-0.02-make.patch;patch=1 \
+ file://readahead_c.patch;patch=1 \
+ file://sreadahead-generate.sh \
+ file://sreadahead.sh"
+
+CFLAGS_prepend = "-I ${S}/include "
+
+PACKAGES += "${PN}-generate"
+FILES_${PN} = "${base_sbindir}/sreadahead ${sysconfdir}/init.d/sreadahead.sh"
+FILES_${PN}-generate = "${base_sbindir}/generate_filelist ${sysconfdir}/init.d/sreadahead-generate.sh"
+
+INITSCRIPT_PACKAGES = "${PN} ${PN}-generate"
+INITSCRIPT_NAME = "sreadahead.sh"
+INITSCRIPT_NAME_${PN}-generate = "sreadahead-generate.sh"
+INITSCRIPT_PARAMS = "start 00 S ."
+INITSCRIPT_PARAMS_${PN}-generate = "defaults 99"
+
+do_install() {
+ oe_runmake install DESTDIR=${D}
+ install -d ${D}${sysconfdir}/init.d
+ install -m 755 ${WORKDIR}/sreadahead.sh ${D}${sysconfdir}/init.d/
+ install -m 755 ${WORKDIR}/sreadahead-generate.sh ${D}${sysconfdir}/init.d/
+}
+
+pkg_postinst_${PN}-generate () {
+ # can't do this offline
+ if [ "x$D" != "x" ]; then
+ exit 1
+ fi
+
+ touch /etc/readahead.packed.first
+}