First cut support for making the initrd itself the image.
Signed-off-by: Nigel Cunningham <[email protected]>
kernel/power/suspend_file.c | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/kernel/power/suspend_file.c b/kernel/power/suspend_file.c
index 46527f1..6f298fc 100644
--- a/kernel/power/suspend_file.c
+++ b/kernel/power/suspend_file.c
@@ -544,3 +544,41 @@ static int filewriter_write_header_clean
return 0;
}
+/* HEADER READING */
+
+#ifdef CONFIG_DEVFS_FS
+int create_dev(char *name, dev_t dev, char *devfs_name);
+#else
+static int create_dev(char *name, dev_t dev, char *devfs_name)
+{
+ sys_unlink(name);
+ return sys_mknod(name, S_IFBLK|0600, new_encode_dev(dev));
+}
+#endif
+
+static int rd_init(void)
+{
+ suspend_writer_buffer_posn = 0;
+
+ create_dev("/dev/root", ROOT_DEV, root_device_name);
+ create_dev("/dev/ram", MKDEV(RAMDISK_MAJOR, 0), NULL);
+
+ suspend_read_fd = sys_open("/dev/root", O_RDONLY, 0);
+ if (suspend_read_fd < 0)
+ goto out;
+
+ sys_read(suspend_read_fd, suspend_writer_buffer, BLOCK_SIZE);
+
+ memcpy(&suspend_writer_posn_save,
+ suspend_writer_buffer + suspend_writer_buffer_posn,
+ sizeof(suspend_writer_posn_save));
+
+ suspend_writer_buffer_posn += sizeof(suspend_writer_posn_save);
+
+ return 0;
+out:
+ sys_unlink("/dev/ram");
+ sys_unlink("/dev/root");
+ return -EIO;
+}
+
--
Nigel Cunningham nigel at suspend2 dot net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]