A patch for the aboot bootloader:

  - Prepare build system for cross-compilation.
  - Applied most changes of Debian aboot 0.9b-3+etchnhalf.1 patch.
  - Updated man pages (english only).

November 6, 2014 -- arthur

diff -Naur aboot-0.9b.org/Makefile aboot-0.9b.new/Makefile
--- aboot-0.9b.org/Makefile	2002-09-18 19:48:21.000000000 +0000
+++ aboot-0.9b.new/Makefile	2014-11-06 21:28:26.000000000 +0000
@@ -8,6 +8,8 @@
 # Copyright (c) 1995, 1996 by David Mosberger (davidm@cs.arizona.edu)
 #
 
+TOP		= $(shell pwd)
+
 # location of linux kernel sources (must be absolute path):
 KSRC		= /usr/src/linux
 VMLINUX		= $(KSRC)/vmlinux
@@ -16,61 +18,64 @@
 # for userspace testing
 #TESTING	= yes
 
-# for boot testing
-#CFGDEFS       	= -DDEBUG_ISO -DDEBUG_ROCK -DDEBUG
+# for boot testing:
+#  -DDEBUG_ISO		enable debug traces ISO9660 f/s
+#  -DDEBUG_ROCK		enable debug traces RockRidge extensions
+#  -DDEBUG_EXT2		enable debug traces ext2 f/s
+#  -DDEBUG		enable general aboot traces
+CFGDEFS		=
 
 # root, aka prefix
 root		=
 bindir		= $(root)/sbin
 bootdir		= $(root)/boot
-mandir		= /usr/man
+mandir		= $(root)/usr/share/man
 
 #
 # There shouldn't be any need to change anything below this line.
 #
 LOADADDR	= 20000000
 
-ABOOT_LDFLAGS = -static -N -Taboot.lds
-
 CC		= gcc
-TOP		= $(shell pwd)
-ifeq ($(TESTING),)
+
 CPPFLAGS	= $(CFGDEFS) -I$(TOP)/include -I$(KSRC)/include
-CFLAGS		= $(CPPFLAGS) -D__KERNEL__ -mcpu=ev4 -Os -Wall -fno-builtin -mno-fp-regs -ffixed-8
-else
-CPPFLAGS	= -DTESTING $(CFGDEFS) -I$(TOP)/include -I$(KSRC)/include
-CFLAGS		= $(CPPFLAGS) -O -g3 -Wall -D__KERNEL__ -ffixed-8
+CFLAGS		= -O2 -Wall -Wcast-align
+LDFLAGS		=
+
+ifneq ($(TESTING),)
+CPPFLAGS	+= -DTESTING
+CFLAGS		+= -O -g3 -mfp-regs
 endif
-ASFLAGS		= $(CPPFLAGS)
 
+ABOOT_CPPFLAGS	= -D__KERNEL__ -DCONFIG_64BIT $(CPPFLAGS)
+ABOOT_CFLAGS	= -fno-builtin -mno-fp-regs -ffixed-8 $(CFLAGS)
+ABOOT_LDFLAGS	= -static -N -Taboot.lds
+ABOOT_ASFLAGS	= -D__ASSEMBLY__ -traditional
+
+export CC TESTING
 
 .c.s:
-	$(CC) $(CFLAGS) -S -o $*.s $<
+	$(CC) $(ABOOT_CPPFLAGS) $(ABOOT_CFLAGS) -S -o $*.s $<
 .s.o:
 	$(AS) -o $*.o $<
 .c.o:
-	$(CC) $(CFLAGS) -c -o $*.o $<
+	$(CC) $(ABOOT_CPPFLAGS) $(ABOOT_CFLAGS) -c -o $*.o $<
 .S.s:
-	$(CC) $(ASFLAGS) -D__ASSEMBLY__ -traditional -E -o $*.o $<
+	$(CC) $(ABOOT_CPPFLAGS) $(ABOOT_ASFLAGS) -E -o $*.o $<
 .S.o:
-	$(CC) $(ASFLAGS) -D__ASSEMBLY__ -traditional -c -o $*.o $<
+	$(CC) $(ABOOT_CPPFLAGS) $(ABOOT_ASFLAGS) -c -o $*.o $<
 
 NET_OBJS = net.o
 DISK_OBJS = disk.o fs/ext2.o fs/ufs.o fs/dummy.o fs/iso.o
 ifeq ($(TESTING),)
-ABOOT_OBJS = \
-	head.o aboot.o cons.o utils.o \
+ABOOT_OBJS = head.o aboot.o cons.o utils.o \
 	zip/misc.o zip/unzip.o zip/inflate.o
 else
 ABOOT_OBJS = aboot.o zip/misc.o zip/unzip.o zip/inflate.o
 endif
 LIBS	= lib/libaboot.a
 
-ifeq ($(TESTING),)
 all:	diskboot
-else
-all:	aboot
-endif
 
 diskboot:	bootlx sdisklabel/sdisklabel sdisklabel/swriteboot \
 		tools/e2writeboot tools/isomarkboot tools/abootconf \
@@ -81,19 +86,20 @@
 bootlx:	aboot tools/objstrip
 	tools/objstrip -vb aboot bootlx
 
-install-man: 
-	make -C doc/man install
+install-man:
+	$(MAKE) -C doc/man mandir="$(mandir)" install
 
 install-man-gz:
-	make -C doc/man install-gz
+	$(MAKE) -C doc/man mandir="$(mandir)" install-gz
 
 install: tools/abootconf tools/e2writeboot tools/isomarkboot \
 	sdisklabel/swriteboot install-man
 	install -d $(bindir) $(bootdir)
-	install -c -s tools/abootconf $(bindir)
-	install -c -s tools/e2writeboot $(bindir)
-	install -c -s tools/isomarkboot $(bindir)
-	install -c -s sdisklabel/swriteboot $(bindir)
+	install -c tools/abootconf $(bindir)
+	install -c tools/e2writeboot $(bindir)
+	install -c tools/isomarkboot $(bindir)
+	install -c sdisklabel/sdisklabel $(bindir)
+	install -c sdisklabel/swriteboot $(bindir)
 	install -c bootlx $(bootdir)
 
 installondisk:	bootlx sdisklabel/swriteboot
@@ -128,13 +134,13 @@
 	find . -name \*~ | xargs rm -f
 
 lib/%:
-	make -C lib $* CPPFLAGS="$(CPPFLAGS)" TESTING="$(TESTING)"
+	$(MAKE) -C lib CFLAGS="$(ABOOT_CFLAGS)" CPPFLAGS="$(ABOOT_CPPFLAGS)" ASFLAGS="$(ABOOT_ASFLAGS)" $*
 
 tools/%:
-	make -C tools $* CPPFLAGS="$(CPPFLAGS)"
+	$(MAKE) -C tools CFLAGS="$(CFLAGS)" CPPFLAGS="$(ABOOT_CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $*
 
 sdisklabel/%:
-	make -C sdisklabel $* CPPFLAGS="$(CPPFLAGS)"
+	$(MAKE) -C sdisklabel CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $*
 
 vmlinux.nh: $(VMLINUX) tools/objstrip
 	tools/objstrip -vb $(VMLINUX) vmlinux.nh
@@ -143,3 +149,5 @@
 	echo "#define KERNEL_SIZE `ls -l vmlinux.nh | awk '{print $$5}'` > $@
 
 dep:
+
+.PHONY: all diskboot netboot install-man install-man-gz install installondisk clean distclean
diff -Naur aboot-0.9b.org/aboot.c aboot-0.9b.new/aboot.c
--- aboot-0.9b.org/aboot.c	2001-10-12 06:04:06.000000000 +0000
+++ aboot-0.9b.new/aboot.c	2014-11-06 20:39:29.000000000 +0000
@@ -31,30 +31,21 @@
 #include <asm/system.h>
 
 #include <alloca.h>
+#include <errno.h>
 
-#include <aboot.h>
-#include <config.h>
-#include <cons.h>
-#include <setjmp.h>
-#include <utils.h>
-
-#ifndef elf_check_arch
-# define aboot_elf_check_arch(e)	1
-#else
-# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
-#  define aboot_elf_check_arch(e)        elf_check_arch(e)
-# else
-#  define aboot_elf_check_arch(e)        elf_check_arch(e->e_machine)
-# endif
-#endif
+#include "aboot.h"
+#include "config.h"
+#include "cons.h"
+#include "setjmp.h"
+#include "utils.h"
 
 struct bootfs *	bfs = 0;		/* filesystem to boot from */
 char *		dest_addr = 0;
 jmp_buf		jump_buffer;
 
 unsigned long	start_addr = START_ADDR; /* default only */
-struct segment* chunks;
-int             nchunks;
+struct segment*	chunks;
+int		nchunks;
 
 char		boot_file[256] = "";
 char		initrd_file[256] = "";
@@ -84,59 +75,100 @@
 long
 first_block (const char *buf, long blocksize)
 {
-	struct elfhdr *elf;
-	struct elf_phdr *phdrs;
+	Elf64_Ehdr *elf;
+	Elf64_Phdr *phdrs;
+	int i, j;
+
+	elf = (Elf64_Ehdr *) buf;
+
+	if (elf->e_ident[0] != 0x7f
+	    || elf->e_ident[1] != 'E'
+	    || elf->e_ident[2] != 'L'
+	    || elf->e_ident[3] != 'F')
+	{
+		/* Fail silently, it might be a compressed file */
+		return -1;
+	}
+	if (elf->e_ident[EI_CLASS] != ELFCLASS64
+	    || elf->e_ident[EI_DATA] != ELFDATA2LSB
+	    || elf->e_machine != EM_ALPHA)
+	{
+		printf("aboot: ELF executable not for this machine\n");
+		return -1;
+	}
 
-	elf  = (struct elfhdr *) buf;
-	
-	if (elf->e_ident[0] == 0x7f
-	    && strncmp(elf->e_ident + 1, "ELF", 3) == 0)
+	/* Looks like an ELF binary. */
+	if (elf->e_type != ET_EXEC) {
+		printf("aboot: not an executable ELF file\n");
+		return -1;
+	}
+
+	if (elf->e_phoff + elf->e_phnum * sizeof(*phdrs) > (unsigned) blocksize)
 	{
-		int i;
-		/* looks like an ELF binary: */
-		if (elf->e_type != ET_EXEC) {
-			printf("aboot: not an executable ELF file\n");
-			return -1;
-		}
-		if (!aboot_elf_check_arch(elf)) {
-			printf("aboot: ELF executable not for this machine\n");
-			return -1;
-		}
-		if (elf->e_phoff + elf->e_phnum * sizeof(*phdrs) > (unsigned) blocksize) {
-			printf("aboot: "
-			       "ELF program headers not in first block (%ld)\n",
-			       (long) elf->e_phoff);
-			return -1;
-		}
-		phdrs = (struct elf_phdr *) (buf + elf->e_phoff);
-		chunks = malloc(sizeof(struct segment) * elf->e_phnum);
-		nchunks = elf->e_phnum;
-		start_addr = phdrs[0].p_vaddr; /* assume they are sorted */
-		entry_addr = elf->e_entry;
+		printf("aboot: ELF program headers not in first block (%ld)\n",
+		       (long) elf->e_phoff);
+		return -1;
+	}
+
+	phdrs = (Elf64_Phdr *) (buf + elf->e_phoff);
+	chunks = malloc(sizeof(struct segment) * elf->e_phnum);
+	start_addr = phdrs[0].p_vaddr; /* assume they are sorted */
+	entry_addr = elf->e_entry;
+
 #ifdef DEBUG
-		printf("aboot: %d program headers, start address %#lx, entry %#lx\n",
-		       nchunks, start_addr, entry_addr);
+	printf("aboot: %d program headers, start address %#lx, entry %#lx\n",
+	       elf->e_phnum, start_addr, entry_addr);
 #endif
-		for (i = 0; i < elf->e_phnum; ++i) {
-			chunks[i].addr   = phdrs[i].p_vaddr;
-			chunks[i].offset = phdrs[i].p_offset;
-			chunks[i].size   = phdrs[i].p_filesz;
+
+	for (i = j = 0; i < elf->e_phnum; ++i) {
+		int status;
+
+		if (phdrs[i].p_type != PT_LOAD)
+			continue;
+
+		chunks[j].addr   = phdrs[i].p_vaddr;
+		chunks[j].offset = phdrs[i].p_offset;
+		chunks[j].size   = phdrs[i].p_filesz;
+
 #ifdef DEBUG
-			printf("aboot: segment %d vaddr %#lx offset %#lx size %#lx\n",
-			       i, chunks[i].addr, chunks[i].offset, chunks[i].size);
+		printf("aboot: PHDR %d vaddr %#lx offset %#lx size %#lx\n",
+		       i, chunks[j].addr, chunks[j].offset, chunks[j].size);
 #endif
+
+#ifndef TESTING
+		status = check_memory(chunks[j].addr, chunks[j].size);
+		if (status) {
+			printf("aboot: Can't load kernel.\n"
+			       "  Memory at %lx - %lx (PHDR %i) "
+			       "is %s\n",
+			       chunks[j].addr,
+			       chunks[j].addr + chunks[j].size - 1,
+			       i,
+			       (status == -ENOMEM) ?
+			          "Not Found" :
+				  "Busy (Reserved)");
+			return -1;
 		}
-		bss_start = (char *) (phdrs[elf->e_phnum - 1].p_vaddr +
-				      phdrs[elf->e_phnum - 1].p_filesz);
-		bss_size = (phdrs[elf->e_phnum - 1].p_memsz -
-			    phdrs[elf->e_phnum - 1].p_filesz);
-#ifdef DEBUG
-		printf("aboot: bss at 0x%p, size %#lx\n", bss_start, bss_size);
 #endif
-	} else {
-		/* Fail silently, it might be a compressed file */
-		return -1;
+
+		if (phdrs[i].p_memsz > phdrs[i].p_filesz) {
+			if (bss_size > 0) {
+				printf("aboot: Can't load kernel.\n"
+				       "  Multiple BSS segments"
+				       " (PHDR %d)\n", i);
+				return -1;
+			}
+			bss_start = (char *) (phdrs[i].p_vaddr +
+				              phdrs[i].p_filesz);
+			bss_size = (phdrs[i].p_memsz - phdrs[i].p_filesz);
+		}
+
+		j++;
 	}
+	nchunks = j;
+#ifdef DEBUG
+	printf("aboot: bss at 0x%p, size %#lx\n", bss_start, bss_size);
+#endif
 
 	return 0;
 }
@@ -202,6 +234,8 @@
 		printf("aboot: kernel load failed (%ld)\n", result);
 		return 0;
 	}
