diff -urN linux-2.4.32-procboot/fs/proc/proc_misc.c linux-2.4.32-bootdev/fs/proc/proc_misc.c --- linux-2.4.32-procboot/fs/proc/proc_misc.c 2004-08-08 01:26:06.000000000 +0200 +++ linux-2.4.32-bootdev/fs/proc/proc_misc.c 2005-11-22 10:17:03.000000000 +0100 @@ -457,6 +457,16 @@ return proc_calc_metrics(page, start, off, count, eof, len); } +static int boot_bootdev_read_proc(char *page, char **start, off_t off, + int count, int *eof, void *data) +{ + extern char saved_bootdev[]; + int len = 0; + + proc_sprintf(page, &off, &len, "%s\n", saved_bootdev); + return proc_calc_metrics(page, start, off, count, eof, len); +} + #ifdef CONFIG_SGI_DS1286 static int ds1286_read_proc(char *page, char **start, off_t off, int count, int *eof, void *data) @@ -627,6 +637,9 @@ for (p = simple_ones; p->name; p++) create_proc_read_entry(p->name, 0, NULL, p->read_proc, NULL); + create_proc_read_entry("bootdev", S_IRUGO, proc_boot, \ + boot_bootdev_read_proc, NULL); + proc_symlink("mounts", NULL, "self/mounts"); /* And now for trickier ones */ diff -urN linux-2.4.32-procboot/init/main.c linux-2.4.32-bootdev/init/main.c --- linux-2.4.32-procboot/init/main.c 2004-11-17 12:54:22.000000000 +0100 +++ linux-2.4.32-bootdev/init/main.c 2005-11-22 10:29:35.000000000 +0100 @@ -227,6 +227,17 @@ __setup("debug", debug_kernel); __setup("quiet", quiet_kernel); +/* 32 chars should be enough to save a full path to a boot device */ +#define MAX_BOOTDEV_LEN 32 +char saved_bootdev[MAX_BOOTDEV_LEN] = ""; +static int __init parse_bootdev(char *str) +{ + strncpy(saved_bootdev, str, MAX_BOOTDEV_LEN-1); + saved_bootdev[MAX_BOOTDEV_LEN-1] = '\0'; + return 1; +} +__setup("bootdev=", parse_bootdev); + /* * This is a simple kernel command line parsing function: it parses * the command line, and fills in the arguments/environment to init