summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /sys-boot/milo
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sys-boot/milo')
-rw-r--r--sys-boot/milo/Manifest6
-rw-r--r--sys-boot/milo/files/README-gentoo99
-rw-r--r--sys-boot/milo/files/linux-2.2.25-gcc3-milo.diff123
-rw-r--r--sys-boot/milo/files/milo-2.2-18-gcc3-gentoo.diff174
-rw-r--r--sys-boot/milo/files/mkserial_no.c45
-rw-r--r--sys-boot/milo/files/objstrip.c282
-rw-r--r--sys-boot/milo/metadata.xml14
-rw-r--r--sys-boot/milo/milo-2.4.18.ebuild232
8 files changed, 975 insertions, 0 deletions
diff --git a/sys-boot/milo/Manifest b/sys-boot/milo/Manifest
new file mode 100644
index 00000000000..be4aa366b4e
--- /dev/null
+++ b/sys-boot/milo/Manifest
@@ -0,0 +1,6 @@
+DIST MILO-HOWTO 52455 RMD160 a5b9ef06d3b5ef4c90258a372ddc85f82983957a SHA1 877ceb8ab8e3ed311702913d3538454f83296053 SHA256 d94f5d75d647f47f11fb691df3da450dc794dd9287464df71168d03d8bbcd4e3
+DIST ldmilo-patched-20010430 18944 RMD160 d6d6e07942e614f9d0c108c5e774e3feabe15f75 SHA1 883bb55b0b32ba1cddefd8ae7759bd2f712db335 SHA256 282745f24bc472871b5a4eda7a634847a874d04802056ffca360bf67883d753f
+DIST linload.exe 7168 RMD160 30b5b5d15773c773336cedb49847c509da986dc6 SHA1 8dcff195ed5b34e08cddbf3e5404c9564d0a9814 SHA256 15d1d8dcbefde7c94a1bbe4a243b13f9197c27cb19388f8de0d92d45a4be42e4
+DIST linux-2.2.20-reiserfs-3.5.35.diff.bz2 154943 RMD160 b540887bb50b57dd77eb51bf95cbd7570aec3ebb SHA1 d310daab67bbea3adbac4dac274297b7c6429a00 SHA256 a6aee45cf9814e45d9a3be05b35bda289c5f6d8672eaacc32fcec60527550e94
+DIST linux-2.2.25.tar.bz2 15791211 RMD160 5223cbb5fc2dba55546cef773580563a56e78aa2 SHA1 85921519156215b2b1e08b3d79b468004f11273f SHA256 cd15777cdb90af5136d40d13190def143ccf7a730722c7435e0daff48d0405d9
+DIST milo-2.2-18.tar.bz2 1074725 RMD160 65c28f3c4fcabb83872f9ba598076cf7117df5ee SHA1 59e61f3912805f1f3b0becf961d6309440e6c1c5 SHA256 b63e113d74eb40845ecdd111784d524c223694f236891279ae002b441a50258b
diff --git a/sys-boot/milo/files/README-gentoo b/sys-boot/milo/files/README-gentoo
new file mode 100644
index 00000000000..0d184804c70
--- /dev/null
+++ b/sys-boot/milo/files/README-gentoo
@@ -0,0 +1,99 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+#
+##############################################
+# Gentoo Linux MILO images.
+####################################################
+#
+# What is MILO?
+#
+###
+
+MILO is an AlphaLinux bootloader, which is usually used to load the Linux
+Operating System on Alpha machines that dont have SRM.
+
+There are two families of firmware on Alpha, ARC and SRM. ARC was developed
+for use with Windows NT, and cannot support Linux. Some Alpha's were
+distributed with only ARC firmware, for use specifically with Windows NT,
+these machines would not be able to run any OS except for Windows NT without
+MILO.
+
+If you do have SRM, or the option of using SRM, you should be using the aboot
+bootloader, unless you really know what you are doing.
+
+NOTE: if you have srm, but would like to dual boot with Windows NT, or use ARC
+ firmware, you might find MILO more useful than aboot. There are other
+ reasons also, booting a kernel from a reiserfs partition, for example.
+
+NOTE: The Gentoo MILO images are slightly different to the standard
+ MILO images, they have been patched to compile with gcc3 and
+ work with the latest linux-2.2 kernel and drivers. You can
+ also optimise your MILO image, to maximise the performance of the
+ MILO pager! woooo!
+
+FIXME: will there be a boot speed improvement from optimising MILO?
+FIXME: what about performance of the call_pal routines (or at least the
+ overhead of calling them, as they are hand coded asm), will
+ that improve system performance?
+
+#####################################################
+#
+# How do i use these images to boot?
+#
+####
+
+NOTE: Read the MILO-HOWTO in this directory now!
+ There is an explanation and description of all the ways you can
+ start MILO, including SRM, Floppy, Flash and Debug Monitor.
+
+In this directory you will find the MILO images, you can use these to
+make MILO boot floppies, or install them to a FAT partition.
+
+There are instructions below for making a MILO boot floppy.
+
+
+1. insert the disk you would like to make a MILO floppy.
+
+2. fdformat /dev/fd0
+
+ Obviously, if the disk is already formatted you can skip
+ this step.
+
+3. mformat a:
+
+ this will create a MSDOS file system (FAT) on the floppy.
+
+4. mcopy milo-2.4.18-gentoo-<your alpha> a:\milo
+
+ install the milo image for your machine onto the new floppy.
+
+5. mcopy linload.exe a:\linload.exe
+ _OR_ if you have a Ruffian machine:
+ mcopy ldmilo.exe a:\ldmilo.exe
+
+ install the milo loader, note that ruffians dont use ldlinux.exe
+ by default, if your system expects ldlinux.exe, just copy that file
+ instead. the ldmilo included in this ebuild contains the fixes by Jay
+ Eastabrook, sometimes called "Jay's Hacked Version".
+
+6. echo -ne '\125\252' | dd of=/dev/fd0 bs=1 seek=510 count=2 conv=notrunc
+
+ this might not be nescessary on all machines, but some ARCs expect the
+ floppy to be marked bootable, this fakes the magic.
+
+7. reboot, and set ARCs to boot your shiny new MILO floppy!
+
+#####################################################
+#
+# BUGS
+#
+####
+
+These MILO images are not extensively tested, if you use one
+PLEASE, PLEASE, PLEASE tell me! i need to know which systems
+it works on and which ones it doesnt.
+
+if you dont want to enter a bug in http://bugs.gentoo.org/
+
+you can just email me a quick note to taviso@gentoo.org
diff --git a/sys-boot/milo/files/linux-2.2.25-gcc3-milo.diff b/sys-boot/milo/files/linux-2.2.25-gcc3-milo.diff
new file mode 100644
index 00000000000..d99769f91c9
--- /dev/null
+++ b/sys-boot/milo/files/linux-2.2.25-gcc3-milo.diff
@@ -0,0 +1,123 @@
+diff -ru --minimal linux/arch/alpha/kernel/process.c linux/arch/alpha/kernel/process.c
+--- linux/arch/alpha/kernel/process.c 2001-03-25 17:37:29.000000000 +0100
++++ linux/arch/alpha/kernel/process.c 2003-06-02 20:20:19.000000000 +0100
+@@ -57,7 +57,7 @@
+ static struct fs_struct init_fs = INIT_FS;
+ static struct files_struct init_files = INIT_FILES;
+ static struct signal_struct init_signals = INIT_SIGNALS;
+-struct mm_struct init_mm = INIT_MM;
++struct mm_struct init_mm;
+
+ union task_union init_task_union __attribute__((section("init_task")))
+ = { task: INIT_TASK };
+diff -ru --minimal linux/drivers/char/tty_io.c linux/drivers/char/tty_io.c
+--- linux/drivers/char/tty_io.c 2002-05-21 00:32:34.000000000 +0100
++++ linux/drivers/char/tty_io.c 2003-06-02 20:05:08.000000000 +0100
+@@ -756,15 +756,17 @@
+ }
+
+ /* Semaphore to protect creating and releasing a tty */
+-static struct semaphore tty_sem = MUTEX;
++static struct semaphore tty_sem;
+
+ static void down_tty_sem(int index)
+ {
++ tty_sem = MUTEX;
+ down(&tty_sem);
+ }
+
+ static void up_tty_sem(int index)
+ {
++ tty_sem = MUTEX;
+ up(&tty_sem);
+ }
+
+@@ -785,6 +787,7 @@
+ int retval=0;
+ int idx;
+
++ tty_sem = MUTEX;
+ driver = get_tty_driver(device);
+ if (!driver)
+ return -ENODEV;
+diff -ru --minimal linux/fs/super.c linux/fs/super.c
+--- linux/fs/super.c 2001-11-02 16:39:08.000000000 +0000
++++ linux/fs/super.c 2003-06-02 20:13:53.000000000 +0100
+@@ -42,7 +42,7 @@
+ * unmounting a filesystem and re-mounting it (or something
+ * else).
+ */
+-static struct semaphore mount_sem = MUTEX;
++static struct semaphore mount_sem;
+
+ extern void wait_for_keypress(void);
+ extern struct file_operations * get_blkfops(unsigned int major);
+@@ -730,6 +730,7 @@
+ int retval;
+ struct inode * inode = get_empty_inode();
+
++ mount_sem = MUTEX;
+ retval = -ENOMEM;
+ if (!inode)
+ goto out;
+@@ -859,6 +860,7 @@
+ struct vfsmount *vfsmnt;
+ int error;
+
++ mount_sem = MUTEX;
+ error = -EACCES;
+ if (!(flags & MS_RDONLY) && dev && is_read_only(dev))
+ goto out;
+diff -ru --minimal linux/kernel/sys.c linux/kernel/sys.c
+--- linux/kernel/sys.c 2002-09-16 17:26:33.000000000 +0100
++++ linux/kernel/sys.c 2003-06-02 20:00:20.000000000 +0100
+@@ -866,12 +866,13 @@
+ * rather than a semaphore. Anybody want to implement
+ * one?
+ */
+-struct semaphore uts_sem = MUTEX;
++struct semaphore uts_sem;
+
+ asmlinkage int sys_newuname(struct new_utsname * name)
+ {
+ int errno = 0;
+
++ uts_sem = MUTEX;
+ down(&uts_sem);
+ if (copy_to_user(name,&system_utsname,sizeof *name))
+ errno = -EFAULT;
+@@ -883,6 +884,7 @@
+ {
+ int errno;
+
++ uts_sem = MUTEX;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+ if (len < 0 || len > __NEW_UTS_LEN)
+@@ -901,6 +903,7 @@
+ {
+ int i, errno;
+
++ uts_sem = MUTEX;
+ if (len < 0)
+ return -EINVAL;
+ down(&uts_sem);
+@@ -922,6 +925,7 @@
+ {
+ int errno;
+
++ uts_sem = MUTEX;
+ if (!capable(CAP_SYS_ADMIN))
+ return -EPERM;
+ if (len < 0 || len > __NEW_UTS_LEN)
+diff -ru --minimal linux/include/asm-alpha/errno.h linux/include/asm-alpha/errno.h
+--- linux/include/asm-alpha/errno.h 2001-03-25 17:31:06.000000000 +0100
++++ linux/include/asm-alpha/errno.h 2003-06-02 23:48:45.000000000 +0100
+@@ -134,6 +134,7 @@
+ #define ELIBMAX 125 /* Attempting to link in too many shared libraries */
+ #define ELIBEXEC 126 /* Cannot exec a shared library directly */
+ #define ERESTART 127 /* Interrupted system call should be restarted */
++#define EHASHCOLLISION 127 /* reiserfs hash collision */
+ #define ESTRPIPE 128 /* Streams pipe error */
+
+ #define ENOMEDIUM 129 /* No medium found */
diff --git a/sys-boot/milo/files/milo-2.2-18-gcc3-gentoo.diff b/sys-boot/milo/files/milo-2.2-18-gcc3-gentoo.diff
new file mode 100644
index 00000000000..2fa897df6e9
--- /dev/null
+++ b/sys-boot/milo/files/milo-2.2-18-gcc3-gentoo.diff
@@ -0,0 +1,174 @@
+diff -u -r --minimal milo-2.2-18.orig/config.in milo-2.2-18/config.in
+--- milo-2.2-18.orig/config.in 2001-07-18 15:58:30.000000000 +0100
++++ milo-2.2-18/config.in 2003-06-05 18:52:06.000000000 +0100
+@@ -5,7 +5,7 @@
+
+ comment 'Alpha Linux Miniloader setup'
+ #
+-string 'Path to kernel sources' KSRC /usr/src/linux
++string 'Path to kernel sources' KSRC ${WORKDIR}/linux
+ choice 'Alpha system type' \
+ "Alpha-XLT MINI_ALPHA_XLT \
+ Alpha-XL MINI_ALPHA_XL \
+diff -u -r --minimal milo-2.2-18.orig/devices.c milo-2.2-18/devices.c
+--- milo-2.2-18.orig/devices.c 2001-07-18 16:59:38.000000000 +0100
++++ milo-2.2-18/devices.c 2003-06-05 18:52:06.000000000 +0100
+@@ -98,7 +98,7 @@
+ struct fs_struct init_fs = INIT_FS;
+ struct files_struct init_files = INIT_FILES;
+ struct signal_struct init_signals = INIT_SIGNALS;
+-struct mm_struct init_mm = INIT_MM;
++struct mm_struct init_mm;
+
+ unsigned securebits = SECUREBITS_DEFAULT; /* systemwide security settings */
+
+@@ -1213,7 +1213,7 @@
+ }
+
+
+-void __wake_up(struct wait_queue **p, unsigned int mode, unsigned int wq_mode)
++void __wake_up(struct wait_queue **p, unsigned int mode)
+ {
+ wake_up(p);
+ }
+diff -u -r --minimal milo-2.2-18.orig/Documentation/defconfig.milo milo-2.2-18/Documentation/defconfig.milo
+--- milo-2.2-18.orig/Documentation/defconfig.milo 2001-07-19 10:59:45.000000000 +0100
++++ milo-2.2-18/Documentation/defconfig.milo 2003-06-05 18:52:06.000000000 +0100
+@@ -5,7 +5,7 @@
+ #
+ # Alpha Linux Miniloader setup
+ #
+-KSRC=/usr/src/linux
++KSRC=${WORKDIR}/linux
+ # MINI_ALPHA_XLT is not set
+ # MINI_ALPHA_XL is not set
+ # MINI_ALPHA_BOOK1 is not set
+@@ -36,7 +36,7 @@
+ # MINI_VGA_RAW2 is not set
+ MINI_TGA_CONSOLE=y
+ MINI_EXTERNAL_FONT=y
+-MINI_FONT_FILE=/usr/lib/kbd/consolefonts/default8x16.gz
++MINI_FONT_FILE=/usr/share/consolefonts/default8x16.psfu.gz
+ MILO_CONFIG_EXT2FS=y
+ MILO_CONFIG_MSDOSFS=y
+ MILO_CONFIG_REISERFS=y
+diff -u -r --minimal milo-2.2-18.orig/hwrpb.c milo-2.2-18/hwrpb.c
+--- milo-2.2-18.orig/hwrpb.c 2001-07-18 14:38:38.000000000 +0100
++++ milo-2.2-18/hwrpb.c 2003-06-05 18:52:06.000000000 +0100
+@@ -368,9 +368,17 @@
+ percpu =
+ (struct percpu_struct *) (((char *) hwrpb) +
+ hwrpb->processor_offset);
+- percpu->serial_no[0] = 0x73695f78756e694c;
++#ifndef MILO_SERIAL_NUMBER0
++#define MILO_SERIAL_NUMBER0 0x73695f78756e694c
++#endif /* MILO_SERIAL_NUMBER0 */
++
++#ifndef MILO_SERIAL_NUMBER1
++#define MILO_SERIAL_NUMBER1 0x002174616572475f;
++#endif /* MILO_SERIAL_NUMBER1 */
++
++ percpu->serial_no[0] = MILO_SERIAL_NUMBER0;
+ /* :-) */
+- percpu->serial_no[1] = 0x002174616572475f;
++ percpu->serial_no[1] = MILO_SERIAL_NUMBER1;
+ percpu->type = cpuid();
+
+ /*
+diff -u -r --minimal milo-2.2-18.orig/Makefile milo-2.2-18/Makefile
+--- milo-2.2-18.orig/Makefile 2001-07-18 17:15:31.000000000 +0100
++++ milo-2.2-18/Makefile 2003-06-05 18:52:06.000000000 +0100
+@@ -54,8 +54,8 @@
+ #
+
+ LINKFLAGS = -non_shared -N -T milo.lds
+-CFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \
+- -fno-strict-aliasing -mcpu=ev5 -pipe -mno-fp-regs \
++CFLAGS += -Wall -Wstrict-prototypes -fomit-frame-pointer \
++ -fno-strict-aliasing -pipe -mno-fp-regs \
+ -ffixed-8 -Wa,-mev6 -D__KERNEL__ -D__linux__ \
+ -I$(KSRC)/include
+
+diff -u -r --minimal milo-2.2-18.orig/milo.c milo-2.2-18/milo.c
+--- milo-2.2-18.orig/milo.c 2001-07-18 14:38:38.000000000 +0100
++++ milo-2.2-18/milo.c 2003-06-05 19:16:16.000000000 +0100
+@@ -1436,9 +1436,10 @@
+ {
+ extern U64 milo_memory_size;
+
+- printk("MILO (%s):\n", alpha_mv.vector_name);
+- printk(" Built against Linux " UTS_RELEASE "\n");
++ printk("Gentoo MILO (%s):\n", alpha_mv.vector_name);
++ printk(" Built against Gentoo Linux Kernel " UTS_RELEASE "\n");
+ printk(" Using compiler " LINUX_COMPILER "\n");
++ printk("\nWelcome to the Gentoo Linux MIniLOader\n");
+
+ #if 0
+ /* what sort of video do we have? */
+@@ -1792,7 +1793,7 @@
+ /* parse commands forever */
+ while (1) {
+
+- printk("MILO> ");
++ printk("MILO > ");
+
+ kbd_gets(command_string, 256);
+ printk_rows = 0;
+diff -u -r --minimal milo-2.2-18.orig/tools/scripts/allfiles milo-2.2-18/tools/scripts/allfiles
+--- milo-2.2-18.orig/tools/scripts/allfiles 2001-07-11 18:27:02.000000000 +0100
++++ milo-2.2-18/tools/scripts/allfiles 2003-06-05 18:52:06.000000000 +0100
+@@ -1,7 +1,7 @@
+ #!/bin/bash
+
+ LOC=kernel/objs
+-KSRC=/usr/src/linux/
++KSRC=${WORKDIR}/linux
+
+ rm -rf $LOC
+
+diff -u -r --minimal milo-2.2-18.orig/tools/scripts/build milo-2.2-18/tools/scripts/build
+--- milo-2.2-18.orig/tools/scripts/build 2001-07-18 16:58:29.000000000 +0100
++++ milo-2.2-18/tools/scripts/build 2003-06-05 19:14:25.000000000 +0100
+@@ -1,29 +1,9 @@
+ #!/bin/bash
+ set -e
+
+-RELEASE=2.2-17
++RELEASE=2.2-18-Gentoo
+
+-for i in \
+- "Alpha-XLT XLT" \
+- "Alpha-XL XL" \
+- "AlphaBook1 BOOK1" \
+- "Avanti AVANTI" \
+- "Cabriolet CABRIOLET" \
+- "EB66 EB66" \
+- "EB66+ EB66P" \
+- "EB64+ EB64P" \
+- "EB164 EB164" \
+- "PC164 PC164" \
+- "LX164 LX164" \
+- "SX164 SX164" \
+- "Noname NONAME" \
+- "Takara TAKARA" \
+- "Mikasa MIKASA" \
+- "Alcor ALCOR" \
+- "Miata MIATA" \
+- "Ruffian RUFFIAN" \
+- "Platform2000 P2K" \
+- "UDB UDB"
++for i in __MILO_ARCHES__
+ do
+ short=`echo $i | awk '{print $1}'`
+ long=`echo $i | awk '{print $2}'`
+diff -u -r --minimal milo-2.2-18.orig/tools/scripts/buildkernels milo-2.2-18/tools/scripts/buildkernels
+--- milo-2.2-18.orig/tools/scripts/buildkernels 1999-08-19 14:08:55.000000000 +0100
++++ milo-2.2-18/tools/scripts/buildkernels 2003-06-05 18:52:06.000000000 +0100
+@@ -1,6 +1,6 @@
+ #!/bin/bash
+
+-LINUX=/usr/src/linux
++LINUX=${WORKDIR}/linux
+ KOUT=$(dirname `pwd`)/linux
+
+ set -e
diff --git a/sys-boot/milo/files/mkserial_no.c b/sys-boot/milo/files/mkserial_no.c
new file mode 100644
index 00000000000..b4650447584
--- /dev/null
+++ b/sys-boot/milo/files/mkserial_no.c
@@ -0,0 +1,45 @@
+#include <stdio.h>
+
+/* some example serial numbers for the MILO bootloader */
+/* gcc -o mkserial_no mkserial_no.c */
+/* taviso@gentoo.org 2003 */
+
+/* NOTE: remember you need a 0x00 (NULL terminator) at the end */
+
+int main()
+{
+ long long serial_no[2];
+
+ /* 1) Linux_is_Great! */
+ /* s i _ x u n i L */
+ serial_no[0] = 0x73695f78756e694c;
+ /* ! t a e r G _ */
+ serial_no[1] = 0x002174616572475f;
+
+ /* 2) Gentoo Linux. */
+ /* L o o t n e G */
+ serial_no[0] = 0x4c206f6f746e6547;
+ /* . x u n i */
+ serial_no[1] = 0x0000002e78756e69;
+
+ /* 3) Gentoo/Alpha. */
+ /* A / o o t n e G */
+ serial_no[0] = 0x412f6f6f746e6547;
+ /* .a h p l */
+ serial_no[1] = 0x0000002e6168706c;
+
+ /* 4) Gentoo MILO. */
+ /* M o o t n e G */
+ serial_no[0] = 0x4d206f6f746e6547;
+ /* . O L I */
+ serial_no[1] = 0x000000002e4f4c49;
+
+ /* 5) |d|i|g|i|t|a|l| */
+ /* i | g | i | d | */
+ serial_no[0] = 0x697c677c697c647c;
+ /* | l | a | t | */
+ serial_no[1] = 0x007c6c7c617c747c;
+
+ printf ("serial number:\t%s\n", (char*) serial_no);
+ return (0);
+}
diff --git a/sys-boot/milo/files/objstrip.c b/sys-boot/milo/files/objstrip.c
new file mode 100644
index 00000000000..bbda4033070
--- /dev/null
+++ b/sys-boot/milo/files/objstrip.c
@@ -0,0 +1,282 @@
+/*
+ * arch/alpha/boot/tools/objstrip.c
+ *
+ * Strip the object file headers/trailers from an executable (ELF or ECOFF).
+ *
+ * Copyright (C) 1996 David Mosberger-Tang.
+ */
+/*
+ * 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
+ * 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 <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <sys/fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include <linux/a.out.h>
+#include <linux/coff.h>
+#include <linux/param.h>
+#include <linux/string.h>
+#ifdef __ELF__
+# include <asm/elf.h>
+# include <linux/elf.h>
+#endif
+
+/* bootfile size must be multiple of BLOCK_SIZE: */
+#define BLOCK_SIZE 512
+
+const char * prog_name;
+
+
+void
+usage (void)
+{
+ fprintf(stderr,
+ "usage: %s [-v] -p file primary\n"
+ " %s [-vb] file [secondary]\n", prog_name, prog_name);
+ exit(1);
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ size_t nwritten, tocopy, n, mem_size, fil_size, pad = 0;
+ int fd, ofd, i, j, verbose = 0, primary = 0;
+ char buf[8192], *inname;
+ struct exec * aout; /* includes file & aout header */
+ long offset;
+#ifdef __ELF__
+ struct elfhdr *elf;
+ struct elf_phdr *elf_phdr; /* program header */
+ unsigned long long e_entry;
+#endif
+
+ prog_name = argv[0];
+
+ for (i = 1; i < argc && argv[i][0] == '-'; ++i) {
+ for (j = 1; argv[i][j]; ++j) {
+ switch (argv[i][j]) {
+ case 'v':
+ verbose = ~verbose;
+ break;
+
+ case 'b':
+ pad = BLOCK_SIZE;
+ break;
+
+ case 'p':
+ primary = 1; /* make primary bootblock */
+ break;
+ }
+ }
+ }
+
+ if (i >= argc) {
+ usage();
+ }
+ inname = argv[i++];
+
+ fd = open(inname, O_RDONLY);
+ if (fd == -1) {
+ perror("open");
+ exit(1);
+ }
+
+ ofd = 1;
+ if (i < argc) {
+ ofd = open(argv[i++], O_WRONLY | O_CREAT | O_TRUNC, 0666);
+ if (fd == -1) {
+ perror("open");
+ exit(1);
+ }
+ }
+
+ if (primary) {
+ /* generate bootblock for primary loader */
+
+ unsigned long bb[64], sum = 0;
+ struct stat st;
+ off_t size;
+ int i;
+
+ if (ofd == 1) {
+ usage();
+ }
+
+ if (fstat(fd, &st) == -1) {
+ perror("fstat");
+ exit(1);
+ }
+
+ size = (st.st_size + BLOCK_SIZE - 1) & ~(BLOCK_SIZE - 1);
+ memset(bb, 0, sizeof(bb));
+ strcpy((char *) bb, "Linux SRM bootblock");
+ bb[60] = size / BLOCK_SIZE; /* count */
+ bb[61] = 1; /* starting sector # */
+ bb[62] = 0; /* flags---must be 0 */
+ for (i = 0; i < 63; ++i) {
+ sum += bb[i];
+ }
+ bb[63] = sum;
+ if (write(ofd, bb, sizeof(bb)) != sizeof(bb)) {
+ perror("boot-block write");
+ exit(1);
+ }
+ printf("%lu\n", size);
+ return 0;
+ }
+
+ /* read and inspect exec header: */
+
+ if (read(fd, buf, sizeof(buf)) < 0) {
+ perror("read");
+ exit(1);
+ }
+
+#ifdef __ELF__
+ elf = (struct elfhdr *) buf;
+
+ if (elf->e_ident[0] == 0x7f && strncmp(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);
+ exit(1);
+ }
+ if (!elf_check_arch(elf)) {
+ fprintf(stderr, "%s: is not for this processor (e_machine=%d)\n",
+ prog_name, elf->e_machine);
+ exit(1);
+ }
+ if (elf->e_phnum != 1) {
+ fprintf(stderr,
+ "%s: %d program headers (forgot to link with -N?)\n",
+ prog_name, elf->e_phnum);
+ }
+
+ e_entry = elf->e_entry;
+
+ lseek(fd, elf->e_phoff, SEEK_SET);
+ if (read(fd, buf, sizeof(*elf_phdr)) != sizeof(*elf_phdr)) {
+ perror("read");
+ exit(1);
+ }
+
+ elf_phdr = (struct elf_phdr *) buf;
+ offset = elf_phdr->p_offset;
+ mem_size = elf_phdr->p_memsz;
+ fil_size = elf_phdr->p_filesz;
+
+ /* work around ELF bug: */
+ if (elf_phdr->p_vaddr < e_entry) {
+ unsigned long delta = e_entry - elf_phdr->p_vaddr;
+ offset += delta;
+ mem_size -= delta;
+ fil_size -= delta;
+ elf_phdr->p_vaddr += delta;
+ }
+
+ if (verbose) {
+ fprintf(stderr, "%s: extracting %#016lx-%#016lx (at %lx)\n",
+ prog_name, (long) elf_phdr->p_vaddr,
+ elf_phdr->p_vaddr + fil_size, offset);
+ }
+ } else
+#endif
+ {
+ aout = (struct exec *) buf;
+
+ if (!(aout->fh.f_flags & COFF_F_EXEC)) {
+ fprintf(stderr, "%s: %s is not in executable format\n",
+ prog_name, inname);
+ exit(1);
+ }
+
+ if (aout->fh.f_opthdr != sizeof(aout->ah)) {
+ fprintf(stderr, "%s: %s has unexpected optional header size\n",
+ prog_name, inname);
+ exit(1);
+ }
+
+ if (N_MAGIC(*aout) != OMAGIC) {
+ fprintf(stderr, "%s: %s is not an OMAGIC file\n",
+ prog_name, inname);
+ exit(1);
+ }
+ offset = N_TXTOFF(*aout);
+ fil_size = aout->ah.tsize + aout->ah.dsize;
+ mem_size = fil_size + aout->ah.bsize;
+
+ if (verbose) {
+ fprintf(stderr, "%s: extracting %#016lx-%#016lx (at %lx)\n",
+ prog_name, aout->ah.text_start,
+ aout->ah.text_start + fil_size, offset);
+ }
+ }
+
+ if (lseek(fd, offset, SEEK_SET) != offset) {
+ perror("lseek");
+ exit(1);
+ }
+
+ if (verbose) {
+ fprintf(stderr, "%s: copying %lu byte from %s\n",
+ prog_name, (unsigned long) fil_size, inname);
+ }
+
+ tocopy = fil_size;
+ while (tocopy > 0) {
+ n = tocopy;
+ if (n > sizeof(buf)) {
+ n = sizeof(buf);
+ }
+ tocopy -= n;
+ if ((size_t) read(fd, buf, n) != n) {
+ perror("read");
+ exit(1);
+ }
+ do {
+ nwritten = write(ofd, buf, n);
+ if ((ssize_t) nwritten == -1) {
+ perror("write");
+ exit(1);
+ }
+ n -= nwritten;
+ } while (n > 0);
+ }
+
+ if (pad) {
+ mem_size = ((mem_size + pad - 1) / pad) * pad;
+ }
+
+ tocopy = mem_size - fil_size;
+ if (tocopy > 0) {
+ fprintf(stderr,
+ "%s: zero-filling bss and aligning to %lu with %lu bytes\n",
+ prog_name, pad, (unsigned long) tocopy);
+
+ memset(buf, 0x00, sizeof(buf));
+ do {
+ n = tocopy;
+ if (n > sizeof(buf)) {
+ n = sizeof(buf);
+ }
+ nwritten = write(ofd, buf, n);
+ if ((ssize_t) nwritten == -1) {
+ perror("write");
+ exit(1);
+ }
+ tocopy -= nwritten;
+ } while (tocopy > 0);
+ }
+ return 0;
+}
diff --git a/sys-boot/milo/metadata.xml b/sys-boot/milo/metadata.xml
new file mode 100644
index 00000000000..1b9d222defa
--- /dev/null
+++ b/sys-boot/milo/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>alpha</herd>
+ <longdescription lang="en">
+ On Intel based PC systems, the BIOS firmware sets up the system and
+ then loads the image to be run from the boot block of a DOS file
+ system. This is more or less what MILO does on an Alpha based system,
+ however there are several interesting differences between BIOS firmware
+ and MILO, not least of which is that MILO includes and uses standard
+ Linux device drivers unmodified. MILO is firmware, unlike LILO, which
+ relies on the BIOS firmware to get itself loaded.
+ </longdescription>
+</pkgmetadata>
diff --git a/sys-boot/milo/milo-2.4.18.ebuild b/sys-boot/milo/milo-2.4.18.ebuild
new file mode 100644
index 00000000000..5c4d40688f6
--- /dev/null
+++ b/sys-boot/milo/milo-2.4.18.ebuild
@@ -0,0 +1,232 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit flag-o-matic eutils
+
+# Currently tested Systems:
+#
+# Ruffian: UX164, BX164
+#
+
+DESCRIPTION="The Alpha MIniLOader, for Alpha Machines without SRM"
+HOMEPAGE="http://milo.core-systems.de/"
+
+# ive tested this, and it seems to make little difference
+# which kernel version you use, so it makes sense to use the
+# latest available 2.2 kernel with the latest bugfixes/drivers/etc.
+
+kernel_version="2.2.25"
+milo_version="2.2-18"
+ldmilo_patch="20010430"
+
+# milo-2.2-18.tar.bz2 :- latest milo sources
+# linux-2.2.25.tar.bz2 :- latest linux 2.2 kernel sources
+# ldmilo-patched-20010430 :- Ruffian ldmilo utility, with bugfixes by Jay Eastabrook
+# linload.exe :- linload utility (ldmilo equivalent for non-ruffians).
+
+SRC_URI="http://www.suse.de/~stepan/source/milo-${milo_version}.tar.bz2
+ mirror://kernel/linux/kernel/v2.2/linux-${kernel_version}.tar.bz2
+ http://dev.gentoo.org/~taviso/milo/ldmilo-patched-${ldmilo_patch}
+ http://ftp.namesys.com/pub/reiserfs-for-2.2/linux-2.2.20-reiserfs-3.5.35.diff.bz2
+ http://dev.gentoo.org/~taviso/milo/linload.exe
+ http://www.ibiblio.org/pub/Linux/docs/HOWTO/MILO-HOWTO"
+
+#
+# milo license is dec palcode license, dec bios emulation license, and gpl-2 rolled
+# into one big ugly package.
+#
+# the dec licenses say you can basically do anything you like, including modify
+# and redistribute for profit or non-profit, as long as its for use with Alpha
+# architecture.
+#
+
+LICENSE="MILO"
+SLOT="0"
+
+KEYWORDS="-* ~alpha"
+IUSE=""
+
+DEPEND="sys-apps/kbd
+ >=sys-apps/sed-4"
+RDEPEND="sys-fs/mtools"
+
+S=${WORKDIR}/milo-${milo_version}
+
+# You can change the default MILO serial
+# number here, the MILO default is "Linux_is_Great!".
+# There are some below that i have made you can
+# use if you want, just uncomment the one you like.
+#
+# if you want to see how this works, to make your own
+# look at mkserial_no.c in the filesdir.
+#
+##### Linux_is_Great! ###################
+#milo_serial_number0=0x73695f78756e694c
+#milo_serial_number1=0x002174616572475f
+#
+##### Gentoo Linux. #####################
+milo_serial_number0=0x4c206f6f746e6547
+milo_serial_number1=0x0000002e78756e69
+#
+##### Gentoo/Alpha. #####################
+#milo_serial_number0=0x412f6f6f746e6547
+#milo_serial_number1=0x0000002e6168706c
+#
+##### Gentoo MILO. ######################
+#milo_serial_number0=0x4d206f6f746e6547
+#milo_serial_number1=0x000000002e4f4c49
+#
+##### |d|i|g|i|t|a|l| ###################
+#milo_serial_number0=0x697c677c697c647c
+#milo_serial_number1=0x007c6c7c617c747c;
+#
+
+src_unpack() {
+ # unpack everything the kernel and milo sources
+ unpack linux-${kernel_version}.tar.bz2
+ unpack milo-${milo_version}.tar.bz2
+
+ # gcc3 fixes, and some tweaks to get a build, also
+ # reiserfs support for the kernel (and milo).
+ cd ${WORKDIR}/linux; epatch ${FILESDIR}/linux-${kernel_version}-gcc3-milo.diff || die
+ cd ${WORKDIR}/linux; epatch ${DISTDIR}/linux-2.2.20-reiserfs-3.5.35.diff.bz2 || die
+ cd ${S}; epatch ${FILESDIR}/milo-${milo_version}-gcc3-gentoo.diff || die
+}
+
+src_compile() {
+ unset MILO_ARCH
+ for arches in "Alpha-XLT XLT" \
+ "Alpha-XL XL" \
+ "AlphaBook1 BOOK1" \
+ "Avanti AVANTI" \
+ "Cabriolet CABRIOLET" \
+ "EB66 EB66" \
+ "EB66+ EB66P" \
+ "EB64+ EB64P" \
+ "EB164 EB164" \
+ "PC164 PC164" \
+ "LX164 LX164" \
+ "SX164 SX164" \
+ "Noname NONAME" \
+ "Takara TAKARA" \
+ "Mikasa MIKASA" \
+ "Alcor ALCOR" \
+ "Miata MIATA" \
+ "Ruffian RUFFIAN" \
+ "Platform2000 P2K" \
+ "UDB UDB"
+ do
+ if [ -z "${MILO_IMAGE}" ]; then
+ MILO_ARCH="${MILO_ARCH} \"${arches}\""
+ else
+ if echo ${arches} | grep -i ${MILO_IMAGE}; then
+ MILO_ARCH="\"${arches}\""
+ fi
+ fi
+ done
+
+ if [ -z "${MILO_ARCH}" ]; then
+ eerror "Sorry, but ${MILO_IMAGE} doesnt look valid to me"
+ eerror "Consult the Alpha installation guide, or the ebuild"
+ eerror "for a list of available Alphas."
+ die "${MILO_IMAGE} not supported, or not recognised."
+ fi
+
+ sed -i "s!__MILO_ARCHES__!${MILO_ARCH}!g" ${S}/tools/scripts/build
+
+ ewarn
+ ewarn "seriously, this is going to take a while, go get some coffee..."
+ ewarn
+ einfo "this ebuild will build the standard MILO images, similar to those"
+ einfo "distributed with some distributions, and the images provided with"
+ einfo "the official MILO sources."
+ einfo
+ einfo "of course, the beauty of MILO is it can support any device supported"
+ einfo "by the linux kernel, so if you need support for non-standard hardware"
+ einfo "set the path to the .config you want in \$custom_milo_kernel_config and"
+ einfo "i will use it instead of the default."
+ ewarn
+
+ einfon "continuing in 10 seconds ..."
+ epause 10
+
+ # get kernel configured
+ cp ${custom_milo_kernel_config:-${S}/Documentation/config/linux-2.2.19-SuSE.config} \
+ ${WORKDIR}/linux/.config
+ cd ${WORKDIR}/linux; yes n | make oldconfig || die "unable to configure kernel."
+
+ # we're building a generic kernel that defaults to ev5, but theres no
+ # reason why we cant tweak the instruction set.
+ # im not sure if you can actually pull a system performance gain/faster
+ # boot from optimising milo, but at least you'll get a faster milo pager ;)
+ mcpu_flag="`get-flag mcpu`"
+ if [ ! -z "${mcpu_flag}" ]; then
+ sed -i "s/\(CFLAGS := \$(CFLAGS) \)-mcpu=ev5$/\1-mcpu=${mcpu_flag:-ev5}/g" \
+ ${WORKDIR}/linux/arch/alpha/Makefile
+ fi
+
+ # build the generic linux kernel, of course if you have
+ # hardware not supported by this generic kernel, you are free
+ # to hack it (or the .config used here).
+ einfo "building a generic kernel for use with milo..."
+ unset CC DISTCC_HOSTS; make dep vmlinux || die "unable to build generic kernel for milo."
+ cat ${FILESDIR}/objstrip.c > ${WORKDIR}/linux/arch/alpha/boot/tools/objstrip.c
+
+ # make the objstrip utility.
+ gcc ${WORKDIR}/linux/arch/alpha/boot/tools/objstrip.c -o \
+ ${WORKDIR}/linux/arch/alpha/boot/tools/objstrip || die "couldnt build objstrip."
+ einfo "kernel build complete."
+ einfo "building milo images..."
+
+ # we have a choice here, milo can set the serial number to just about
+ # anything we like, the milo author has chosen "Linux_is_Great!", which
+ # is a bit cheesy, but we will leave it as default if user hasnt chosen
+ # something else.
+ # see above for options.
+
+ append-flags -DMILO_SERIAL_NUMBER0="${milo_serial_number0:-0x73695f78756e694c}"
+ append-flags -DMILO_SERIAL_NUMBER1="${milo_serial_number1:-0x002174616572475f}"
+
+ # the Makefile missed this :-/
+ cd ${S}/tools/common; make || die "couldnt make commonlib."
+
+ # build all the milo images.
+ cd ${S}; tools/scripts/build || die "failed to build milo images."
+
+ # put the ldmilo utility there.
+ cp ${DISTDIR}/ldmilo-patched-${ldmilo_patch} ${S}/binaries/ldmilo.exe
+ cp ${DISTDIR}/linload.exe ${S}/binaries/linload.exe
+
+}
+
+src_install() {
+
+ cd ${S}; dodir /opt/milo
+ insinto /opt/milo
+
+ einfo "Installing MILO images..."
+ for i in binaries/*
+ do
+ einfo " ${i}"
+ doins ${i}
+ done
+
+ cd ${S}/Documentation
+
+ dodoc ChangeLog filesystem Nikita.Todo README.milo Todo LICENSE README.BSD Stuff WhatIsMilo \
+ ${FILESDIR}/README-gentoo ${FILESDIR}/mkserial_no.c ${DISTDIR}/MILO-HOWTO
+
+}
+
+pkg_postinst() {
+ einfo "The MILO images have been installed into /opt/milo."
+ einfo "There are instructions in /usr/share/doc/${P} for making MILO boot floppies."
+ einfo "Alternative methods, (flash, srm, debug monitor, etc) are described in the MILO-HOWTO."
+ einfo
+ einfo "The important docs to read are the README-gentoo and the MILO-HOWTO."
+ einfo
+ ewarn "PLEASE, PLEASE, PLEASE, let me know if this works or not, i need to know which systems"
+ ewarn "need tweaking, and which ones are good to go. You can email me at taviso@gentoo.org"
+ einfo
+}