+	printf("aboot: starting kernel %s with arguments %s\n",
+	       boot_file, kernel_args);
 	return 0;
 }
 #else /* not TESTING */
@@ -223,6 +257,8 @@
 	if (INIT_HWRPB->pagesize != 8192) {
 		printf("aboot: expected 8kB pages, got %ldkB\n",
 		       INIT_HWRPB->pagesize >> 10);
+
+		cons_close_console();
 		return;
 	}
 
@@ -231,6 +267,7 @@
 	result = load_kernel();
 	if (result < 0) {
 		printf("aboot: kernel load failed (%ld)\n", result);
+		cons_close_console();
 		return;
 	}
 	printf("aboot: starting kernel %s with arguments %s\n",
@@ -241,11 +278,14 @@
 	*(unsigned long *)(start_addr + PARAM_OFFSET + 0x108)
 		= initrd_size;
 
+	cons_close_console();
 	run_kernel(entry_addr, start_addr + STACK_OFFSET);
 
+	cons_open_console();
 	printf("aboot: kernel returned unexpectedly.  Halting slowly...\n");
 	for (i = 0 ; i < 0x100000000 ; i++)
 		/* nothing */;
+	cons_close_console();
 	halt();
 }
 #endif /* TESTING */
diff -Naur aboot-0.9b.org/aboot.lds aboot-0.9b.new/aboot.lds
--- aboot-0.9b.org/aboot.lds	2001-10-08 23:03:50.000000000 +0000
+++ aboot-0.9b.new/aboot.lds	2014-01-12 14:41:45.000000000 +0000
@@ -1,22 +1,25 @@
 OUTPUT_FORMAT("elf64-alpha")
 ENTRY(__start)
+PHDRS { kernel PT_LOAD; }
 SECTIONS
 {
   . = 0x20000000;
-  .text : { *(.text) }
+  .text : { *(.text) } :kernel
   _etext = .;
   PROVIDE (etext = .);
-  .rodata : { *(.rodata) }
-  .data : { *(.data) CONSTRUCTORS }
-  .got : { *(.got) }
-  .sdata : { *(.sdata) }
+  .rodata : { *(.rodata) } :kernel
+  .data : { *(.data) } :kernel
+  .got : { *(.got) } :kernel
+  .sdata : { *(.sdata) } :kernel
   _edata = .;
   PROVIDE (edata = .);
-  .sbss : { *(.sbss) *(.scommon) }
-  .bss : { *(.bss) *(COMMON) }
+  .sbss : { *(.sbss) *(.scommon) } :kernel
+  .bss : { *(.bss) *(COMMON) } :kernel
   _end = . ;
   PROVIDE (end = .);
 
+  /DISCARD/ : { *(.eh_frame) }
+
   .mdebug 0 : { *(.mdebug) }
   .note 0 : { *(.note) }
   .comment 0 : { *(.comment) }
diff -Naur aboot-0.9b.org/cons.c aboot-0.9b.new/cons.c
--- aboot-0.9b.org/cons.c	2001-10-08 23:03:50.000000000 +0000
+++ aboot-0.9b.new/cons.c	2014-11-06 14:08:14.000000000 +0000
@@ -7,12 +7,19 @@
 #include <asm/hwrpb.h>
 #include <asm/system.h>
 
-#include <aboot.h>
-#include <cons.h>
-#include <utils.h>
+#include "aboot.h"
+#include "cons.h"
+#include "utils.h"
+
+#ifndef CCB_OPEN_CONSOLE	/* new callback w/ ARM v4 */
+# define CCB_OPEN_CONSOLE 0x07
+#endif
+
+#ifndef CCB_CLOSE_CONSOLE	/* new callback w/ ARM v4 */
+# define CCB_CLOSE_CONSOLE 0x08
+#endif
 
 long cons_dev;			/* console device */
-extern long int dispatch();	/* Need the full 64 bit return here...*/
 
 long
 cons_puts(const char *str, long len)
@@ -159,6 +166,18 @@
 }
 
 
+void cons_open_console(void)
+{
+	dispatch(CCB_OPEN_CONSOLE);
+}
+
+
+void cons_close_console(void)
+{
+	dispatch(CCB_CLOSE_CONSOLE);
+}
+
+
 void
 cons_init(void)
 {
@@ -168,4 +187,6 @@
 		halt();		/* better than random crash */
 	}
 	cons_dev = simple_strtoul(envval, 0, 10);
+
+	cons_open_console();
 }
diff -Naur aboot-0.9b.org/disk.c aboot-0.9b.new/disk.c
--- aboot-0.9b.org/disk.c	2001-10-09 20:45:57.000000000 +0000
+++ aboot-0.9b.new/disk.c	2014-11-06 20:41:31.000000000 +0000
@@ -28,12 +28,12 @@
 #  include <linux/string.h>
 #endif
 
-#include <config.h>
-#include <aboot.h>
-#include <bootfs.h>
-#include <cons.h>
-#include <disklabel.h>
-#include <utils.h>
+#include "config.h"
+#include "aboot.h"
+#include "bootfs.h"
+#include "cons.h"
+#include "disklabel.h"
+#include "utils.h"
 
 #include <linux/elf.h>
 #include <asm/console.h>
@@ -97,7 +97,7 @@
 		dest = malloc(chunks[i].size);
 #else
 		dest = (char *) chunks[i].addr;
-#endif		      
+#endif
 
 		nread = cons_read(dev, dest, chunks[i].size,
 				  chunks[i].offset + ksect * SECT_SIZE);
@@ -115,7 +115,7 @@
 load_uncompressed (int fd)
 {
 	long nread, nblocks;
-	unsigned char *buf;
+	char *buf;
 	int i;
 
 	buf = malloc(bfs->blocksize);
@@ -159,7 +159,7 @@
 		dest = malloc(nblocks * bfs->blocksize);
 #else
 		dest = (char *) chunks[i].addr;
-#endif		      
+#endif
 
 		nread = (*bfs->bread)(fd, chunks[i].offset / bfs->blocksize,
 				      nblocks, dest);
@@ -476,13 +476,14 @@
 			      case 4: /* copy until EOL */
 				if (*p == '\n') {
 					*d = 0;
-					state=5;
+					state = 5;
 				} else {
 					*d++ = *p;
 				}
 				break;
 
 			      default:
+				break;
 			}
 			p++;
 		}
@@ -492,7 +493,7 @@
 	printf("get_default done\n");
 #endif
 
-	if (state != 5) {
+	if (state != 5 || *str == '\0') {
 		printf("aboot: could not find default config `%c'\n", num);
 		return -1;
 	}
@@ -522,38 +523,58 @@
 get_aboot_options (long dev)
 {
 	int preset      = 0; /* no preset */
-	int interactive = 0;  /* non-interactive */
+	int interactive = 0; /* non-interactive */
+	char *extra_args = NULL;
 
 #ifdef DEBUG
-	printf("get_aboot_options(%lx)\n",dev);
+	printf("get_aboot_options(%lx)\n", dev);
+	printf("kernel_args=\"%s\"\n",kernel_args);
 #endif
 
 	/* Forms of -flags argument from SRM */
 	if (kernel_args[0] >= '1' && kernel_args[0] <= '9'
 	    && kernel_args[1] == ':' && kernel_args[2]
-	    && !kernel_args[3])
+	    && (kernel_args[3] == '\0' || kernel_args[3] == ' '))
 	{
 		/* <partition>:<preset> - where <preset> is an entry
                    in /etc/aboot.conf (to be found on <partition>), or
                    'i' for interactive */
 		config_file_partition = kernel_args[0] - '0';
 		preset = kernel_args[2];
+		if (kernel_args[3]) {
+			extra_args = &kernel_args[3];
+			while (*extra_args == ' ') { extra_args++; }
+			if (*extra_args == '\0') extra_args = NULL;
+		}
 #ifdef DEBUG
 		printf("partition:preset = %ld:%c\n", config_file_partition,
 		       preset);
 #endif
-	} else if (kernel_args[0] && kernel_args[1] == '\0') {
+	} else if (kernel_args[0]
+		   && (kernel_args[1] == '\0' || kernel_args[1] == ' ')) {
 		/* Single character option, for Jensen and friends -
                    this is either a preconfigured entry in
-                   /etc/aboot.conf or 'i' for interactive*/
-		if (kernel_args[0] == 'i') interactive = 1;
-		else preset = kernel_args[0];
+                   /etc/aboot.conf or 'i' for interactive */
+		if (kernel_args[0] == 'i') {
+			interactive = 1;
+		} else {
+			preset = kernel_args[0];
+			if (kernel_args[1]) {
+			/* are there actually extra args? */
+				extra_args = &kernel_args[1];
+				while (*extra_args == ' ') { extra_args++; }
+				if (*extra_args == '\0') extra_args = NULL;
+			}
+		}
 	} else if (kernel_args[0] == '\0') {
 		interactive = 1;
 	} else {
 		/* attempt to parse the arguments given */
 	}
 
+#ifdef DEBUG
+	if (extra_args) printf("extra args: \"%s\"\n", extra_args);
+#endif
 
 	if (preset || interactive) {
 		char buf[256], *p;
@@ -617,6 +638,10 @@
 				} else {
 					printf("Please specify a number between 1 and 8\n");
 				}
+				/* note: config_file_partition refers to first
+				   quad long after aboot magic in boot sector
+				   (see head.S) and has an initial value of 1
+				   (see config.h) */
 				break;
 			case 'l':
 				if (!fs) {
@@ -672,6 +697,12 @@
 				break;
 			case '0' ... '9':
 				preset = buf[0];
+				p = strchr(buf, ' ');
+				while (p && *p == ' ') ++p;
+				if (p) {
+					strcpy(kernel_args, p);
+					extra_args = kernel_args;
+				}
 				break;
 			default:
 				break;
@@ -679,6 +710,13 @@
 			}
 		}
 
+		/* if we have extra args, append them to buf */
+		if (extra_args) {
+			p = buf; while (p && *p) p++;
+			*p++ = ' ';
+			strcpy(p, extra_args);
+		}
+
 		/* split on space into kernel + args */
 		p = strchr(buf, ' ');
 		if (p) {
@@ -690,6 +728,10 @@
 		strcpy(boot_file, buf);
 	}
 
