diff options
author | maximilian attems <maks@sternwelten.at> | 2006-07-16 21:33:27 +0200 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2006-07-16 15:00:00 -0700 |
commit | 536d67e65c4060150b28ed00b716a3207b0f9854 (patch) | |
tree | ff0c7c6010078c3256572edd6e02c1d9cb2b16af | |
parent | d2d8f50ddcb5190ad33b9e6168686e096498b1ab (diff) | |
download | klibc-536d67e65c4060150b28ed00b716a3207b0f9854.tar.gz |
standalone kinit/resumeklibc-1.4.11
Factor out resume in a subdirectory - no functional changes.
mv resume.c resume/resumelib.c
Add an standalone minimal resume.c, which calls resume() from resumelib.
resulting resume bin is small:
ls -l /usr/lib/klibc/bin/resume
-rwxr-xr-x 1 root root 2904 2006-07-11 09:18 /usr/lib/klibc/bin/resume
tested with several resume/suspend cycles.
as a bonus alphabetically sort the include and the clean dir
Signed-off-by: maximilian attems <maks@sternwelten.at>
-rw-r--r-- | usr/kinit/Kbuild | 12 | ||||
-rw-r--r-- | usr/kinit/resume/Kbuild | 28 | ||||
-rw-r--r-- | usr/kinit/resume/resume.c | 27 | ||||
-rw-r--r-- | usr/kinit/resume/resume.h (renamed from usr/kinit/resume.h) | 0 | ||||
-rw-r--r-- | usr/kinit/resume/resumelib.c (renamed from usr/kinit/resume.c) | 0 |
5 files changed, 62 insertions, 5 deletions
diff --git a/usr/kinit/Kbuild b/usr/kinit/Kbuild index 0000e898aada9..37b35cf1c5bbc 100644 --- a/usr/kinit/Kbuild +++ b/usr/kinit/Kbuild @@ -6,25 +6,27 @@ static-y := kinit kinit-y := kinit.o do_mounts.o ramdisk_load.o initrd.o kinit-y += name_to_dev.o devname.o kinit-y += getarg.o getintfile.o open.o readfile.o xpio.o -kinit-y += do_mounts_md.o do_mounts_mtd.o nfsroot.o resume.o +kinit-y += do_mounts_md.o do_mounts_mtd.o nfsroot.o kinit-y += ipconfig/ kinit-y += nfsmount/ kinit-y += run-init/ kinit-y += fstype/ +kinit-y += resume/ shared-y := kinit.shared kinit.shared-y := $(kinit-y) # Additional include paths files -KLIBCCFLAGS += -I$(srctree)/$(src)/ipconfig \ +KLIBCCFLAGS += -I$(srctree)/$(src)/fstype \ + -I$(srctree)/$(src)/ipconfig \ -I$(srctree)/$(src)/nfsmount \ - -I$(srctree)/$(src)/run-init \ - -I$(srctree)/$(src)/fstype + -I$(srctree)/$(src)/resume \ + -I$(srctree)/$(src)/run-init # Cleaning targets := kinit kinit.g kinit.shared kinit.shared.g -subdir- := ipconfig nfsmount run-init fstype +subdir- := fstype ipconfig nfsmount resume run-init # install binary diff --git a/usr/kinit/resume/Kbuild b/usr/kinit/resume/Kbuild new file mode 100644 index 0000000000000..ce6d0ce3ce615 --- /dev/null +++ b/usr/kinit/resume/Kbuild @@ -0,0 +1,28 @@ +# +# Kbuild file for resume +# + +static-y := static/resume +shared-y := shared/resume + +# common .o files +objs := resume.o resumelib.o ../getarg.o ../name_to_dev.o ../devname.o + +# TODO - do we want a stripped version +# TODO - do we want the static.g + shared.g directories? + +# Create built-in.o with all object files (used by kinit) +lib-y := $(objs) + +# Additional include paths files +KLIBCCFLAGS += -I$(srctree)/$(src)/.. + +# .o files used to built executables +static/resume-y := $(objs) +shared/resume-y := $(objs) + +# Cleaning +clean-dirs := static shared + +# install binary +install-y := $(shared-y) diff --git a/usr/kinit/resume/resume.c b/usr/kinit/resume/resume.c new file mode 100644 index 0000000000000..00e5405c6cfb2 --- /dev/null +++ b/usr/kinit/resume/resume.c @@ -0,0 +1,27 @@ +/* + * resume.c + * + * Handle resume from suspend-to-disk + */ + +#include <stdio.h> +#include <stdlib.h> + +#include "resume.h" + +char *progname; + +static __noreturn usage(void) +{ + fprintf(stderr, "Usage: %s /dev/<resumedevice>\n", progname); + exit(1); +} + +int main(int argc, char *argv[], char *envp[]) +{ + progname = argv[0]; + if (argc != 2) + usage(); + + return resume(argv[1]); +} diff --git a/usr/kinit/resume.h b/usr/kinit/resume/resume.h index bf55f1bdb40b6..bf55f1bdb40b6 100644 --- a/usr/kinit/resume.h +++ b/usr/kinit/resume/resume.h diff --git a/usr/kinit/resume.c b/usr/kinit/resume/resumelib.c index bd328bd032bbb..bd328bd032bbb 100644 --- a/usr/kinit/resume.c +++ b/usr/kinit/resume/resumelib.c |