diff options
author | Seemant Kulleen <seemant@gentoo.org> | 2003-12-09 08:13:57 +0000 |
---|---|---|
committer | Seemant Kulleen <seemant@gentoo.org> | 2003-12-09 08:13:57 +0000 |
commit | 3a09a380ef4470365e58aaf172a8dc633083f35c (patch) | |
tree | a20110c13e04001056e70b856e8b6543d8c57ca8 /sys-boot/milo | |
parent | added sys-boot category for bootloaders (diff) | |
download | gentoo-2-3a09a380ef4470365e58aaf172a8dc633083f35c.tar.gz gentoo-2-3a09a380ef4470365e58aaf172a8dc633083f35c.tar.bz2 gentoo-2-3a09a380ef4470365e58aaf172a8dc633083f35c.zip |
moved from sys-apps to sys-boot
Diffstat (limited to 'sys-boot/milo')
-rw-r--r-- | sys-boot/milo/ChangeLog | 29 | ||||
-rw-r--r-- | sys-boot/milo/Manifest | 9 | ||||
-rw-r--r-- | sys-boot/milo/files/README-gentoo | 99 | ||||
-rw-r--r-- | sys-boot/milo/files/digest-milo-2.4.18 | 6 | ||||
-rw-r--r-- | sys-boot/milo/files/linux-2.2.25-gcc3-milo.diff | 123 | ||||
-rw-r--r-- | sys-boot/milo/files/milo-2.2-18-gcc3-gentoo.diff | 174 | ||||
-rw-r--r-- | sys-boot/milo/files/mkserial_no.c | 45 | ||||
-rw-r--r-- | sys-boot/milo/files/objstrip.c | 282 | ||||
-rw-r--r-- | sys-boot/milo/metadata.xml | 12 | ||||
-rw-r--r-- | sys-boot/milo/milo-2.4.18.ebuild | 242 |
10 files changed, 1021 insertions, 0 deletions
diff --git a/sys-boot/milo/ChangeLog b/sys-boot/milo/ChangeLog new file mode 100644 index 000000000000..39423146cb71 --- /dev/null +++ b/sys-boot/milo/ChangeLog @@ -0,0 +1,29 @@ +# ChangeLog for sys-apps/milo +# Copyright 2000-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sys-boot/milo/ChangeLog,v 1.1 2003/12/09 08:12:43 seemant Exp $ + +*milo-2.4.18 (08 Dec 2003) + + 08 Dec 2003; Seemant Kulleen <seemant@gentoo.org> metadata.xml, + milo-2.4.18.ebuild, files/README-gentoo, files/linux-2.2.25-gcc3-milo.diff, + files/milo-2.2-18-gcc3-gentoo.diff, files/mkserial_no.c, files/objstrip.c: + moved from sys-apps to sys-boot + + 16 Sep 2003; Seemant Kulleen <seemant@gentoo.org> milo-2.4.18.ebuild: + dependency from app-admin/mtools to sys-fs/mtools + + 05 Jun 2003; Tavis Ormandy <taviso@gentoo.org> milo-2.4.18.ebuild, + files/milo-2.2-18-gcc3-gentoo.diff: + by setting the MILO_IMAGE variable, users can select which images are built. + + 05 Jun 2003; Tavis Ormandy <taviso@gentoo.org> milo-2.4.18.ebuild: + updating some uri's. + +*milo-2.4.18 (03 Jun 2003) + + 03 Jun 2003; Tavis Ormandy <taviso@gentoo.org> milo-2.4.18.ebuild, + files/README-gentoo, files/linux-2.2.25-gcc3-milo.diff, + files/milo-2.2-18-gcc3-gentoo.diff, files/mkserial_no.c, files/objstrip.c: + Initial import, the Alpha MIniLOader, bootloader for machines + without SRM, or special cases where aboot is not appropriate. + diff --git a/sys-boot/milo/Manifest b/sys-boot/milo/Manifest new file mode 100644 index 000000000000..1afce7f3f3b5 --- /dev/null +++ b/sys-boot/milo/Manifest @@ -0,0 +1,9 @@ +MD5 8f3df15e8df3b641a13c71bc7d576264 milo-2.4.18.ebuild 8073 +MD5 1dda452daeb2b472f7d956ed1b9b7aae ChangeLog 1259 +MD5 382a839b2dd3b36aee659eba1be42e2d metadata.xml 752 +MD5 987873fb766bc62dcb7336015388e4e3 files/mkserial_no.c 1264 +MD5 0d52b7b08a86538142aa8652017f15e9 files/milo-2.2-18-gcc3-gentoo.diff 5619 +MD5 f6830f117d7528a50b53e85150040d73 files/linux-2.2.25-gcc3-milo.diff 3542 +MD5 4f7cadb7dd636d407b0477e5302fbbe1 files/objstrip.c 6126 +MD5 e004906c1c2084229f429011fcb5c46b files/README-gentoo 3508 +MD5 50c0136152336ca93b808adb1e49a98d files/digest-milo-2.4.18 389 diff --git a/sys-boot/milo/files/README-gentoo b/sys-boot/milo/files/README-gentoo new file mode 100644 index 000000000000..3ca8858ab0bb --- /dev/null +++ b/sys-boot/milo/files/README-gentoo @@ -0,0 +1,99 @@ +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-boot/milo/files/README-gentoo,v 1.1 2003/12/09 08:12:43 seemant Exp $ +# +############################################## +# 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/digest-milo-2.4.18 b/sys-boot/milo/files/digest-milo-2.4.18 new file mode 100644 index 000000000000..fedd19e6bec9 --- /dev/null +++ b/sys-boot/milo/files/digest-milo-2.4.18 @@ -0,0 +1,6 @@ +MD5 8b119c6baeca145f1c11057973be9be0 milo-2.2-18.tar.bz2 1074725 +MD5 ba722ead5245c19ce70d34343c515773 linux-2.2.25.tar.bz2 15791211 +MD5 dfc036835be3ee020624613b81314c7e ldmilo-patched-20010430 18944 +MD5 7f0a743ef03a4c91435964b6813f48c3 linux-2.2.20-reiserfs-3.5.35.diff.bz2 154943 +MD5 ff9b4a42903dc6a20e950ace6f7027d4 linload.exe 7168 +MD5 c41dff13e25647dbb95500d039d0c016 MILO-HOWTO 52455 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 000000000000..d99769f91c9f --- /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 000000000000..2fa897df6e90 --- /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 000000000000..b4650447584f --- /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 000000000000..bbda40330708 --- /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 000000000000..1f77966e45f9 --- /dev/null +++ b/sys-boot/milo/metadata.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>no-herd</herd> +<maintainer> + <email>taviso@gentoo.org</email> + <name>Tavis Ormandy</name> +</maintainer> +<longdescription> +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 000000000000..7c5f192dd8ee --- /dev/null +++ b/sys-boot/milo/milo-2.4.18.ebuild @@ -0,0 +1,242 @@ +# Copyright 1999-2003 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-boot/milo/milo-2.4.18.ebuild,v 1.1 2003/12/09 08:12:43 seemant Exp $ + +inherit flag-o-matic eutils ccc + +# Currently tested Systems: +# +# Ruffian: UX164, BX164 +# + +DESCRIPTION="The Alpha MIniLOader, for Alpha Machines without SRM" +HOMEPAGE="http://www.suse.de/~stepan/" + +# 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 + http://www.kernel.org/pub/linux/kernel/v2.2/linux-${kernel_version}.tar.bz2 + http://cvs.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://cvs.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="ev6" + +DEPEND="sys-apps/kbd + >=sys-apps/sed-4" +RDEPEND="sys-fs/mtools" + +PROVIDE="virtual/bootloader" + +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() { + # no ccc sorry :( + is-ccc && die "sorry, ccc not supported." + + 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..." + for ((i=10;i>0;i--)) + do + echo -en "${BAD}${i} " # removed \a, might annoy some users. + sleep 1 + done + echo ${NORMAL} + + # 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 +} |