+#ifdef DEBUG
+	printf("boot_file=\"%s\", kernel_args=\"%s\"\n", boot_file, kernel_args);
+#endif
+
 	{
 		/* parse off initrd= option from kernel_args if any */
 		char *p = kernel_args;
diff -Naur aboot-0.9b.org/doc/man/Makefile aboot-0.9b.new/doc/man/Makefile
--- aboot-0.9b.org/doc/man/Makefile	2003-01-14 20:12:14.000000000 +0000
+++ aboot-0.9b.new/doc/man/Makefile	2014-11-05 15:02:12.000000000 +0000
@@ -1,26 +1,27 @@
-# eventually this should have rules for recreating the man pages from the 
-# sgml source, but since this doesn't work on my machine right now i'm
-# leaving it out.
-
 # if this is a recursive make, and mandir was set in the top-level Makefile,
 # use that value. Otherwise default to /usr/man.
 
 ifeq ($(mandir),)
-MANDIR=/usr/man
+MANDIR	= /usr/man
 else
-MANDIR=$(mandir)
+MANDIR	= $(mandir)
 endif
-MAN5=$(MANDIR)/man5
-MAN8=$(MANDIR)/man8
+MAN5	= $(MANDIR)/man5
+MAN8	= $(MANDIR)/man8
 
 default: 
 
 install: 
 	install -d $(MAN5) $(MAN8)
 	install -c aboot.conf.5 $(MAN5)
-	install -c aboot.8 abootconf.8 e2writeboot.8 swriteboot.8 $(MAN8)	
+	cd $(MAN5) && ln -sf aboot.conf.5 aboot.cfg.5
+	install -c aboot.8 abootconf.8 e2writeboot.8 isomarkboot.8 sdisklabel.8 swriteboot.8 $(MAN8)	
+
 install-gz: install
 	gzip -f9 $(MAN5)/aboot.conf.5
 	gzip -f9 $(MAN8)/aboot.8 $(MAN8)/abootconf.8 $(MAN8)/e2writeboot.8 \
-		 $(MAN8)/swriteboot.8
+		 $(MAN8)/isomarkboot.8 $(MAN8)/sdisklabel.8 $(MAN8)/swriteboot.8
+
 install-gzip: install-gz
+
+.PHONY: default install install-gz install-gzip
diff -Naur aboot-0.9b.org/doc/man/aboot.8 aboot-0.9b.new/doc/man/aboot.8
--- aboot-0.9b.org/doc/man/aboot.8	2003-01-14 20:12:14.000000000 +0000
+++ aboot-0.9b.new/doc/man/aboot.8	2014-01-18 21:24:59.000000000 +0000
@@ -3,54 +3,55 @@
 .\" <http://shell.ipoline.com/~elmert/hacks/docbook2X/> 
 .\" Please send any bug reports, improvements, comments, patches, 
 .\" etc. to Steve Cheng <steve@ggi-project.org>.
-.TH "ABOOT" "8" "09 April 2001" "aboot" ""
+.TH "ABOOT" "8" "2014-01-16" "aboot" "System Administration"
 .SH NAME
-aboot \- The secondary boot loader for Linux/Alpha
-.SH "COPYRIGHT"
-.PP
-\fBaboot\fR is Copyright (C) 1996 Linus Torvalds, David Mosberger and Michael Schwingen (??)
+aboot \- secondary boot loader for Linux/Alpha
 .SH "DESCRIPTION"
 .PP
-
-\fBaboot\fR is the secondary boot loader needed if
-the Linux/Alpha system is booted via SRM. It is usually installed during
-system installation by \fBswriteboot\fR(8). 
+\fBaboot\fR is the secondary boot loader needed if the Linux/Alpha system is
+booted via SRM. It is usually installed during system installation by
+\fBswriteboot\fR(8). 
 .PP
 To automate the booting process predefined boot configurations can be stored
-in \fIetc/aboot.conf\fR(5). 
+in \fBaboot.conf\fR(5). \fBaboot\fR can also be used interactively by
+issuing:
 .PP
-\fBaboot\fR can also be used interactively by issuing
+\fBboot \fIdka0 \fB-flags "i"\fR
 .PP
-\fBboot \fIdka0 -fl "i"\fB\fR
+at the SRM prompt where \fIdka0\fR has to be replaced by the device used. 
 .PP
-at the SRM-Prompt where dka0 has to be replaced by the device used. 
-.PP
-In the interactive mode you can use the command h to show your current
-\fIetc/aboot.conf\fR and then the appropriate number
+In interactive mode you can use the command "l" to show the current
+\fBaboot.conf\fR(5) and then enter the appropriate number
 (or a complete boot command as in SRM) to boot Linux.
 .PP
-If you do not want to use the \fIetc/aboot.conf\fR as set
-up by \fBabootconf\fR you can explicitly tell 
-\fBaboot\fR where to look for \fIetc/aboot.conf\fR by prepending the number of the configuration with the proper
-partition, i.e. if your \fIetc/aboot.conf\fR is on your
-second partition and you want to boot the entry labled three you would
-issue
-.PP
-\fBboot \fIdqa -fl "2:3"\fB\fR
-.PP
-Note that this applies to Linux booting via SRM only as
-VMS, Tru64, *BSD and
-Windows NT each have their own secondary boot loader.
-Furthermore \fBaboot\fR is also not needed if the system is booted via
-\fBmilo\fR.
+If you do not want to use the \fBaboot.conf\fR(5) as set up by
+\fBabootconf\fR(8) you can explicitly tell \fBaboot\fR where to look for
+\fBaboot.conf\fR(5) by prepending the number of the configuration with the
+proper partition, i.e. if your \fBaboot.conf\fR(5) is on your second partition
+and you want to boot the entry labeled three you would issue:
+.PP
+\fBboot \fIdqa \fB-flags "2:3"\fR
+.PP
+Note that this applies to Linux booting via SRM only as OpenVMS, Tru64 Unix,
+*BSD and Windows NT each have their own secondary boot loader. Furthermore,
+\fBaboot\fR is also not needed if the system is booted via \fBmilo\fR(8).
+.SH "FILES"
+.PP
+\fI<root>/etc/aboot.conf\fR
+.P
+\fI<root>/aboot.conf\fR
+.P
+\fI<root>/etc/aboot.cfg\fR
+.P
+\fI<root>/aboot.cfg\fR
+.P
 .SH "AUTHOR"
 .PP
-This man page was written by Helge Kreutzmann
-<kreutzm@itp.uni-hannover.de> for the Debian GNU/Linux project.
-.SH "FILES"
+This man page was written by Helge Kreutzmann <kreutzm@itp.uni-hannover.de>
+for the Debian GNU/Linux project.
+.SH "COPYRIGHT"
 .PP
-\fIetc/aboot.conf\fR
+\fBaboot\fR is Copyright (C) 1996 Linus Torvalds, David Mosberger and Michael Schwingen (??)
 .SH "SEE ALSO"
 .PP
-\fBabootconf\fR(8), \fIaboot.conf\fR(5),
-\fBswriteboot\fR(8), Compaq SRM Manual
+\fBaboot.conf\fR(5), \fBabootconf\fR(8), \fBswriteboot\fR(8), SRM Console Reference
diff -Naur aboot-0.9b.org/doc/man/aboot.conf.5 aboot-0.9b.new/doc/man/aboot.conf.5
--- aboot-0.9b.org/doc/man/aboot.conf.5	2003-01-14 20:12:14.000000000 +0000
+++ aboot-0.9b.new/doc/man/aboot.conf.5	2014-01-17 13:33:00.000000000 +0000
@@ -3,59 +3,98 @@
 .\" <http://shell.ipoline.com/~elmert/hacks/docbook2X/> 
 .\" Please send any bug reports, improvements, comments, patches, 
 .\" etc. to Steve Cheng <steve@ggi-project.org>.
-.TH "ABOOT.CONF" "5" "09 April 2001" "aboot.conf" ""
+.\"
+.TH "ABOOT.CONF" "5" "2014-01-14" "aboot" "System Administration"
 .SH NAME
-aboot.conf \- The configuration file for aboot(8)
+aboot.conf, aboot.cfg \- configuration file for aboot boot loader
 .SH "DESCRIPTION"
 .PP
-
-\fIaboot.conf\fR contains a list of boot settings
-for \fBaboot\fR(8). Each boot setting
-has a unique number which can be supplied at the SRM-Prompt.
-.
+\fIaboot.conf\fR (or \fIaboot.cfg\fR, which is also accepted) contains a list
+of boot configurations for \fBaboot\fR(8).  Each configuration has a unique
+number which can be supplied at the SRM prompt.
+.PP
+\fIaboot.conf\fR must be located in the root directory or the directory
+\fIetc\fR of the partition where your kernels reside on unless you explicitly
+specify the partitions for your kernels (see below for details). So if you
+create a separate boot partition which is mounted under \fI/boot\fR, then
+\fIaboot.conf\fR should reside in either \fI/boot\fR or \fI/boot/etc\fR.
+.PP
+The example below shows an \fIaboot.conf\fR containing 4 boot configurations
+(\fI0\fR to \fI3\fR) where the kernel resides on a different partition (hda4)
+than the root filesystem (hda5). A fifth boot configuration (\fI8\fR)
+specifies that \fI/boot\fR (which holds a kernel) is on the same
+partition (hda6) as the root filesystem (hda6), and finally there is a sixth
+boot configuration (\fI9\fR) where the kernel resides on the same partition as
+where \fIaboot.conf\fR was read. The default partition from where
+\fIaboot.conf\fR is read can be changed with \fBabootconf\fR(8).
 .PP
-.SS "EXAMPLE ABOOT.CONF"
-.sp
 .RS
 .sp
 .nf
+#
+# aboot configurations
+#
 0:4/vmlinuz root=/dev/hda5
 1:4/vmlinuz root=/dev/hda5 single
 2:4/vmlinuz.old ro root=/dev/hda5
-8:6/boot/vmlinuz ro root=/dev/hda8
-.sp
+3:4/vmlinuz-2.4.9-32 root=/dev/sdc3 console=tty0
+8:6/boot/vmlinuz ro root=/dev/hda6
+9:/vmlinuz root=/dev/sda1
+-
 .fi
-.RE
 .sp
+.RE
 .PP
-The first number is a unique identifier for each boot configuration.
-To boot a certain configuration at the SRM-Prompt you would issue
-.PP
-\fBboot \fIdka0 -fl "0"\fB\fR
-.PP
-where dka0 has to be replaced by your boot device and the boot configuration
-(0 in this case) can be replaced by any defined in 
-\fIetc/aboot.conf\fR.
+Each line in \fIaboot.conf\fR begins with either a hash sign (#), a digit, or
+a minus sign (-) and must start at column 1 (lines with leading whitespace
+are ignored). The hash sign introduces a comment up until the end of the line,
+whereas the minus sign signifies the immediate end of the configuration file
+(in the example above, its use is actually redundant). Lines beginning with a
+digit define boot configurations.
+.PP
+The first number of a boot configuration definition is a unique identifier for
+the configuration and can be used at the \fBaboot\fR prompt to execute the
+configuration. Valid numbers are 0 to 9.
 .PP
 After the colon the number of the partition the kernel resides on is given. 1
-corresponds to A:, 2 to B: and so on. 
+corresponds to the BSD partition labeled "a", 2 corresponds to partition "b"
+and so on. Omitting this number causes the partition to be used where
+\fIaboot.conf\fR was read.
 .PP
 After the slash the name of the kernel to boot is given, including a possible
 path. If your kernel does not reside on a filesystem but is located directly
-after aboot at the beginning of the hard disk you would ommit the number, the
-slash and the kernel name.
-.PP
-Next the name of the partition to mount as / is given. Other kernel
-parameters follow as required.
-.PP
-The contents of this file can be shown before booting if necessary by
-using the interactive
-mode of \fBaboot\fR(8) (booting with the flag "i")
-and then issuing "h" at the \fBaboot\fR-prompt.
+after \fBaboot\fR at the beginning of the hard disk you would replace the
+partition number, the slash and the kernel name by a single minus sign. This
+is called a raw boot.
+.PP
+Next the name of the partition to mount as the root filesystem is given. Other
+kernel parameters follow as required.
+.PP
+To boot a certain configuration at the SRM prompt you would issue:
+.PP
+\fBboot \fIdka0 -flags "0"\fB\fR
+.PP
+where \fIdka0\fR has to be replaced by your boot device and the boot
+configuration (\fI0\fR in this case) can be replaced by any defined in the
+\fIaboot.conf\fR file.
+.PP
+The contents of \fIaboot.conf\fR can be shown before booting the kernel by
+using the interactive mode of \fBaboot\fR(8). Entering interactive mode is
+accomplished by specifying an "i" instead of a boot configuration number at
+the SRM prompt. Once at the \fBaboot\fR prompt issue the "l" command.
+.SH FILES
+\fI<root>/etc/aboot.conf\fR
+.P
+\fI<root>/aboot.conf\fR
+.P
+\fI<root>/etc/aboot.cfg\fR
+.P
+\fI<root>/aboot.cfg\fR
+.P
 .SH "AUTHOR"
 .PP
 This man page was written by Helge Kreutzmann
 <kreutzm@itp.uni-hannover.de> for the Debian GNU/Linux project.
 .SH "SEE ALSO"
 .PP
-\fBaboot\fR(8), \fBabootconf\fR(8), \fBswriteboot\fR(8), Compaq SRM Manual
+\fBaboot\fR(8), \fBabootconf\fR(8), \fBswriteboot\fR(8), SRM Console Reference
diff -Naur aboot-0.9b.org/doc/man/abootconf.8 aboot-0.9b.new/doc/man/abootconf.8
--- aboot-0.9b.org/doc/man/abootconf.8	2003-01-14 20:12:14.000000000 +0000
+++ aboot-0.9b.new/doc/man/abootconf.8	2014-01-17 13:31:38.000000000 +0000
@@ -3,78 +3,62 @@
 .\" <http://shell.ipoline.com/~elmert/hacks/docbook2X/> 
 .\" Please send any bug reports, improvements, comments, patches, 
 .\" etc. to Steve Cheng <steve@ggi-project.org>.
-.TH "ABOOTCONF" "8" "09 April 2001" "abootconf" ""
+.\"
+.TH "ABOOTCONF" "8" "2014-01-17" "abootconf" "System Administration"
 .SH NAME
-abootconf \- Configure the location of the configuration file for the secondary boot loader aboot(8) for Linux/Alpha.
+abootconf \- set or query partition of aboot.conf
 .SH "SYNOPSIS"
 .PP
-abootconf \fI/dev/xxx num\fR
-.SH "COPYRIGHT"
-.PP
-\fBabootconf\fR is Copyright (C) 1996 Linus Torvalds, David Mosberger and Michael Schwingen
-.SH "DESCRIPTIONS"
+\fBabootconf\fR \fIdevice\fR [\fInum\fR]
+.SH "DESCRIPTION"
 .PP
-
-\fBabootconf\fR is used to change the partition
-the alpha Linux boot loader \fBaboot\fR(8)
-
-looks for its configuration file in. The configuration file is stored
-in \fIetc/aboot.conf\fR(5)
-relative to the root of the filesystem in this partition.
-.PP
-\fBabootconf\fR requires the bootdevice
-(e.g. /dev/hdb, /dev/sda) and the partition
-to be used (e.g. 3). Thus if you want to boot from partition E: on your second
-SCSI disk you would enter
+\fBabootconf\fR is used to change the default partition the Linux/Alpha
+boot loader \fBaboot\fR(8) looks for its configuration file. In order to
+change the partition, \fBabootconf\fR requires a boot device specifying which
+device to operate on (e.g. \fI/dev/hdb\fR, \fI/dev/sda\fR) and a partition
+number on that device where \fBaboot.conf\fR(5) is located (e.g. 3). Partition
+numbers start at 1 and have one-on-one correspondence with BSD partition
+labels (i.e. 1 corresponds to partition "a", 2 corresponds to partition "b"
+etc). Thus if you want to boot from partition "e" on your second SCSI disk you
+would enter:
 .PP
 \fBabootconf \fI/dev/sdb 5\fB\fR
-.SH "NOTES"
 .PP
-\fBabootconf\fR is not needed if you are booting
-your alpha system via \fBmilo\fR. 
+For each disk, only one such default partition can be set, so changing it with
+\fBabootconf\fR overwrites the previous setting. Note that an
+\fBaboot.conf\fR(5) on another partition on that same disk is still accessible
+by using the command "p" at the \fBaboot\fR(8) prompt.
+.PP
+To show from which partition \fBaboot\fR(8) currently reads
+\fBaboot.conf\fR(5), simply omit the \fInum\fR argument.
+.SH "NOTES"
 .PP
-For each disk one partition can be activated to contain the configuration
-for \fBaboot\fR(8) which is located in
-\fIetc/aboot.conf\fR(5).
-The disk chosen to boot from is selected at
-the SRM prompt as the second argument, e.g.
-.PP
-\fBboot \fIdqa\fB\fR
-.PP
-to boot from your first ide hard disk. See the Compaq SRM-Manual and
-\fBaboot\fR(8)
-for details.
-.PP
-\fBaboot\fR(8) can load a kernel from an
-arbitrary partition and can even use a different
-root partition than the one \fIetc/aboot.conf\fR
-belongs to. Hence you would usually
-set up one \fIetc/aboot.conf\fR with all combinations and
-would not require \fBabootconf\fR except for initial
-set up. You can then
-boot the requested
-Linux kernel by giving the appropriate flags at the SRM prompt, e.g. to boot
-the entry labled 2 you would use
-.PP
-\fBboot \fIdqa -fl "2"\fB\fR
-.PP
-See the Compaq SRM manual and \fIaboot.conf\fR(5)
-for details.
+\fBabootconf\fR is not needed if you are booting your Alpha system via
+\fBmilo\fR(8).
 .PP
-To show the current setting simply omit the last argument (i.e. the partition
-number).
+\fBaboot\fR(8) can load a kernel from an arbitrary partition and can even use
+a different root partition than the one \fBaboot.conf\fR(5) is stored on.
+Hence you would usually set up one \fBaboot.conf\fR(5) with all combinations
+and would not require \fBabootconf\fR except for initial set up.
 .PP
-Not that you have to rerun \fBabootconf\fR if you updated
-\fBaboot\fR.
+Note that you have to rerun \fBabootconf\fR if you updated the \fBaboot\fR(8)
+boot loader.
+.SH "FILES"
 .PP
-Note that this applies to Linux only as VMS, Tru64, *BSD and
-Windows NT each have their own secondary boot loader.
+\fI<root>/etc/aboot.conf\fR
+.P
+\fI<root>/aboot.conf\fR
+.P
+\fI<root>/etc/aboot.cfg\fR
+.P
+\fI<root>/aboot.cfg\fR
+.P
 .SH "AUTHOR"
 .PP
 This man page was written by Helge Kreutzmann <kreutzm@itp.uni-hannover.de> for the Debian GNU/Linux project.
-.SH "FILES"
+.SH "COPYRIGHT"
 .PP
-\fIetc/aboot.conf\fR
+\fBabootconf\fR is Copyright (C) 1996 Linus Torvalds, David Mosberger-Tang and Michael Schwingen
 .SH "SEE ALSO"
 .PP
-\fBaboot\fR(8), \fBswriteboot\fR(8), \fIaboot.conf\fR(5), Compaq SRM Manual
+\fBaboot.conf\fR(5), \fBaboot\fR(8), \fBswriteboot\fR(8), SRM Console Reference
diff -Naur aboot-0.9b.org/doc/man/e2writeboot.8 aboot-0.9b.new/doc/man/e2writeboot.8
--- aboot-0.9b.org/doc/man/e2writeboot.8	2003-01-14 20:12:14.000000000 +0000
+++ aboot-0.9b.new/doc/man/e2writeboot.8	2014-01-17 13:57:14.000000000 +0000
@@ -1,42 +1,41 @@
 .\" e2writeboot - Write secondary SRM bootloader to ext2 filesystem.
-.TH e2writeboot 8 "17 January 1995" "David Mosberger" ""
+.TH e2writeboot 8 "2014-01-17" "David Mosberger-Tang" "System Administration"
 .SH NAME
-e2writeboot \- Write secondary SRM bootloader to ext2 filesystem.
+e2writeboot \- write secondary SRM boot loader to ext2 filesystem
 .SH SYNOPSIS
-\fBe2writeboot\fP <ext2fs> <bootloader>
+\fBe2writeboot\fP <\fIext2fs\fR> <\fIboot-loader\fR>
 .SH DESCRIPTION
 
 \fBe2writeboot\fP can be used to write a secondary bootstrap loader to
 an ext2 formatted filesystem (normally on a floppy disk).  The loader
 is written in a way that allows the SRM firmware to boot from the
-filesystem (SRM is the firmware that is also used to boot
-\fBCompaq Tru64\fP, OpenVMS and *BSD).  Specifically, the
-loader is written to a physically
-contiguous range of sectors and the first sector is updated such that
-the SRM firmware can find the boot loader.  The loader is always
-stored with filename \fBlinuxboot\fP and if such a file already
+filesystem (SRM is the firmware that is also used to boot Tru64 Unix,
+OpenVMS and *BSD).  Specifically, the loader is written to occupy a
+physically contiguous range of sectors and the first sector is updated
+such that the SRM firmware can find the boot loader.  The loader is
+always stored with filename \fIlinuxboot\fP and if such a file already
 exists, it will be overwritten unconditionally.  This command may
 fail if the filesystem is highly fragmented.  If so, re-format the
-filesystem with \fBmke2fs\fP (this will destroy the existing contents
+filesystem with \fBmke2fs\fP(8) (this will destroy the existing contents
 of the filesystem, so use this with care).
 
 .P
-The \fI<ext2fs>\fP argument specifies the filesystem or special device
-to which the \fI<bootloader>\fP file should be written to.  The boot
+The <\fIext2fs\fP> argument specifies the filesystem or special device
+to which the <\fIboot-loader\fP> file should be written to.  The boot
 loader file must be an ECOFF object file.  A typical command to make a
 floppy disk bootable with the \fIaboot\fP loader is shown below:
 
-.I "e2writeboot /dev/fd0 aboot"
+\fBe2writeboot \fI/dev/fd0 aboot\fR
 
-.nf
-.SH SEE ALSO
-.IR aboot (8) ,
-.IR mke2fs (8) ,
-.IR swriteboot (8)
-.nf
 .SH AUTHORS
 .nf
 Jim Paradis <paradis@amt.tay1.dec.com>
-Jay Estabrook <jestabro@amt.tay1.dec.com>
-David Mosberger-Tang <davidm@azstarnet.com>
+Jay Estabrook <Jay.Estabrook@hp.com>
+David Mosberger-Tang <David.Mosberger@acm.org>
 .fi
+.nf
+.SH SEE ALSO
+.BR aboot (8),
+.BR mke2fs (8),
+.BR swriteboot (8)
+.nf
diff -Naur aboot-0.9b.org/doc/man/isomarkboot.8 aboot-0.9b.new/doc/man/isomarkboot.8
--- aboot-0.9b.org/doc/man/isomarkboot.8	2003-01-14 20:12:14.000000000 +0000
+++ aboot-0.9b.new/doc/man/isomarkboot.8	2014-01-17 15:42:46.000000000 +0000
@@ -3,56 +3,52 @@
 .\" <http://shell.ipoline.com/~elmert/hacks/docbook2X/> 
 .\" Please send any bug reports, improvements, comments, patches, 
 .\" etc. to Steve Cheng <steve@ggi-project.org>.
-.TH "ISOMARKBOOT" "8" "11 Juli 2002" "isomarkboot" ""
+.\"
+.TH "ISOMARKBOOT" "8" "2014-01-17" "isomarkboot" "System Administration"
 .SH NAME
-isomarkboot \- Create bootable CD-ROMs for Linux/Alpha systems.
+isomarkboot \- create bootable CD-ROMs for Linux/Alpha systems
 .SH "SYNOPSIS"
 .PP
-isomarkboot \fI/dev/xxx path/to/bootlx [path/to/root.bin]\fR
-.SH "COPYRIGHT"
+\fBisomarkboot\fR \fIdevice\fR \fIboot-loader\fR [\fIrootfs-image\fR]
+.SH "DESCRIPTION"
 .PP
-\fBisomarkboot\fR is Copyright (C) 1996 David Mosberger-Tang
-.SH "DESCRIPTIONS"
+\fBisomarkboot\fR enables ISO images created with \fBmkisofs\fR(8) or
+retrieved from the net to be booted on Linux/Alpha systems.
 .PP
-
-\fBisomarkboot\fR
-enables ISO images created with \fBmkisofs\fR(8) or
-retrieved from the net
-to be booted on Linux/Alpha systems.
-.PP
-First you have to prepare your ISO image and mount it loopback on
-\fI/dev/xxx\fR (typically \fI/dev/loop0\fR)
-(see \fBmount\fR(8) for details). 
-.PP
-Next you need to locate the aboot-loader (called \fIbootlx\fR)
-and the ram disk image containing the root file system (the latter is optional
-but usually sensible to specify) which is often called 
-\fIroot.bin\fR within your ISO image.
+First you have to prepare your ISO image and mount it via loopback
+\fIloop-device\fR (typically \fI/dev/loop0\fR) (see \fBmount\fR(8) for
+details).
+.PP
+Next you need to locate the \fBaboot\fR boot loader (typically called
+\fIbootlx\fR) and the RAM disk image containing the root filesystem which is
+often called \fIroot.bin\fR within your ISO image. The latter is optional but
+usually sensible to specify.
 .PP
 Finally enable the image to be booted:
 .PP
-\fBisomarkboot \fI/dev/xxx path/to/bootlx path/to/root.bin\fB\fR
+\fBisomarkboot \fI/dev/loop0 boot/bootlx boot/root.bin\fB\fR
 .PP
-A typical location of \fIbootlx\fR on the disk image is
-\fIboot/bootlx\fR. The path of \fIbootlx\fR
-and \fIroot.bin\fR are relative to the root of the image. If
-your image is not mounted you have to replace \fI/dev/xxx\fR
-with the path to the image.
+A typical location of \fIbootlx\fR on the disk image is \fIboot/bootlx\fR.
+The paths of \fIboot-loader\fR argument and the \fIrootfs-image\fR argument
+are relative to the root of the ISO image. If your image is not mounted you
+have to replace \fIdevice\fR with the path to the image.
 .PP
-Finally you have to burn the CD using e.g.
-\fBxcdroast\fR after unmounting the image.
-.SH "BUGS"
-.PP
-\fBisomarkboot\fR is currently only available on 
-Linux/Alpha systems though it can be compiled and used with minor
-modifications on other platforms as well.
+Finally you have to burn the CD using e.g. \fBxcdroast\fR(1) after unmounting
+the image.
 .SH "NOTES"
 .PP
-\fBisomarkboot\fR is capable of handling symlinks
-within the image.
+\fBisomarkboot\fR is capable of handling symlinks within the image.
+.SH "BUGS"
+.PP
+\fBisomarkboot\fR is not heavily tested on architectures other than
+Linux/Alpha systems, though it compiles (with light patches). Please
+report bugs if you experience them.
 .SH "AUTHOR"
 .PP
 This man page was written by Helge Kreutzmann <kreutzm@itp.uni-hannover.de> for the Debian GNU/Linux project but may be used by others.
+.SH "COPYRIGHT"
+.PP
+\fBisomarkboot\fR is Copyright (C) 1996 David Mosberger-Tang
 .SH "SEE ALSO"
 .PP
 \fBaboot\fR(8), \fBmkisofs\fR(8)
diff -Naur aboot-0.9b.org/doc/man/sdisklabel.8 aboot-0.9b.new/doc/man/sdisklabel.8
--- aboot-0.9b.org/doc/man/sdisklabel.8	2003-01-14 20:12:14.000000000 +0000
+++ aboot-0.9b.new/doc/man/sdisklabel.8	2014-01-17 20:33:27.000000000 +0000
@@ -3,83 +3,72 @@
 .\" <http://shell.ipoline.com/~elmert/hacks/docbook2X/> 
 .\" Please send any bug reports, improvements, comments, patches, 
 .\" etc. to Steve Cheng <steve@ggi-project.org>.
-.TH "SDISKLABEL" "8" "04 September 2002" "sdisklabel" ""
+.\"
+.TH "SDISKLABEL" "8" "2014-01-17" "aboot" "System Administration"
 .SH NAME
-sdisklabel \- Create/modify disklabels on Linux/Alpha systems
+sdisklabel \- create/modify disk labels on Linux/Alpha systems
 .SH "SYNOPSIS"
 .PP
-sdisklabel \fIdrive [print|zero|sum]\fR
+\fBsdisklabel\fR \fIdrive\fR [\fBprint\fR|\fBzero\fR|\fBsum\fR]
 .PP
-sdisklabel \fIdrive size partsize\fR
+\fBsdisklabel\fR \fIdrive\fR \fBsize\fR \fIpartsize\fR
 .PP
-sdisklabel \fIdrive partnum offset size parttype\fR
-.SH "DESCRIPTIONS"
+\fBsdisklabel\fR \fIdrive [\fBforce\fR] partnum offset size parttype\fR
+.SH "DESCRIPTION"
 .PP
-
-\fBsdisklabel\fR
-can be used to create partitions (called disklabels) on Linux/Alpha
-systems. You \fBmust\fR use disklabels instead of the
-DOS type
+\fBsdisklabel\fR can be used to create partitions (called disk labels) on
+Linux/Alpha systems. You \fBmust\fR use disk labels instead of the DOS type
 partitioning scheme on any hard disk which you want to boot from via SRM or
-which you want to share with HP Tru64.
-If you instead are booting from \fBmilo\fR
-then you \fBmust not\fR use disklabels on your boot hard disk.
-.PP
-Even if you are using disklabels, it is recommended to use 
-\fBfdisk\fR(8) instead
-of \fBsdisklabel\fR.
-.PP
-\fBsdisklabel\fR also assumes 
-you have a SCSI disk with 512-byte sectors,
-though it should work fine on an IDE drive as well. All sizes are
-specified on the command line in sectors.
+which you want to share with Tru64 Unix.
+If you instead are booting from \fBmilo\fR(8) then you \fBmust not\fR use
+disk labels on your boot hard disk.
+.PP
+Even if you are using disk labels, it is recommended to use \fBfdisk\fR(8)
+instead of \fBsdisklabel\fR.
+.PP
+\fBsdisklabel\fR also assumes you have a SCSI disk with 512-byte sectors,
+though it should work fine on an IDE drive as well. All sizes specified on
+the command line are in sectors.
 .PP
 There are 8 partitions in total which are numbered from 0 to 7. They
-correspond to BSD disklabels A to H.
-Partitions have to be added sequentially, as 
-\fBsdisklabel\fR won't let
-you leave empty partitions unlike many BSD disklabel programs. If you
-want this (or if you want overlapping disk labels) 
-use \fBfdisk\fR(8) instead.
+correspond to BSD disk labels A to H.
+Partitions have to be added sequentially, as \fBsdisklabel\fR won't let
+you leave empty partitions unlike many BSD disk label programs. If you
+want this (or if you want overlapping disk labels) use \fBfdisk\fR(8) instead.
 .PP
 First off, if you have an invalid disk label (you've never run 
-\fBsdisklabel\fR on this disk
-before) you have to issue
+\fBsdisklabel\fR on this disk before) you have to issue:
+.PP
+\fBsdisklabel \fI/dev/sda \fBzero\fR
 .PP
-\fBsdisklabel \fI/dev/sda zero\fB\fR
+\fI/dev/sda\fR is the device you're partitioning, so substitute the device
+appropriate for your situation.
 .PP
-(\fI/dev/sda\fR is the device you're partitioning, 
-substitute as appropriate).
+This zeros out your disk label. Only do this if you really want to zero your
+disk label. It just does it; it doesn't ask, or warn, or anything.
 .PP
-This zeros out your disk label. Only do this if you really want to
-zero your disk label. It just does it; it doesn't ask, or warn, or
-anything.
-.PP
-The program also probably printed out the size of your disk in Kb. If
-it was wrong, you now get to use the "\fIsize xxx\fR"
-option along with the
-rest of these commands. The size isn't critical, it's just used to try
-and make sure you don't go past the end of the disk.
+The program also probably printed out the size of your disk in kB. If it was
+wrong, you now get to use the "\fBsize \fIpartsize\fR" option along with the
+rest of these commands. The size isn't critical, it's just used to try and
+make sure you don't go past the end of the disk.
 .PP
-Next, add your first partition. This \fBdoesn't\fR
-start from 0, as you
+Next, add your first partition. This \fBdoesn't\fR start from 0, as you
 have to leave room for the boot loader and other stuff. 256K (or 512
 sectors) will be enough.
 .PP
-Let's pretend that you want to make a 250000 Kb partition starting
-from sector offset 512:
+Let's pretend that you want to make a 250000 kB partition starting from
+sector offset 512:
 .PP
-\fBsdisklabel \fI/dev/sda 0 512 500000 8 print\fB\fR
+\fBsdisklabel \fI/dev/sda 0 512 500000 8 \fBprint\fR
 .PP
-The last number is the filesystem type, and is currently 8 for ext2fs
-filesystems. (A different number would be used to specify an
-Tru64
-partition, for example).
+The last number is the filesystem type, and is currently 8 for ext2
+filesystems. A different number would be used to specify an Tru64 Unix
+partition, for example.
 .PP
 If all was successful, the program should print out the partition (the
-last keyword, "print", specifies that it should print the partition
+last keyword, \fBprint\fR, specifies that it should print the partition
 after modifying it with the previous command), and you should see
-something like
+something like:
 .PP
 .sp
 .RS
@@ -97,46 +86,51 @@
 .sp
 .PP
 You can then add the next partition, which would be partition 1.
-To add a second partition that is 200000 Kb long, you'd run
+To add a second partition that is 200000 kB long, you'd run:
 .PP
-\fBsdisklabel \fI/dev/sda 1 512256 400000 8 print\fB\fR
+\fBsdisklabel \fI/dev/sda 1 512256 400000 8 \fBprint\fR
 .PP
 And both partitions would then be printed out.
 .PP
 If for some reason the size got determined incorrectly, you'd do
-instead
+instead:
 .PP
-\fBsdisklabel \fI/dev/sda size 528870 0 512 400000 8 print\fB\fR
+\fBsdisklabel \fI/dev/sda \fBsize \fI528870 0 512 400000 8 \fBprint\fR
 .PP
-The size option should come immediately after the device name, and the
-size is the total # of sectors on the drive.
-.SH "BUGS"
-.PP
-\fBsdisklabel\fR does not check for all errors, so
-use with care.
+The \fBsize\fR command should come immediately after the device name
+(\fI/dev/sda\fR), and the size is the total number of sectors on the drive.
 .SH "NOTES"
 .PP
-If you want to share the disk with HP Tru64
-(OSF/1) it is recommended to
-use the Tru64 
-partitioning tools to prepare the disk.
-.PP
-To actually boot from the freshly labeled disk you also need to install
-a boot strap as well, see
-\fBaboot\fR(8) and \fBswriteboot\fR(8)
-for details.
-.PP
-The print command may be placed before or after any other command.
-.PP
-In case you do want to leave empty partitions or create lables wich
-extend beyond the end of the disk (e.g. when you know 
-\fBsdisklabel\fR is reporting a wrong size) then
-use can use the \fIforce\fR switch on the command line.
+If you want to share the disk with Tru64 Unix it is recommended to use the
+Tru64 Unix partitioning tools to prepare the disk.
+.PP
+To actually boot from the freshly labeled disk, you also need to install a
+bootstrap, see \fBaboot\fR(8) and \fBswriteboot\fR(8) for details.
+.PP
+The \fBprint\fR command may be placed before or after any other command.
+.PP
+In case you do want to leave empty partitions or create labels which
+extend beyond the end of the disk (e.g., when you know \fBsdisklabel\fR is
+reporting a wrong size) then you can use the \fBforce\fR command on the
+command line.
+.SH "BUGS"
+.PP
+\fBsdisklabel\fR does not check for all errors, so use with care.
 .SH "AUTHOR"
 .PP
-This man page was written by Helge Kreutzmann <kreutzm@itp.uni-hannover.de> for the Debian GNU/Linux project but may be used by others. It is
-heavily based on the \fIREADME\fR provided along with the
-\fBsdisklabel\fR source.
+This man page was written by Helge Kreutzmann <kreutzm@itp.uni-hannover.de>
+for the Debian GNU/Linux project but may be used by others. It is heavily
+based on the \fIREADME\fR provided along with the \fBsdisklabel\fR source.
+.SH "COPYRIGHT"
+.PP
+\fBsdisklabel\fR is Copyright (C) by Red Hat Inc. The author of this man page
+tried to track down the original author, but was unable to do so. A final
+Bugzilla entry with RedHat yielded the following reply:
+.sp
+I can't track down a Bob Manson (and I cannot find any record of his
+association with Red Hat in the aboot sources), but any work he did on behalf
+of Red Hat would be property of Red Hat, and you can consider all our changes
+to be release under the GPL the same as the rest of the aboot package.
 .SH "SEE ALSO"
 .PP
-\fBfdisk\fR(8), \fBaboot\fR(8), \fBswriteboot\fR(8)
+\fBaboot\fR(8), \fBfdisk\fR(8), \fBswriteboot\fR(8)
diff -Naur aboot-0.9b.org/doc/man/swriteboot.8 aboot-0.9b.new/doc/man/swriteboot.8
--- aboot-0.9b.org/doc/man/swriteboot.8	2003-01-14 20:12:14.000000000 +0000
+++ aboot-0.9b.new/doc/man/swriteboot.8	2014-01-19 17:00:50.000000000 +0000
@@ -1,52 +1,59 @@
-.\" sdisklabel - Write secondary SRM bootloader to harddisk
-.TH swriteboot 8 "17 January 1995" "David Mosberger" ""
+.\" sdisklabel - write secondary SRM bootloader to harddisk
+.\"
+.TH SWRITEBOOT 8 "2014-01-17" "aboot" "System Administration"
 .SH NAME
-swriteboot \- Write secondary SRM bootloader to harddisk.
+swriteboot \- write secondary SRM boot loader to harddisk
 .SH SYNOPSIS
-\fBswriteboot\fP [-v] [-f#] <dev> <bootloader> [kernel]
+\fBswriteboot\fP [\fB-c\fR \fIpartnum\fR] [\fB-f\fR \fIpartnum\fR] [\fB-v\fR] \fIdev boot-loader\fR [\fIkernel\fR]
 .SH DESCRIPTION
 
-\fBswriteboot\fP can be used to write a secondary bootstrap loader
-and - optionally - a kernel to
-a harddisk.  The loader is written in a way that allows the SRM
-firmware to boot from that disk (SRM is the firmware that is also used
-to boot \fBCompaq Tru64\fP, OpenVMS and *BSD).
-Specifically, the loader is written to
-a physically contiguous range of sectors starting at sector 2 and the
-first sector is updated such that the SRM firmware can find the boot
-loader.  \fBswriteboot\fP may fail if the bootstrap loader is too big
-to fit into the sectors reserved for boot purposes.  It is therefore
-suggested to reserve the first 512 sectors of a harddisk for boot
-purposes.  This will leave 256KB of space for a secondary bootstrap
-loader which should be plenty (currently, the \fBaboot\fP(8) bootstrap
-loader is about 80KB large). Use more if you want to have a kernel in this
-area, too - 2MB should be sufficient in this case.
-
+\fBswriteboot\fP can be used to write a secondary bootstrap loader and -
+optionally - a kernel to a harddisk.  The loader is written in a way that
+allows the SRM firmware to boot from that disk (SRM is the firmware that is
+also used to boot Tru64 Unix, OpenVMS and *BSD).
+Specifically, the loader is written to a physically contiguous range of
+sectors starting at sector 2 and the first sector is updated such that the
+SRM firmware can find the boot loader.  \fBswriteboot\fP may fail if the
+bootstrap loader is too big to fit into the sectors reserved for boot
+purposes.  It is therefore suggested to reserve the first 512 sectors of a
+harddisk for boot purposes.  This will leave 256 kB of space for a secondary
+bootstrap loader which should be plenty (currently, the \fBaboot\fP(8) bootstrap
+loader is about 90 kB large). Use more if you want to have a kernel in this
+area too - 2 MB should be sufficient in this case.
 .P
-The \fI<dev>\fP argument specifies the special device to which the
-\fI<bootloader>\fP file should be written to.  The boot loader file
+The \fIdev\fP argument specifies the special device to which the
+\fIboot-loader\fP file should be written to.  The boot loader file
 must be a header-less image (not an object file) containing the raw
-contents of the text, data, and bss sections.  A typical command to
-make SCSI disk 0 bootable with the \fIaboot\fP(8) loader is shown
-below:
-
-.I "e2writeboot /dev/fd0 bootlx"
-
+contents of the text, data, and bss sections.
 .P
-The \fI-v\fP option makes \fBswriteboot\fP be a bit more verbose.
-.P
-The \fI-f#\fP option tells \fBswriteboot\fP to ignore an overlap of the boot area with
-partition \fI#\fP.
+A typical command to make SCSI disk 0 bootable with the \fIaboot\fP(8)
+boot loader is shown below:
 
-.nf
-.SH SEE ALSO
-.IR aboot (8) ,
-.IR abootconf (8) ,
-.IR mke2fs (8) ,
-.IR e2writeboot (8)
-.nf
+\fBswriteboot\fR \fI/dev/sda bootlx\fR
+.SH OPTIONS
+.TP
+\fB-f\fP \fIpartnum\fR
+This option tells \fBswriteboot\fP to ignore an overlap of the boot area with
+partition \fIpartnum\fP. Valid numbers are 1 to 8.
+.TP
+\fB-c\fP \fIpartnum\fR
+Explicitly tell \fBswriteboot\fP the boot partition. If this option is
+missing, then \fBswriteboot\fP tries to autodetect the boot partition if
+possible. Note that you can set the boot partition later on with
+\fBabootconf\fP(8) as well. \fIpartnum\fR ranges between 1 and 8.
+.TP
+\fB-v\fP
+Be a bit more verbose.
 .SH AUTHORS
 .nf
 Bob Manson <manson@magnus.acs.ohio-state.edu>
-Michael Schwingen <m.schwingen@stochastik.rwth-aachen.de>
+Michael Schwingen <michael@schwingen.org>
+Helge Kreutzmann <kreutzm@itp.uni-hannover.de>
 .fi
+.nf
+.SH SEE ALSO
+.BR aboot (8),
+.BR abootconf (8),
+.BR e2writeboot (8),
+.BR mke2fs (8)
+.nf
diff -Naur aboot-0.9b.org/fs/ext2.c aboot-0.9b.new/fs/ext2.c
--- aboot-0.9b.org/fs/ext2.c	2002-09-18 19:48:21.000000000 +0000
+++ aboot-0.9b.new/fs/ext2.c	2014-11-06 20:26:53.000000000 +0000
@@ -26,8 +26,8 @@
 #else /* Linux 2.4.0 or later */
 
 #  undef __KERNEL__
-#  include <linux/ext2_fs.h>
 #  include <linux/fs.h>
+#  include <linux/ext2_fs.h>
 #  define __KERNEL__
 
 #endif
@@ -146,7 +146,7 @@
 
 	ip = 0;
 	for (i = 0; i < MAX_OPEN_FILES; i++) {
-#ifdef DEBUG
+#ifdef DEBUG_EXT2
 		printf("ext2_iget: looping, entry %d inode %d free %d\n",
 		       i, inode_table[i].inumber, inode_table[i].free);
 #endif
@@ -162,14 +162,14 @@
 	}
 
 	group = (ino-1) / sb.s_inodes_per_group;
-#ifdef DEBUG
+#ifdef DEBUG_EXT2
 	printf("group is %d\n", group);
 #endif
 	offset = partition_offset
 		+ ((long) gds[group].bg_inode_table * (long)ext2fs.blocksize)
 		+ (((ino - 1) % EXT2_INODES_PER_GROUP(&sb))
 		   * EXT2_INODE_SIZE(&sb));
-#ifdef DEBUG
+#ifdef DEBUG_EXT2
 	printf("ext2_iget: reading %ld bytes at offset %ld "
 	       "(%ld + (%d * %d) + ((%d) %% %d) * %d) "
 	       "(inode %d -> table %d)\n", 
@@ -204,7 +204,7 @@
 	/* Find and free the inode table slot we used... */
 	itp = (struct inode_table_entry *)ip;
 
-#ifdef DEBUG
+#ifdef DEBUG_EXT2
 	printf("ext2_iput: inode %d table %d\n", itp->inumber,
 	       (int) (itp - inode_table));
 #endif
@@ -224,7 +224,6 @@
  */
 static int ext2_blkno(struct ext2_inode *ip, int blkoff)
 {
-	unsigned int *lp;
 	unsigned int *ilp;
 	unsigned int *dlp;
 	int blkno;
@@ -234,7 +233,6 @@
 
 	ilp = (unsigned int *)iblkbuf;
 	dlp = (unsigned int *)diblkbuf;
-	lp = (unsigned int *)blkbuf;
 
 	/* If it's a direct block, it's easy! */
 	if (blkoff <= directlim) {
@@ -347,7 +345,7 @@
 		} else {
 			/* Read it for real */
 			offset = partition_offset + (long) dev_blkno* (long) ext2fs.blocksize;
-#ifdef DEBUG
+#ifdef DEBUG_EXT2
 			printf("ext2_bread: reading %ld bytes at offset %ld\n",
 			       nbytes, offset);
 #endif
@@ -379,7 +377,7 @@
 			return NULL;
 	}
 
-#ifdef DEBUG
+#ifdef DEBUG_EXT2
 	printf("ext2_readdiri: blkoffset %d diroffset %d len %d\n",
 		blockoffset, diroffset, dir_inode->i_size);
 #endif
@@ -387,7 +385,7 @@
 		diroffset += ext2fs.blocksize;
 		if (diroffset >= dir_inode->i_size)
 			return NULL;
-#ifdef DEBUG
+#ifdef DEBUG_EXT2
 		printf("ext2_readdiri: reading block at %d\n",
 			diroffset);
 #endif
@@ -401,7 +399,7 @@
 
 	dp = (struct ext2_dir_entry_2 *) (blkbuf + blockoffset);
 	blockoffset += dp->rec_len;
-#ifdef DEBUG
+#ifdef DEBUG_EXT2
 	printf("ext2_readdiri: returning %p = %.*s\n", dp, dp->name_len, dp->name);
 #endif
 	return dp;
@@ -443,19 +441,19 @@
 				     component_length) == 0))
 			{
 				/* Found it! */
-#ifdef DEBUG
+#ifdef DEBUG_EXT2
 				printf("ext2_namei: found entry %s\n",
 					component);
 #endif
 				next_ino = dp->inode;
 				break;
 			}
-#ifdef DEBUG
+#ifdef DEBUG_EXT2
 			printf("ext2_namei: looping\n");
 #endif
 		}
 	
