diff options
author | Helge Deller <deller@gmx.de> | 2013-10-29 21:05:17 +0100 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2013-10-29 21:21:31 +0100 |
commit | e1f992fffd146c480a61a3e00f9bb183e374d928 (patch) | |
tree | 8fdaba181325a382dee6be5c30dcbaa8bf982a16 | |
parent | f122a65fa001637786df834e575d2060d9626e78 (diff) | |
download | palo-e1f992fffd146c480a61a3e00f9bb183e374d928.tar.gz |
ignore path from e.g. 2/boot/vmlinux if file not found
Some people don't understand, that 2/vmlinux means to load the vmlinux
file from the second partition on the harddisk.
Instead they use e.g. 2/boot/vmlinux, because the second partition
is mounted under /boot in Linux.
But PALO doesn't know anything about the mount points in Linux, so it
expects 2/vmlinux instead.
We now try to strip the path from the given filename if it wasn't found
in the given directory. That way the kernel/initrd which people wanted
to load will be loaded and we inform the people what they did wrong.
-rw-r--r-- | ipl/ipl.c | 29 | ||||
-rw-r--r-- | lib/common.h | 2 |
2 files changed, 27 insertions, 4 deletions
@@ -78,6 +78,29 @@ parse_pfname(char *s, int *partition, char *name) return p2; } +/* + * ext2_open_dirstrip() + * Get filehandle for given filename. + * If user gave 2/boot/vmlinux, don't fail and try if he maybe actually meant 2/vmlinux. + */ +static int +ext2_open_dirstrip(char *filename) +{ + while (filename && *filename) { + char *last; + int fh = ext2_open(filename); + if (fh >= 0) + return fh; + + last = filename; + filename = strpbrk(&filename[1], "/"); + if (filename) + printf("Warning: %s not found. Try %s instead...\n", last, filename); + } + + return -1; +} + static int chk_strcat(char *out, char *in, int len, int *ok) { @@ -692,8 +715,8 @@ iplmain(int is_interactive, char *initialstackptr, int started_wide) if (0) printf("ext2_mount(partition %d) returns %d\n", kern_part, mount_fd); - kern_fd = ext2_open(kern_name); - if (0) printf("ext2_open(%s) = %d\n", kern_name, kern_fd); + kern_fd = ext2_open_dirstrip(kern_name); + if (0) printf("ext2_open_dirstrip(%s) = %d\n", kern_name, kern_fd); if (kern_fd < 0) { printf("ERROR: open %s from partition %d failed\n", @@ -710,7 +733,7 @@ iplmain(int is_interactive, char *initialstackptr, int started_wide) if (rd_part != -1) { - rd_fd = ext2_open(rd_name); + rd_fd = ext2_open_dirstrip(rd_name); if(rd_fd >= 0) { brd_fd = byteio_open(rd_fd); diff --git a/lib/common.h b/lib/common.h index c4a70c2..e353dd3 100644 --- a/lib/common.h +++ b/lib/common.h @@ -40,7 +40,7 @@ void *pa_memcpy(void *dest, const void *src, unsigned n); #define __swab16(x) bswap_16(x) #endif /* __swab16 */ -#define PALOVERSION "1.92" +#define PALOVERSION "1.92a" /* size of I/O block used in HP firmware */ #define FW_BLOCKSIZE 2048 |