-#ifdef DEBUG
+#ifdef DEBUG_EXT2
 		printf("ext2_namei: next_ino = %d\n", next_ino);
 #endif
 
@@ -557,13 +555,13 @@
 		linkto = blkbuf;
 		if (ext2_breadi(from, 0, 1, blkbuf) == -1)
 			return NULL;
-#ifdef DEBUG
+#ifdef DEBUG_EXT2
 		printf("long link!\n");
 #endif
 	} else {
 		linkto = (char*)from->i_block;
 	}
-#ifdef DEBUG
+#ifdef DEBUG_EXT2
 	printf("symlink to %s\n", linkto);
 #endif
 
@@ -575,7 +573,7 @@
 			strncpy(fullname, base, end - base + 1);
 			fullname[end - base + 1] = '\0';
 			strcat(fullname, linkto);
-#ifdef DEBUG
+#ifdef DEBUG_EXT2
 			printf("resolved to %s\n", fullname);
 #endif
 			return ext2_namei(fullname);
diff -Naur aboot-0.9b.org/fs/ufs.c aboot-0.9b.new/fs/ufs.c
--- aboot-0.9b.org/fs/ufs.c	2001-10-08 23:03:52.000000000 +0000
+++ aboot-0.9b.new/fs/ufs.c	2014-11-06 20:15:58.000000000 +0000
@@ -26,6 +26,9 @@
 /*
  * HISTORY
  * $Log: ufs.c,v $
+ * Revision 1.1.1.1  2004/04/25 20:38:19  vorlon
+ * Initial import of upstream source
+ *
  * Revision 1.1.1.1  2001/10/08 23:03:52  wgwoods
  * initial import of CVS source from alphalinux.org, plus a couple bugfixes
  *
diff -Naur aboot-0.9b.org/include/cons.h aboot-0.9b.new/include/cons.h
--- aboot-0.9b.org/include/cons.h	2001-10-08 23:03:52.000000000 +0000
+++ aboot-0.9b.new/include/cons.h	2014-11-06 20:48:02.000000000 +0000
@@ -14,6 +14,8 @@
 #define cons_read(d,b,c,o) ({ lseek(d, o, 0); read(d,b,c);})
 #define cons_putchar(c)    putchar(c)
 #define cons_getchar()     getchar()
+#define cons_open_console()
+#define cons_close_console()
 #else
 extern void cons_init (void);
 extern long cons_getenv (long index, char *envval, long maxlen);
@@ -23,6 +25,8 @@
 extern long cons_read (long dev, void *buf, long count, long offset);
 extern void cons_putchar(char c);
 extern int cons_getchar(void);
+extern void cons_open_console(void);
+extern void cons_close_console(void);
 #endif
 
 /* this isn't in the kernel for some reason */
diff -Naur aboot-0.9b.org/include/isolib.h aboot-0.9b.new/include/isolib.h
--- aboot-0.9b.org/include/isolib.h	2001-10-08 23:03:52.000000000 +0000
+++ aboot-0.9b.new/include/isolib.h	2014-11-06 21:00:35.000000000 +0000
@@ -7,7 +7,11 @@
 # define fd_set kernel_fd_set
 #endif
 
-#include <asm/stat.h>
+#ifdef __KERNEL__
+# include <asm/stat.h>
+#else
+# include <sys/stat.h>
+#endif
 
 extern int  iso_read_super (void * data, int quiet);
 extern int  iso_open (const char * filename);
diff -Naur aboot-0.9b.org/include/setjmp.h aboot-0.9b.new/include/setjmp.h
--- aboot-0.9b.org/include/setjmp.h	2001-10-08 23:03:52.000000000 +0000
+++ aboot-0.9b.new/include/setjmp.h	2014-11-06 20:48:38.000000000 +0000
@@ -11,6 +11,9 @@
  *
  * HISTORY
  * $Log: setjmp.h,v $
+ * Revision 1.1.1.1  2004/04/25 20:38:20  vorlon
+ * Initial import of upstream source
+ *
  * Revision 1.1.1.1  2001/10/08 23:03:52  wgwoods
  * initial import of CVS source from alphalinux.org, plus a couple bugfixes
  *
diff -Naur aboot-0.9b.org/include/ufs.h aboot-0.9b.new/include/ufs.h
--- aboot-0.9b.org/include/ufs.h	2001-10-08 23:03:52.000000000 +0000
+++ aboot-0.9b.new/include/ufs.h	2014-11-06 20:16:33.000000000 +0000
@@ -42,6 +42,9 @@
 /*
  * HISTORY
  * $Log: ufs.h,v $
+ * Revision 1.1.1.1  2004/04/25 20:38:21  vorlon
+ * Initial import of upstream source
+ *
  * Revision 1.1.1.1  2001/10/08 23:03:52  wgwoods
  * initial import of CVS source from alphalinux.org, plus a couple bugfixes
  *
diff -Naur aboot-0.9b.org/include/utils.h aboot-0.9b.new/include/utils.h
--- aboot-0.9b.org/include/utils.h	2001-10-08 23:03:52.000000000 +0000
+++ aboot-0.9b.new/include/utils.h	2014-11-06 20:49:44.000000000 +0000
@@ -15,6 +15,7 @@
 extern void		getline (char *buf, int maxlen);
 #endif
 
+extern int		check_memory(unsigned long start, unsigned long size);
 extern unsigned long	memory_end(void);
 extern unsigned long	free_mem_ptr;
 
diff -Naur aboot-0.9b.org/lib/Makefile aboot-0.9b.new/lib/Makefile
--- aboot-0.9b.org/lib/Makefile	2002-09-18 19:48:22.000000000 +0000
+++ aboot-0.9b.new/lib/Makefile	2014-11-06 11:24:56.000000000 +0000
@@ -1,21 +1,11 @@
-CC	= gcc
-CPPFLAGS +=  -D__KERNEL__ -I../include
-ifeq ($(TESTING),)
-CFLAGS	= -Os -Wall -mno-fp-regs -fno-builtin
-else
-CFLAGS  = -Os -g3 -Wall
-endif
-ASFLAGS	= $(CPPFLAGS) -D__ASSEMBLY__ -traditional
-
 ifeq ($(TESTING),)
 libaboot.a: vsprintf.o memcpy.o memset.o string.o _setjmp.o \
 	_longjmp.o isolib.o __divqu.o __remqu.o __divlu.o \
 	__remlu.o
-	ar cru $@ $?
 else
 libaboot.a: isolib.o
-	ar cru $@ $?
 endif
+	$(AR) cru $@ $?
 
 clean:
 	rm -f libaboot.a *.o
@@ -32,3 +22,4 @@
 __remlu.o: divide.S
 	$(CC) -DREM -DINTSIZE -c -o $@ divide.S
 
+.PHONY: clean
diff -Naur aboot-0.9b.org/lib/isolib.c aboot-0.9b.new/lib/isolib.c
--- aboot-0.9b.org/lib/isolib.c	2001-10-08 23:03:53.000000000 +0000
+++ aboot-0.9b.new/lib/isolib.c	2014-11-06 16:48:00.000000000 +0000
@@ -10,15 +10,14 @@
 #  include <linux/string.h>
 #endif
 #include <linux/kernel.h>
-#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/stat.h>
 #include <linux/kdev_t.h>
 #include <asm/page.h>
 
-#include <iso.h>
-#include <isolib.h>
-#include <utils.h>
+#include "iso.h"
+#include "isolib.h"
+#include "utils.h"
 
 /* iso9660 support code */
 
@@ -619,6 +618,7 @@
 {
 	struct inode_table_entry *itp = (struct inode_table_entry *)from;
 	struct iso_inode *root = iso_iget(root_inode);
+	/* HK: iso_iget expects an "int" but root_inode is "long" ?? */
 	struct iso_inode *result = NULL;
 	char *linkto;
 	
@@ -760,10 +760,16 @@
 	if (high_sierra) {
 		rootp = (struct iso_directory_record *)
 			h_pri->root_directory_record;
+#if 0
+/*
+ * See http://www.y-adagio.com/public/standards/iso_cdromr/sect_1.htm
+ * Section 4.16 and 4.17 for explanation why this check is invalid
+ */
 		if (isonum_723 (h_pri->volume_set_size) != 1) {
 			printf("Multi-volume disks not (yet) supported.\n");
 			return -1;
 		};
+#endif
 		sb.s_nzones = isonum_733 (h_pri->volume_space_size);
 		sb.s_log_zone_size = 
 			isonum_723 (h_pri->logical_block_size);
@@ -771,10 +777,16 @@
 	} else {
 		rootp = (struct iso_directory_record *)
 			pri->root_directory_record;
+#if 0
+/*
+ * See http://www.y-adagio.com/public/standards/iso_cdromr/sect_1.htm
+ * Section 4.16 and 4.17 for explanation why this check is invalid
+ */
 		if (isonum_723 (pri->volume_set_size) != 1) {
 			printf("Multi-volume disks not (yet) supported.\n");
 			return -1;
 		}
+#endif
 		sb.s_nzones = isonum_733 (pri->volume_space_size);
 		sb.s_log_zone_size = isonum_723 (pri->logical_block_size);
 		sb.s_max_size = isonum_733(pri->volume_space_size);
@@ -831,6 +843,7 @@
 
 	/* return successfully */
 	root_inode = isonum_733 (rootp->extent) << sb.s_log_zone_size;
+	/* HK: isonum_733 returns an "int" but root_inode is a long ? */
 	return 0;
 }
 
@@ -854,6 +867,7 @@
 
 	/* get the root directory */
 	root = iso_iget(root_inode);
+	/* HK: iso_iget expects an "int" but root_inode is "long" ?? */
 	if (!root) {
 		printf("iso9660: get root inode failed\n");
 		return -1;
@@ -1520,6 +1534,7 @@
 #ifdef DEBUG_ROCK
 	   printf("Symlink component flag not implemented (%d)\n",slen);
 #endif
+	   break;
 	 };
 	 slen -= slp->len + 2;
 	 oldslp = slp;
diff -Naur aboot-0.9b.org/net.c aboot-0.9b.new/net.c
--- aboot-0.9b.org/net.c	2001-10-12 06:04:06.000000000 +0000
+++ aboot-0.9b.new/net.c	2014-11-06 20:45:32.000000000 +0000
@@ -23,13 +23,18 @@
 
 #include <linux/string.h>
 
-#include <config.h>
-#include <cons.h>
-#include <aboot.h>
-#include <bootfs.h>
-#include <utils.h>
+#include "config.h"
+#include "cons.h"
+#include "aboot.h"
+#include "bootfs.h"
+#include "utils.h"
 
 extern char boot_file[256];
+extern char _end;
+
+static char *src = 0;
+static char *kern_src = 0, *ird_src = 0;
+static int header_size = 0, kern_size = 0, ird_size = 0;
 
 void
 dang (void)
@@ -41,13 +46,8 @@
 int
 net_bread (int fd, long blkno, long nblks, char * buf)
 {
-        static char * src = 0;
-	extern char _end;
 	int nbytes;
 
-	if (!src)
-		src = (char *) (((unsigned long) &_end + 511) & ~511);
-
 #ifdef DEBUG
 	printf("net_bread: %p -> %p (%ld blocks at %ld)\n", src, buf,
 	       nblks, blkno);
@@ -71,17 +71,73 @@
 	(int (*)(int, struct stat*))	dang,	/* fstat */
 };
 
+long
+read_initrd()
+{
+	int nblocks, nread;
+
+	/* put it as high up in memory as possible */
+	initrd_start = free_mem_ptr - align_pagesize(ird_size);
+	initrd_size = ird_size;
+	/* update free_mem_ptr so malloc() still works */
+	free_mem_ptr = initrd_start;
+#ifdef DEBUG
+	printf("memory_end %x %x\n", free_mem_ptr, initrd_start);
+#endif
+
+	nblocks = align_512(ird_size) / 512;
+	printf("aboot: loading initrd (%d bytes/%d blocks) at %#lx\n",
+	        ird_size, nblocks, initrd_start);
+	nread = (*bfs->bread)(-1, 0, nblocks, (char*) initrd_start);
+	return 0;
+}
+
+
 
 long
 load_kernel (void)
 {
+	struct header *header;
 	bfs = &netfs;
 
+	header =  (struct header *)align_512( (unsigned long)&_end );
+	header_size = header->header_size;
+	kern_src = (char *)align_512((unsigned long)header + header_size);
+	kern_size = header->kern_size;
+	ird_src = (char *)align_512((unsigned long)kern_src + kern_size);
+	ird_size = header->ird_size;
+
+	if (!free_mem_ptr)
+		free_mem_ptr = memory_end();
+	free_mem_ptr = free_mem_ptr & ~(PAGE_SIZE-1);
+
+#ifdef DEBUG
+	printf("head %x %x kernel %x %x, initrd %x %x \n",
+		header, header_size, kern_src, kern_size, ird_src, ird_size);
+#endif
+
+	if (ird_size) {
+		src = ird_src;
+		if (read_initrd() < 0) {
+			return -1;
+		}
+	}
+
 	strcpy(boot_file, "network");
+
+	/* Move kernel to safe place before uncompression */
+	src = (char*)free_mem_ptr - align_pagesize(kern_size);
+	free_mem_ptr = (unsigned long)src;
+	memcpy(src, kern_src, kern_size);
+
 	uncompress_kernel(-1);
 
 	memset((char*)bss_start, 0, bss_size);	        /* clear bss */
 
+	if (!kernel_args[0] && header->boot_arg[0]) { /* have argument? */
+		strncpy(kernel_args, header->boot_arg, header_size - sizeof(int)*3);
+	}
+
 	while (kernel_args[0] == 'i' && !kernel_args[1]) {
 	    printf("Enter kernel arguments:\n");
 	    printf("aboot> ");
diff -Naur aboot-0.9b.org/sdisklabel/Makefile aboot-0.9b.new/sdisklabel/Makefile
--- aboot-0.9b.org/sdisklabel/Makefile	2001-10-08 23:03:53.000000000 +0000
+++ aboot-0.9b.new/sdisklabel/Makefile	2014-11-06 11:15:47.000000000 +0000
@@ -1,6 +1,3 @@
-CC = gcc -O2
-CFLAGS= -I../include $(CPPFLAGS) -Wall
-
 all:	sdisklabel swriteboot
 
 sdisklabel: sdisklabel.o library.o
@@ -11,3 +8,5 @@
 
 clean:
 	rm -f sdisklabel swriteboot *.o
+
+.PHONY: all clean
diff -Naur aboot-0.9b.org/tools/Makefile aboot-0.9b.new/tools/Makefile
--- aboot-0.9b.org/tools/Makefile	2001-10-08 23:03:53.000000000 +0000
+++ aboot-0.9b.new/tools/Makefile	2014-11-06 16:39:46.000000000 +0000
@@ -1,20 +1,24 @@
-CC	= gcc
-CFLAGS	= -g -O2 -Wall -I. -I../include $(CPPFLAGS)
-LDFLAGS	= -g
-PGMS	= e2writeboot isomarkboot abootconf elfencap objstrip
+override CPPFLAGS += -I. -U__KERNEL__
 
-EXEC_PREFIX = /usr
+HOST_CC		= cc
+HOST_CPPFLAGS	= -I/usr/include $(CPPFLAGS) \
+		  -Delfhdr=elf64_hdr -Delf_phdr=elf64_phdr
 
-all:	$(PGMS)
+PGMS		= e2writeboot isomarkboot abootconf elfencap objstrip
 
-install:	$(PGMS)
-	install -s -c -o root -g root -m 755 $(PGMS) $(EXEC_PREFIX)/bin
+all:	$(PGMS)
 
 clean:
 	rm -f *~ *.o *.a core $(PGMS)
 
+elfencap:	elfencap.c
 isomarkboot:	isomarkboot.o ../lib/isolib.o
 e2writeboot:	e2writeboot.o e2lib.o bio.o
 
+objstrip:
+	$(HOST_CC) -o $@ $(HOST_CPPFLAGS) objstrip.c
+
 e2writeboot.o:	e2lib.h
 e2lib.o: e2lib.h
+
+.PHONY: all clean
diff -Naur aboot-0.9b.org/tools/e2lib.c aboot-0.9b.new/tools/e2lib.c
--- aboot-0.9b.org/tools/e2lib.c	2001-10-08 23:03:53.000000000 +0000
+++ aboot-0.9b.new/tools/e2lib.c	2014-01-13 15:07:14.000000000 +0000
@@ -14,8 +14,8 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#include <bio.h>
-#include <e2lib.h>
+#include "bio.h"
+#include "e2lib.h"
 
 
 #define		MAX_OPEN_FILES		8 
diff -Naur aboot-0.9b.org/tools/e2writeboot.8 aboot-0.9b.new/tools/e2writeboot.8
--- aboot-0.9b.org/tools/e2writeboot.8	2001-10-08 23:03:53.000000000 +0000
+++ aboot-0.9b.new/tools/e2writeboot.8	1970-01-01 00:00:00.000000000 +0000
@@ -1,41 +0,0 @@
-.\" e2writeboot - Write secondary SRM bootloader to ext2 filesystem.
-.TH e2writeboot 8 "17 January 1995" "David Mosberger" ""
-.SH NAME
-e2writeboot \- Write secondary SRM bootloader to ext2 filesystem.
-.SH SYNOPSIS
-\fBe2writeboot\fP <ext2fs> <bootloader>
-.SH DESCRIPTION
-
-\fBe2writeboot\fP can be used to write a secondary bootstrap loader to
-an ext2 formatted filesystem (normally on a floppy disk).  The loader
-is written in a way that allows the SRM firmware to boot from the
-filesystem (SRM is the firmware that is also used to boot DEC Unix and
-OpenVMS).  Specifically, the loader is written to a physically
-contiguous range of sectors and the first sector is updated such that
-the SRM firmware can find the boot loader.  The loader is always
-stored with filename \fBlinuxboot\fP and if such a file already
-exists, it will be overwritten unconditionally.  This command may
-fail if the filesystem is highly fragmented.  If so, re-format the
-filesystem with \fBmke2fs\fP (this will destroy the existing contents
-of the filesystem, so use this with care).
-
-.P
-The \fI<ext2fs>\fP argument specifies the filesystem or special device
-to which the \fI<bootloader>\fP file should be written to.  The boot
-loader file must be an ECOFF object file.  A typical command to make a
-floppy disk bootable with the \fIaboot\fP loader is shown below:
-
-.I "e2writeboot /dev/fd0 aboot"
-
-.nf
-.SH SEE ALSO
-.IR aboot (8) ,
-.IR mke2fs (8) ,
-.IR swriteboot (8)
-.nf
-.SH AUTHORS
-.nf
-Jim Paradis <paradis@amt.tay1.dec.com>
-Jay Estabrook <jestabro@amt.tay1.dec.com>
-David Mosberger-Tang <davidm@azstarnet.com>
-.fi
diff -Naur aboot-0.9b.org/tools/e2writeboot.c aboot-0.9b.new/tools/e2writeboot.c
--- aboot-0.9b.org/tools/e2writeboot.c	2001-10-12 06:03:18.000000000 +0000
+++ aboot-0.9b.new/tools/e2writeboot.c	2014-01-13 15:05:24.000000000 +0000
@@ -17,7 +17,7 @@
 
 #include <sys/stat.h>
 
-#include <e2lib.h>
+#include "e2lib.h"
 
 #if defined(__linux__)
 # include <sys/types.h>
diff -Naur aboot-0.9b.org/tools/elfencap.c aboot-0.9b.new/tools/elfencap.c
--- aboot-0.9b.org/tools/elfencap.c	2001-10-08 23:03:53.000000000 +0000
+++ aboot-0.9b.new/tools/elfencap.c	2014-11-06 16:45:15.000000000 +0000
@@ -16,8 +16,8 @@
     char buf[8192];
     struct stat st;
     struct {
-	struct elfhdr	ehdr;
-	struct elf_phdr	phdr;
+	Elf64_Ehdr	ehdr;
+	Elf64_Phdr	phdr;
     } h;
 
     ifd = open(argv[1], O_RDONLY);
@@ -34,12 +34,12 @@
     memset(&h, 0, sizeof(h));
 
     h.ehdr.e_ident[0] = 0x7f;
-    strcpy(h.ehdr.e_ident + 1, "ELF");
-    h.ehdr.e_ident[EI_CLASS]	= ELF_CLASS;
-    h.ehdr.e_ident[EI_DATA]	= ELF_DATA;
+    strcpy((char *)h.ehdr.e_ident + 1, "ELF");
+    h.ehdr.e_ident[EI_CLASS]	= ELFCLASS64;
+    h.ehdr.e_ident[EI_DATA]	= ELFDATA2LSB;
     h.ehdr.e_ident[EI_VERSION]	= EV_CURRENT;
     h.ehdr.e_type		= ET_EXEC;
-    h.ehdr.e_machine		= ELF_ARCH;
+    h.ehdr.e_machine		= EM_ALPHA;
     h.ehdr.e_version		= EV_CURRENT;
     h.ehdr.e_entry		= 0xfffffc0000310000;
     h.ehdr.e_phnum		= 1;
diff -Naur aboot-0.9b.org/tools/isomarkboot.c aboot-0.9b.new/tools/isomarkboot.c
--- aboot-0.9b.org/tools/isomarkboot.c	2001-10-08 23:03:53.000000000 +0000
+++ aboot-0.9b.new/tools/isomarkboot.c	2014-11-06 19:24:58.000000000 +0000
@@ -37,14 +37,12 @@
 
 static int disk;
 
-
 void
 __memcpy (void * dest, const void * src, size_t n)
 {
 	memcpy (dest, src, n);
 }
 
-
 long
 iso_dev_read (void * buf, long offset, long size)
 {
@@ -55,7 +53,35 @@
 	return read(disk, buf, size);
 }
 
+/* Write a 64-bit quantity out into memory in LITTLE ENDIAN order */
+static void write_64 (unsigned char* out, unsigned long long in)
+{
+	out[0] = in & 0xFF;
+	out[1] = (in >> 8) & 0xFF;
+	out[2] = (in >> 16) & 0xFF;
+	out[3] = (in >> 24) & 0xFF;
+	out[4] = (in >> 32) & 0xFF;
+	out[5] = (in >> 40) & 0xFF;
+	out[6] = (in >> 48) & 0xFF;
+	out[7] = (in >> 56) & 0xFF;
+}
 
+/* Read in a 64-bit LITTLE ENDIAN quantity */
+static unsigned long long read_64 (unsigned char *in)
+{
+	unsigned long long result = 0;
+
+	result |= (unsigned long long) in[0];
+	result |= (unsigned long long) in[1] << 8;
+	result |= (unsigned long long) in[2] << 16;
+	result |= (unsigned long long) in[3] << 24;
+	result |= (unsigned long long) in[4] << 32;
+	result |= (unsigned long long) in[5] << 40;
+	result |= (unsigned long long) in[6] << 48;
+	result |= (unsigned long long) in[7] << 56;
+
+	return result;
+}
 
 int
 main (int argc, char ** argv)
@@ -72,8 +98,8 @@
 	prog_name = argv[0];
 
 	if (argc < 3 || argc > 4) {
-	    fprintf(stderr, "usage: %s filesys path [root.bin]\n", prog_name);
-	    exit(1);
+		fprintf(stderr, "usage: %s filesys path [root.bin]\n", prog_name);
+		exit(1);
 	}
 	disk = open(argv[1], O_RDWR);
 	if (disk < 0) {
@@ -119,15 +145,16 @@
 	}
 
 	strcpy((char *) sector, "Linux/Alpha aboot for ISO filesystem.");
-	sector[60] = aboot_size / 512;		/* sector count */
-	sector[61] = aboot_pos / 512;		/* starting LBM */
-	sector[62] = 0;				/* flags */
+	write_64((unsigned char *) &sector[60], aboot_size / 512); /* sector count */
+	write_64((unsigned char *) &sector[61], aboot_pos / 512);  /* starting LBM */
+	write_64((unsigned char *) &sector[62], 0);                /* flags */
 
 	/* update checksum: */
 	sum = 0;
-	for (i = 0; i < 63; ++i)
-		sum += sector[i];
-	sector[63] = sum;
+	for (i = 0; i < 63; i++)
+		sum += read_64((unsigned char *) &sector[i]);
+
+	write_64((unsigned char *) &sector[63], sum);
 
 	if (lseek(disk, 0, SEEK_SET) != 0) {
 		perror("lseek");
@@ -144,8 +171,8 @@
 		exit(1);
 	}
 
-        if (argc < 4)
-          return 0;
+	if (argc < 4)
+		return 0;
 
 	rootbin_fd = iso_open(argv[3]);
 	if (rootbin_fd < 0) {
@@ -154,7 +181,7 @@
 	}
 
 	rootbin_pos = iso_map (rootbin_fd, 0);
-        iso_close(rootbin_fd);
+	iso_close(rootbin_fd);
 
 	{
 		struct stat buf;
@@ -170,29 +197,29 @@
 	}
 	nbytes = read(disk, &vol_desc, sizeof(vol_desc));
 	if (nbytes != sizeof(vol_desc)) {
-          if ((long) nbytes < 0) {
-            perror("read");
-          } else {
-            fprintf(stderr, "%s: short read\n", prog_name);
-          }
-          exit(1);
-	}
-
-        if (strncmp (vol_desc.id, ISO_STANDARD_ID, sizeof vol_desc.id) != 0) {
-          fprintf(stderr,"first volume descriptor has not an ISO_STANDARD_ID!!\n");
-          exit(1);
-        }
-        if (isonum_711 (vol_desc.type) != ISO_VD_PRIMARY) {
-          fprintf(stderr,"first volume descriptor is not a primary one!!\n");
-          exit(1);
-        }
-        if (rootbin_pos & 2047) {
-          fprintf(stderr,"erreur:rootbin_pos=%ld is not at a isoblock boundary\n",rootbin_pos);
-            exit(1);
-        }
-        sprintf(root_start,"ROOT START=%ld        ",rootbin_pos/2048);
-        printf("writing %s in application_data of first volume descriptor\n", root_start); 
-        memcpy(vol_desc.application_data,root_start,strlen(root_start));
+		if ((long) nbytes < 0) {
+			perror("read");
+		} else {
+			fprintf(stderr, "%s: short read\n", prog_name);
+		}
+		exit(1);
+	}
+
+	if (strncmp (vol_desc.id, ISO_STANDARD_ID, sizeof vol_desc.id) != 0) {
+		fprintf(stderr,"first volume descriptor has not an ISO_STANDARD_ID!!\n");
+		exit(1);
+	}
+	if (isonum_711 (vol_desc.type) != ISO_VD_PRIMARY) {
+		fprintf(stderr,"first volume descriptor is not a primary one!!\n");
+		exit(1);
+	}
+	if (rootbin_pos & 2047) {
+		fprintf(stderr,"erreur:rootbin_pos=%ld is not at a isoblock boundary\n",rootbin_pos);
+		exit(1);
+	}
+	sprintf(root_start,"ROOT START=%ld        ",rootbin_pos/2048);
+	printf("writing %s in application_data of first volume descriptor\n", root_start); 
+	memcpy(vol_desc.application_data,root_start,strlen(root_start));
 	if (lseek(disk, 16*2048, SEEK_SET) != 16*2048) {
 		perror("lseek");
 		return -1;
@@ -200,10 +227,10 @@
         
 	nbytes = write(disk, &vol_desc, sizeof(vol_desc));
 	if (nbytes != sizeof(vol_desc)) {
-          if ((long) nbytes < 0) {
+		if ((long) nbytes < 0) {
 			perror("write");
 		} else {
-                  fprintf(stderr, "%s: short write\n", prog_name);
+			fprintf(stderr, "%s: short write\n", prog_name);
 		}
 		exit(1);
 	}
diff -Naur aboot-0.9b.org/tools/objstrip.c aboot-0.9b.new/tools/objstrip.c
--- aboot-0.9b.org/tools/objstrip.c	2002-09-18 19:48:22.000000000 +0000
+++ aboot-0.9b.new/tools/objstrip.c	2014-11-06 19:51:11.000000000 +0000
@@ -7,14 +7,15 @@
  */
 /*
  * Converts an ECOFF or ELF object file into a bootable file.  The
- * object file must be a OMAGIC file (i.e., data and bss follow immediatly
+ * object file must be a OMAGIC file (i.e., data and bss follow immediately
  * behind the text).  See DEC "Assembly Language Programmer's Guide"
  * documentation for details.  The SRM boot process is documented in
  * the Alpha AXP Architecture Reference Manual, Second Edition by
  * Richard L. Sites and Richard T. Witek.
  */
-#include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
 #include <unistd.h>
 
 #include <sys/fcntl.h>
@@ -24,16 +25,14 @@
 #include <linux/a.out.h>
 #include <linux/coff.h>
 #include <linux/param.h>
-#include <string.h>
 
 #ifdef __ELF__
-# include <asm/elf.h>
 # include <linux/elf.h>
 # include <linux/version.h>
 # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
-#  define aboot_elf_check_arch(e)        elf_check_arch(e)
+#  define aboot_elf_check_arch(e)        ((e)->e_machine == EM_ALPHA)
 # else
-#  define aboot_elf_check_arch(e)        elf_check_arch(e->e_machine)
+#  define aboot_elf_check_arch(e)        ((e) == EM_ALPHA)
 # endif
 #endif
 
@@ -101,7 +100,7 @@
     ofd = 1;
     if (i < argc) {
 	ofd = open(argv[i++], O_WRONLY | O_CREAT | O_TRUNC, 0666);
-	if (fd == -1) {
+	if (ofd == -1) {
 	    perror("open");
 	    exit(1);
 	}
@@ -152,7 +151,7 @@
 #ifdef __ELF__
     elf = (struct elfhdr *) buf;
 
-    if (elf->e_ident[0] == 0x7f && strncmp(elf->e_ident + 1, "ELF", 3) == 0) {
+    if (elf->e_ident[0] == 0x7f && strncmp((char *)elf->e_ident + 1, "ELF", 3) == 0) {
 	if (elf->e_type != ET_EXEC) {
 	    fprintf(stderr, "%s: %s is not an ELF executable\n",
 		    prog_name, inname);
diff -Naur aboot-0.9b.org/utils.c aboot-0.9b.new/utils.c
--- aboot-0.9b.org/utils.c	2001-10-12 06:04:06.000000000 +0000
+++ aboot-0.9b.new/utils.c	2014-11-06 19:48:19.000000000 +0000
@@ -6,11 +6,11 @@
 #include <asm/system.h>
 
 #include <stdarg.h>
+#include <errno.h>
 
 #include "aboot.h"
 #include "cons.h"
 
-
 unsigned long free_mem_ptr = 0;
 
 
@@ -139,6 +139,60 @@
 	tbia();
 }
 
+int check_memory(unsigned long start, unsigned long size)
+{
+	unsigned long phys_start, start_pfn, end_pfn;
+	struct memclust_struct *cluster;
+	struct memdesc_struct *memdesc;
+	int i;
+
+	/*
+	 * Get the physical address start. 
+	 * If 43-bit superpage is being used (VA<63:41> = 0x7ffffe)
+	 * then the "correct" translation across all implementations is to
+	 * sign extend the VA from bit 40. Otherwise, assume it's already a
+	 * physical address.
+	 */
+	phys_start = start;
+	if (((long)phys_start >> 41) == -2) 
+		phys_start = (long)((start) << (64-41)) >> (64-41);
+	start_pfn = phys_start >> PAGE_SHIFT;
+	end_pfn = (phys_start + size - 1) >> PAGE_SHIFT;
+
+	memdesc = (struct memdesc_struct *)
+		  (INIT_HWRPB->mddt_offset + (unsigned long) INIT_HWRPB);
+	for (cluster = memdesc->cluster, i = 0;
+	     i < memdesc->numclusters; 
+	     i++, cluster++) {
+		if ((cluster->start_pfn > end_pfn) ||
+		    ((cluster->start_pfn + cluster->numpages) <= start_pfn))
+			continue;	/* no overlap */
+
+		/* 
+		 * This cluster overlaps the memory we're checking, check
+		 * the usage:
+		 * 	bit 0 is console/PAL reserved
+		 * 	bit 1 is non-volatile
+		 * If either is set, it's a problem, return -EBUSY
+		 */
+		if (cluster->usage & 3)
+			return -EBUSY;	/* reserved */
+
+		/*
+		 * It's not reserved, take it out of what we're checking
+		 */
+		if (cluster->start_pfn <= end_pfn) 
+			end_pfn = cluster->start_pfn - 1;
+		if ((cluster->start_pfn + cluster->numpages) > start_pfn)
+			start_pfn = cluster->start_pfn + cluster->numpages;
+
+		if (end_pfn < start_pfn)
+			return 0;	/* all found, ok */
+	}
+
+	/* no conflict, but not all memory found */
+	return -ENOMEM;
+}
 
 unsigned long memory_end(void)
 {
diff -Naur aboot-0.9b.org/zip/misc.c aboot-0.9b.new/zip/misc.c
--- aboot-0.9b.org/zip/misc.c	2001-10-08 23:03:54.000000000 +0000
+++ aboot-0.9b.new/zip/misc.c	2014-11-06 19:43:37.000000000 +0000
@@ -237,7 +237,7 @@
 	while (chunk < nchunks) {
 		/* position within the current segment */
 		ssize_t chunk_offset = file_offset - chunks[chunk].offset;
-		unsigned char *dest = (char *) chunks[chunk].addr + chunk_offset;
+		unsigned char *dest = (unsigned char *) chunks[chunk].addr + chunk_offset;
 		ssize_t to_copy;
 		unsigned char *src = window;
 
diff -Naur aboot-0.9b.org/zip/unzip.c aboot-0.9b.new/zip/unzip.c
--- aboot-0.9b.org/zip/unzip.c	2001-10-08 23:03:54.000000000 +0000
+++ aboot-0.9b.new/zip/unzip.c	2014-01-14 15:22:11.000000000 +0000
@@ -16,6 +16,11 @@
  * deflated or stored.
  */
 
+#ifdef DEBUG
+# include <linux/string.h>
+# include <utils.h>		/* for printf */
+#endif
+
 #include "gzip.h"
 
 /* PKZIP header definitions */
