r2558 - in trunk/utils: . mkvmlinuz mkvmlinuz/mkvmlinuz mkvmlinuz/mkvmlinuz/debian

Sven Luther luther@costa.debian.org
Fri, 25 Feb 2005 14:43:58 +0100


Author: luther
Date: 2005-02-25 14:43:57 +0100 (Fri, 25 Feb 2005)
New Revision: 2558

Added:
   trunk/utils/mkvmlinuz/
   trunk/utils/mkvmlinuz/mkvmlinuz/
   trunk/utils/mkvmlinuz/mkvmlinuz/debian/
   trunk/utils/mkvmlinuz/mkvmlinuz/debian/changelog
   trunk/utils/mkvmlinuz/mkvmlinuz/debian/conffiles
   trunk/utils/mkvmlinuz/mkvmlinuz/debian/control
   trunk/utils/mkvmlinuz/mkvmlinuz/debian/copyright
   trunk/utils/mkvmlinuz/mkvmlinuz/debian/dirs
   trunk/utils/mkvmlinuz/mkvmlinuz/debian/mkvmlinuz.sgml
   trunk/utils/mkvmlinuz/mkvmlinuz/debian/rules
   trunk/utils/mkvmlinuz/mkvmlinuz/mkvmlinuz
   trunk/utils/mkvmlinuz/mkvmlinuz/output
Log:
Adding mkvmlinuz to the svn repo, since i plan to do some work on it.


Added: trunk/utils/mkvmlinuz/mkvmlinuz/debian/changelog
===================================================================
--- trunk/utils/mkvmlinuz/mkvmlinuz/debian/changelog	2005-02-24 22:09:44 UTC (rev 2557)
+++ trunk/utils/mkvmlinuz/mkvmlinuz/debian/changelog	2005-02-25 13:43:57 UTC (rev 2558)
@@ -0,0 +1,91 @@
+mkvmlinuz (12) unstable; urgency=high
+
+  * Fixed PReP support for recent kernel versions (including vanilla
+    2.6.9-rc2 and Debian revision 2.6.8-7).
+
+ -- Jens Schmalzing <jensen@debian.org>  Mon,  4 Oct 2004 22:37:02 +0200
+
+mkvmlinuz (11) unstable; urgency=high
+
+  * Fixed NewWorld PowerMac support.
+
+ -- Jens Schmalzing <jensen@debian.org>  Sun,  3 Oct 2004 09:59:41 +0200
+
+mkvmlinuz (10) unstable; urgency=low
+
+  * Fixed miBoot support.
+
+  * Changed the internal name for NewWorld PowerMacs from newworld to the
+    slightly inaccurate pmac, since this is what the kernel Makefiles use.
+
+  * Documented the possible subarchitectures in the manpage.
+
+ -- Jens Schmalzing <jensen@debian.org>  Sat, 11 Sep 2004 21:09:55 +0200
+
+mkvmlinuz (9) unstable; urgency=low
+
+  * Added PPCBug support (closes: #269146).
+
+  * Added miBoot support.
+
+  * Made quiet operation the default, previous default is now activated by
+    asking for verbose operation.
+
+  * Added an option to prevent guessing the name of an initrd.
+
+ -- Jens Schmalzing <jensen@debian.org>  Tue, 31 Aug 2004 13:51:15 +0200
+
+mkvmlinuz (8) unstable; urgency=low
+
+  * Fixed spurious output when not using an initrd.
+
+  * Discard command output if verbose flag is not set (closes: Bug#263452).
+
+ -- Jens Schmalzing <jensen@debian.org>  Wed,  4 Aug 2004 17:33:19 +0200
+
+mkvmlinuz (7) unstable; urgency=low
+
+  * Set a default output file location in /etc/mkvmlinuz/output.
+
+  * Added PReP support (closes: #252427, #256074).
+
+ -- Jens Schmalzing <jensen@debian.org>  Thu,  8 Jul 2004 09:23:38 +0200
+
+mkvmlinuz (6) unstable; urgency=low
+
+  * Added an option to prevent compressing an already compressed ramdisk
+    image (closes: Bug#252489).
+
+ -- Jens Schmalzing <jensen@debian.org>  Tue, 15 Jun 2004 20:01:23 +0200
+
+mkvmlinuz (5) unstable; urgency=low
+
+  * Fixed a typo (closes: Bug#252036).
+
+ -- Jens Schmalzing <jensen@debian.org>  Tue,  1 Jun 2004 10:38:00 +0200
+
+mkvmlinuz (4) unstable; urgency=low
+
+  * Fixed CHRP support by adding the directory to the addnote call
+    (closes: Bug#251043).
+
+ -- Jens Schmalzing <jensen@debian.org>  Wed, 26 May 2004 21:36:39 +0200
+
+mkvmlinuz (3) unstable; urgency=low
+
+  * Added Pegasos support.
+
+ -- Jens Schmalzing <jensen@debian.org>  Fri, 21 May 2004 08:42:45 +0200
+
+mkvmlinuz (2) unstable; urgency=low
+
+  * Added a missing option to the getopts call.
+
+ -- Jens Schmalzing <jensen@debian.org>  Thu, 13 May 2004 21:55:37 +0200
+
+mkvmlinuz (1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Jens Schmalzing <jensen@debian.org>  Fri, 23 Apr 2004 10:19:35 +0200
+

Added: trunk/utils/mkvmlinuz/mkvmlinuz/debian/conffiles
===================================================================
--- trunk/utils/mkvmlinuz/mkvmlinuz/debian/conffiles	2005-02-24 22:09:44 UTC (rev 2557)
+++ trunk/utils/mkvmlinuz/mkvmlinuz/debian/conffiles	2005-02-25 13:43:57 UTC (rev 2558)
@@ -0,0 +1 @@
+/etc/mkvmlinuz/output

Added: trunk/utils/mkvmlinuz/mkvmlinuz/debian/control
===================================================================
--- trunk/utils/mkvmlinuz/mkvmlinuz/debian/control	2005-02-24 22:09:44 UTC (rev 2557)
+++ trunk/utils/mkvmlinuz/mkvmlinuz/debian/control	2005-02-25 13:43:57 UTC (rev 2558)
@@ -0,0 +1,21 @@
+Source: mkvmlinuz
+Section: devel
+Priority: optional
+Maintainer: Jens Schmalzing <jensen@debian.org>
+Build-Depends: docbook-to-man, debhelper (>= 4.0.0)
+Standards-Version: 3.6.0
+
+Package: mkvmlinuz
+Architecture: powerpc
+Depends: binutils
+Description: create a kernel to boot a PowerPC machine from Open Firmware
+ .
+ This little program takes a PowerPC Linux kernel as an uncompressed
+ ELF image file (usually called vmlinux or somesuch) and adds boot
+ code and possibly a ramdisk to create a compressed kernel image that
+ can be booted directly from Open Firmware, thus eliminating the need
+ for a second-stage bootloader such as yaboot or quik.  This is
+ especially useful on PowerPC sub-architectures that do not have a
+ bootloader at all, but may also come handy for install kernels,
+ netboot systems and the like.
+

Added: trunk/utils/mkvmlinuz/mkvmlinuz/debian/copyright
===================================================================
--- trunk/utils/mkvmlinuz/mkvmlinuz/debian/copyright	2005-02-24 22:09:44 UTC (rev 2557)
+++ trunk/utils/mkvmlinuz/mkvmlinuz/debian/copyright	2005-02-25 13:43:57 UTC (rev 2558)
@@ -0,0 +1,10 @@
+This package was created by Jens Schmalzing <jensen@debian.org> on
+Fri, 23 Apr 2004 10:19:35 +0200.
+
+This package consists of a small shell script that performs a tiny
+portion of the PowerPC kernel generation originally encoded in the
+Makefiles in the Linux kernel tree, namely in arch/ppc/boot/.
+
+Linux is copyrighted by Linus Torvalds and others, and is licensed
+under the GNU General Public License, which on Debian systems will
+be installed in the file /usr/share/common-licenses/GPL.

Added: trunk/utils/mkvmlinuz/mkvmlinuz/debian/dirs
===================================================================
--- trunk/utils/mkvmlinuz/mkvmlinuz/debian/dirs	2005-02-24 22:09:44 UTC (rev 2557)
+++ trunk/utils/mkvmlinuz/mkvmlinuz/debian/dirs	2005-02-25 13:43:57 UTC (rev 2558)
@@ -0,0 +1,3 @@
+etc/mkvmlinuz
+usr/sbin
+usr/share/man/man8
\ No newline at end of file

Added: trunk/utils/mkvmlinuz/mkvmlinuz/debian/mkvmlinuz.sgml
===================================================================
--- trunk/utils/mkvmlinuz/mkvmlinuz/debian/mkvmlinuz.sgml	2005-02-24 22:09:44 UTC (rev 2557)
+++ trunk/utils/mkvmlinuz/mkvmlinuz/debian/mkvmlinuz.sgml	2005-02-25 13:43:57 UTC (rev 2558)
@@ -0,0 +1,295 @@
+<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
+
+  <!-- Fill in your name for FIRSTNAME and SURNAME. -->
+  <!ENTITY dhfirstname "<firstname>Jens</firstname>">
+  <!ENTITY dhsurname   "<surname>Schmalzing</surname>">
+  <!ENTITY dhdate      "<date>Sep 11, 2004</date>">
+  <!ENTITY dhsection   "<manvolnum>8</manvolnum>">
+  <!ENTITY dhemail     "<email>jensen@debian.org</email>">
+  <!ENTITY dhusername  "Jens Schmalzing">
+  <!ENTITY dhucpackage "<refentrytitle>MKVMLINUZ</refentrytitle>">
+  <!ENTITY dhpackage   "mkvmlinuz">
+
+  <!ENTITY debian      "<productname>Debian</productname>">
+  <!ENTITY gnu         "<acronym>GNU</acronym>">
+  <!ENTITY gpl         "&gnu; <acronym>GPL</acronym>">
+]>
+
+<refentry>
+  <refentryinfo>
+    <address>
+      &dhemail;
+    </address>
+    <author>
+      &dhfirstname;
+      &dhsurname;
+    </author>
+    <copyright>
+      <year>2004</year>
+      <holder>&dhusername;</holder>
+    </copyright>
+    &dhdate;
+  </refentryinfo>
+  <refmeta>
+    &dhucpackage;
+
+    &dhsection;
+  </refmeta>
+  <refnamediv>
+    <refname>&dhpackage;</refname>
+
+    <refpurpose>create a kernel to boot a PowerPC machine from Open Firmware</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>&dhpackage;</command>
+      <arg><option>-o <replaceable>output</replaceable></option></arg>
+      <arg><option>-a <replaceable>arch</replaceable></option></arg>
+      <arg><option>-k <replaceable>kernel</replaceable></option></arg>
+      <arg><option>-s <replaceable>sysmap</replaceable></option></arg>
+      <arg><option>-i <replaceable>initrd</replaceable></option></arg>
+      <arg><option>-d <replaceable>objdir</replaceable></option></arg>
+      <arg><option>-r <replaceable>release</replaceable></option></arg>
+      <arg><option>-n</option></arg>
+      <arg><option>-z</option></arg>
+      <arg><option>-v</option></arg>
+      <arg><replaceable>release</replaceable> <arg><replaceable>kernel</replaceable></arg></arg>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1>
+    <title>DESCRIPTION</title>
+
+    <para>This manual page documents briefly the
+      <command>&dhpackage;</command> command.</para>
+
+    <para><command>&dhpackage;</command> is a program that takes a
+      PowerPC Linux kernel as an uncompressed ELF image file (usually
+      called <filename>vmlinux</filename> or somesuch) and adds boot
+      code and possibly a ramdisk to create a compressed kernel image
+      that can be booted directly from Open Firmware, thus eliminating
+      the need for a second-stage bootloader such as
+      <command>yaboot</command> or <command>quik</command>.</para>
+
+  </refsect1>
+  <refsect1>
+    <title>OPTIONS</title>
+
+    <variablelist>
+      <varlistentry>
+        <term><option>-o</option></term>
+        <listitem>
+          <para>Specify the path to the output file for the compressed
+          kernel image.  If this option is not set, the file
+          <filename>/etc/mkvmlinuz/output</filename> is sourced, in
+          the hope that it will set the shell variable
+          <varname>output</varname> to something useful.  If this
+          doesn't work either, the program stops with a non-zero exit
+          code.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-a</option></term>
+        <listitem>
+          <para>Specify the PowerPC sub-architecture to build for.  If
+          this option is not set, the program will guess based on the
+          contents of /proc/cpuinfo.  At the moment, the following
+          values are supported:</para>
+	  <variablelist>
+	    <varlistentry>
+	      <term>chrp</term>
+	      <listitem>
+		<para>
+		  This build a compressed kernel for CHRP machines.
+		</para>
+	      </listitem>
+	    </varlistentry>
+	    <varlistentry>
+	      <term>coff</term>
+	      <listitem>
+		<para>
+		  The COFF format is understood by the Open Firmware of
+		  many OldWorld PowerMacs.  You will need it if you
+		  intend to boot a Linux kernel directly from Open
+		  Firmware.  Note that you can also choose between a
+		  variety of boot loaders for that platform, such as
+		  <command>quik</command>, <command>BootX</command>, and
+		  <command>miBoot</command>.
+		</para>
+	      </listitem>
+	    </varlistentry>
+	    <varlistentry>
+	      <term>miboot</term>
+	      <listitem>
+		<para>
+		  This prepares the Linux kernel for booting from a
+		  <command>miBoot</command> floppy.
+		</para>
+	      </listitem>
+	    </varlistentry>
+	    <varlistentry>
+	      <term>pmac</term>
+	      <listitem>
+		<para>
+		  While most NewWorld PowerMacs use the bootloader
+		  <command>yaboot</command>, they can also start
+		  directly from Open Firmware.
+		</para>
+	      </listitem>
+	    </varlistentry>
+	    <varlistentry>
+	      <term>prep</term>
+	      <listitem>
+		<para>
+		  The PReP sub-architecture is mainly found on old
+		  RS/6000 systems.  After creating the compressed
+		  kernel, you have to move it to a bootable location,
+		  either by <command>dd</command>ing it onto the PReP
+		  boot partition of a hard disk, or writing it to a CD
+		  using the <option>-prep-boot </option> option of
+		  <command>mkisofs</command>.
+		</para>
+	      </listitem>
+	    </varlistentry>
+	    <varlistentry>
+	      <term>ppcbug</term>
+	      <listitem>
+		<para>
+		  PPCBug is strictly a sub-sub-architecture of the
+		  above-mentioned PReP.  It uses a slightly different
+		  wrapper around the compressed kernel, though.
+		</para>
+	      </listitem>
+	    </varlistentry>
+	  </variablelist>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+	<term><option>-k</option></term>
+	<listitem>
+	  <para>Specify the path to the Linux kernel as an
+	    uncompressed ELF image file.  Usually, this filename
+	    contains <filename>vmlinux</filename> in some form.  If
+	    this option is not set, the program will make guesses
+	    based on the release number and the currently running
+	    kernel.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+	<term><option>-s</option></term>
+	<listitem>
+	  <para>Specify the path to the System.map file.  This will
+	  greatly enlarge the resulting image, and is only needed if
+	  you intend to use the in-kernel debugger
+	  <command>xmon</command>.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+	<term><option>-i</option></term>
+	<listitem>
+	  <para>Specify the path to a ramdisk (initrd) image to
+	  include in the compressed kernel image.  If this option is
+	  not set, the program will look in a location analogous to
+	  the kernel image location, but will continue without a
+	  ramdisk if nothing is found there.  This guess can be turned
+	  off with the <option>-n</option> option.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+	<term><option>-d</option></term>
+	<listitem>
+	  <para>Specify the directory containing boot code.  If this
+	  option is not set, the program will try a default directory
+	  and the current directory.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+	<term><option>-r</option></term>
+	<listitem>
+	  <para>Specify the release of the kernel.  This option is
+	  only used for guessing path names that have not been specified
+	  explicitly.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+	<term><option>-n</option></term>
+	<listitem>
+	  <para>Do not attempt to find an initrd image file if none
+	  was specified with the <option>-i</option> option.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+	<term><option>-z</option></term>
+	<listitem>
+	  <para>Assume the initrd image file is already compressed.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+	<term><option>-v</option></term>
+	<listitem>
+	  <para>Print progress messages, and echo commands as they are
+	  executed.</para>
+	</listitem>
+      </varlistentry>
+    </variablelist>
+
+    <para>It is also possible to specify the release number and the
+    kernel image file as the first and second non-option arguments,
+    respectively.  However, the values are only used if they are not
+    already given as option arguments.</para>
+
+  </refsect1>
+  <refsect1>
+    <title>FILES</title>
+
+    <variablelist>
+      <varlistentry>
+        <term>/etc/mkvmlinuz/output</term>
+        <listitem>
+          <para>A shell script fragment that specifies the output file
+          for the compressed kernel image.  It is sourced by
+          &dhpackage; if the output file is not specified on the
+          command line, and therefore should set the shell variable
+          <varname>output</varname> at some point.  The shell
+          variables <varname>arch</varname>,
+          <varname>kernel</varname>, <varname>sysmap</varname>,
+          <varname>initrd</varname>, <varname>objdir</varname>, and
+          <varname>release</varname> are all set at this point and can
+          be used to construct the filename. </para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+
+  </refsect1>
+  <refsect1>
+    <title>AUTHOR</title>
+
+    <para>This manual page was written by &dhusername; &dhemail; for
+    the &debian; system (but may be used by others).  Permission is
+    granted to copy, distribute and/or modify this document under the
+    terms of the &gnu; General Public License, Version 2 any later
+    version published by the Free Software Foundation.  </para>
+
+    <para>On Debian systems, the complete text of the &gnu; General
+    Public License can be found in
+    <filename>/usr/share/common-licenses/GPL</filename>.
+    </para>
+
+  </refsect1>
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:2
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:nil
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->

Added: trunk/utils/mkvmlinuz/mkvmlinuz/debian/rules
===================================================================
--- trunk/utils/mkvmlinuz/mkvmlinuz/debian/rules	2005-02-24 22:09:44 UTC (rev 2557)
+++ trunk/utils/mkvmlinuz/mkvmlinuz/debian/rules	2005-02-25 13:43:57 UTC (rev 2558)
@@ -0,0 +1,65 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+INSTALL_DATA = install -m 644 -o root -g root
+INSTALL_EXEC = install -m 755 -o root -g root
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+	touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp mkvmlinuz.8
+	dh_testdir
+	touch build-stamp
+
+%.8:	debian/%.sgml
+	/usr/bin/docbook-to-man $< > $@
+
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+
+	rm -f mkvmlinuz.8
+
+	dh_clean 
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k 
+	dh_installdirs
+
+	$(INSTALL_EXEC) mkvmlinuz $(CURDIR)/debian/tmp/usr/sbin
+	$(INSTALL_DATA) mkvmlinuz.8 $(CURDIR)/debian/tmp/usr/share/man/man8
+	$(INSTALL_DATA) output $(CURDIR)/debian/tmp/etc/mkvmlinuz
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs 
+	dh_installdocs
+	dh_installman
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure


Property changes on: trunk/utils/mkvmlinuz/mkvmlinuz/debian/rules
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/utils/mkvmlinuz/mkvmlinuz/mkvmlinuz
===================================================================
--- trunk/utils/mkvmlinuz/mkvmlinuz/mkvmlinuz	2005-02-24 22:09:44 UTC (rev 2557)
+++ trunk/utils/mkvmlinuz/mkvmlinuz/mkvmlinuz	2005-02-25 13:43:57 UTC (rev 2558)
@@ -0,0 +1,295 @@
+#!/bin/sh
+
+# usage information
+usage() {
+    echo 'usage:'
+    echo ' -o <output>  - path to output file for compressed kernel image'
+    echo ' -a <arch>    - PowerPC sub-architecture'
+    echo ' -k <kernel>  - path to kernel image file in ELF format'
+    echo ' -s <sysmap>  - path to System.map file'
+    echo ' -i <initrd>  - path to initrd image file'
+    echo ' -d <objdir>  - path to directory with additional object files'
+    echo ' -r <release> - kernel release number'
+    echo ' -n           - do not use an initrd'
+    echo ' -z           - assume the initrd image file is already compressed'
+    echo ' -v           - verbose operation (print commands)'
+
+    exit 0
+}
+
+# echo a shell command if desired, and execute it
+do_cmd() {
+    if test -n "$verbose"; then
+	echo $@
+	eval $@
+    else
+	eval $@ > /dev/null 2>&1
+    fi
+    return
+}
+
+# parse command line
+while getopts o:k:s:i:d:r:a:nzv option; do
+    case "$option" in
+	o) output=$OPTARG ;;
+	k) kernel=$OPTARG ;;
+	s) sysmap=$OPTARG ;;
+	i) initrd=$OPTARG ;;
+	d) objdir=$OPTARG ;;
+	r) release=$OPTARG ;;
+	a) arch=$OPTARG ;;
+	n) noinitrd="Yes" ;;
+	z) compressed="Yes" ;;
+	v) verbose="Yes" ;;
+	*) usage; exit 0 ;;
+    esac
+done
+
+# use non-option arguments as release version and kernel image file if needed
+shift $((OPTIND-1))
+if test -z "$release" -a -n "$1"; then
+    release=$1
+fi
+if test -z "$kernel" -a -n "$2"; then
+    kernel=$2
+fi
+
+# if no sub-architecture was specified, read it from /proc
+if test -z "$arch"; then
+    case $(grep ^machine /proc/cpuinfo) in
+	*PReP*Blackhawk*) arch=ppcbug ;;
+	*PReP*) arch=prep ;;
+	*CHRP*) arch=chrp ;;
+	*)
+	    case $(grep ^pmac-generation /proc/cpuinfo) in
+		*NewWorld) arch=pmac ;;
+		*OldWorld) arch=coff ;;
+	    esac
+	    ;;
+    esac
+fi
+
+test -z "$verbose" || echo === Building for sub-architecture $arch.
+
+# if no kernel was specified, try to find one
+if test -z "$kernel"; then
+
+    # guess the location of a kernel
+    if kernel=/boot/vmlinux-$release; test -n "$release" -a -r $kernel; then
+	:
+    elif kernel=/boot/vmlinux-$(uname -r); test -r $kernel; then
+	:
+    else
+	kernel=""
+    fi
+
+    # we couldn't find a kernel, and therefore give up
+    if test -z "$kernel"; then
+	echo Could not find a kernel image file, please specify one.
+	exit 1
+    fi
+
+    # sanitize the location of the kernel
+    kernel=$(readlink -f $kernel)
+
+fi
+
+test -z "$verbose" || echo === Using kernel image file $kernel.
+
+# if no initrd was specified, try to find one that goes with the kernel
+if test -z "$noinitrd" -a -z "$initrd"; then
+
+    # guess the location of an initrd, but don't try too hard
+    if initrd=${kernel/vmlinux/initrd.img}; test -r $initrd; then
+	:
+    else
+	initrd=""
+    fi
+
+    # sanitize the location of the initrd
+    if test -n "$initrd"; then
+	initrd=$(readlink -f $initrd)
+    fi
+
+fi
+
+test -z "$verbose" -o -z "$initrd" || echo === Using initrd image file $initrd.
+
+# if no release was specified, extract it from the kernel image name
+if test -z "$release"; then
+    release=$(echo $kernel | sed s/.*vmlinux-//)
+    if echo $release | grep -q '2\.[46]\.[0-9]*'; then
+	:
+    else
+	release=""
+    fi
+fi
+
+test -z "$verbose" || echo === Release version seems to be $release.
+
+# if no object file directory was specified, try to find one
+if test -z "$objdir"; then
+
+    # try a default location, then use the current directory
+    if objdir=/usr/lib/kernel-image-$release; test -d $objdir; then
+	:
+    else
+	objdir="$PWD"
+    fi
+fi
+
+test -z "$verbose" || echo === Using object files from $objdir.
+
+# if no output file was specified, source the configuration file
+if test -z "$output" -a -r /etc/mkvmlinuz/output; then
+    . /etc/mkvmlinuz/output
+fi
+
+# we absolutely need an output file, and won't attempt guesses
+if test -z "$output"; then
+    echo Please specify an output file.
+    exit 1
+fi
+
+test -z "$verbose" || echo === Building a bootable compressed kernel image in $output.
+
+# create a work directory
+work=$(mktemp -d)
+
+test -z "$verbose" || echo === Doing build in $work.
+
+# utilities
+ADDNOTE=$objdir/utils/addnote
+HACKOFF=$objdir/utils/hack-coff
+MKNOTE=$objdir/utils/mknote
+MKPREP=$objdir/utils/mkprep
+MKBUGBOOT=$objdir/utils/mkbugboot
+LD=ld
+OBJCOPY=objcopy
+
+GZIP="--force --best"
+
+# libraries and common object files
+libs=$objdir/lib
+objs=$objdir/obj
+case "$arch" in
+    prep|ppcbug)
+	test -d $objs/simple && objs=$objs/simple
+	if test -r $objs/legacy.o; then prepmap=legacy; else prepmap=prepmap; fi
+	OBJS="$objs/head.o $objs/relocate.o $objs/$prepmap.o $objs/misc.o $objs/misc-prep.o $objs/mpc10x_memory.o"
+	LIBS="$libs/common.a $libs/ppc.a $libs/of.a"
+	;;
+    pmac)
+	test -d $objs/openfirmware && objs=$objs/openfirmware
+	OBJS="$objs/start.o $objs/misc.o $objs/common.o $objs/newworldmain.o"
+	LIBS="$libs/lib.a $libs/ppc.a $libs/of.a $libs/common.a"
+	;;
+    *)
+	test -d $objs/openfirmware && objs=$objs/openfirmware
+	OBJS="$objs/start.o $objs/misc.o $objs/common.o $objs/${arch}main.o"
+	LIBS="$libs/lib.a $libs/ppc.a $libs/of.a $libs/common.a"
+	;;
+esac
+
+# off we go...
+
+# create the compressed kernel image file
+test -z "$verbose" || echo === Creating compressed kernel image vmlinux.gz...
+do_cmd $OBJCOPY -O binary $kernel $work/vmlinux
+do_cmd gzip $work/vmlinux
+
+# create the compressed initrd image file
+if test -n "$initrd"; then
+    test -z "$verbose" || echo === Creating compressed initrd image initrd.gz...
+    if test -n "$compressed"; then
+	do_cmd cp -p $initrd $work/initrd.gz
+    else
+	do_cmd cp -p $initrd $work/initrd
+	do_cmd gzip $work/initrd
+    fi
+fi
+
+# create the raw ELF image file; this is not needed for the miBoot image
+if test "$arch" != miboot; then
+    test -z "$verbose" || echo === Putting everything into ELF image file image.o...
+    do_cmd $OBJCOPY -R .comment $objs/dummy.o $work/image.o
+    do_cmd $OBJCOPY $work/image.o $work/image.o \
+	--add-section=.image=$work/vmlinux.gz \
+	--set-section-flags=.image=contents,alloc,load,readonly,data
+    if test -n "$sysmap"; then
+	do_cmd $OBJCOPY $work/image.o $work/image.o \
+	    --add-section=.sysmap=$sysmap \
+	    --set-section-flags=.sysmap=contents,alloc,load,readonly,data
+    fi
+    if test -n "$initrd"; then
+	do_cmd $OBJCOPY $work/image.o $work/image.o \
+	    --add-section=.ramdisk=$work/initrd.gz \
+	    --set-section-flags=.ramdisk=contents,alloc,load,readonly,data
+    fi
+fi
+
+# link everything into the final image file and make it bootable
+vmlinuz=$work/vmlinuz.$arch
+LD_ARGS="-T $objdir/boot/ld.script"
+OBJCOPY_ARGS="-R .comment"
+test -z "$verbose" || echo === Creating bootable kernel image file vmlinuz.$arch...
+case $arch in
+    chrp)
+	LD_ARGS="$LD_ARGS -e _start -Ttext 0x00800000"
+	do_cmd $LD -o $vmlinuz $LD_ARGS $objs/crt0.o $OBJS $work/image.o $LIBS
+	do_cmd $OBJCOPY $OBJCOPY_ARGS $vmlinuz $vmlinuz
+	do_cmd cp -p $objdir/boot/note $work
+	do_cmd $ADDNOTE $vmlinuz
+	;;
+    coff)
+	LD_ARGS="$LD_ARGS -e _start -Ttext 0x00500000 -Bstatic"
+	OBJCOPY_ARGS="-O aixcoff-rs6000 -R .stab -R .stabstr $OBJCOPY_ARGS"
+	do_cmd $LD -o $vmlinuz $LD_ARGS $objs/coffcrt0.o $OBJS $work/image.o $LIBS
+	do_cmd $OBJCOPY $OBJCOPY_ARGS $vmlinuz $vmlinuz
+	do_cmd $HACKOFF $vmlinuz
+	;;
+    miboot)
+	OBJCOPY_ARGS="-O aixcoff-rs6000 -R .stab -R .stabstr $OBJCOPY_ARGS"
+	do_cmd $OBJCOPY $OBJCOPY_ARGS --add-section=image=$work/vmlinux.gz $objs/dummy.o $vmlinuz
+	if test -n "$initrd"; then
+	    do_cmd $OBJCOPY $OBJCOPY_ARGS --add-section=initrd=$work/initrd.gz $vmlinuz $vmlinuz
+	fi
+	;;
+    pmac)
+	LD_ARGS="$LD_ARGS -e _start -Ttext 0x01000000"
+	OBJCOPY_ARGS="--add-section=.note=$work/note $OBJCOPY_ARGS"
+	do_cmd $LD -o $vmlinuz $LD_ARGS $objs/crt0.o $OBJS $LIBS $work/image.o
+	do_cmd $MKNOTE > $work/note
+	do_cmd $OBJCOPY $OBJCOPY_ARGS $vmlinuz $vmlinuz
+	;;
+    ppcbug)
+	LD_ARGS="$LD_ARGS -Ttext 0x00800000 -Bstatic"
+	OBJCOPY_ARGS="-O elf32-powerpc $OBJCOPY_ARGS -R .stab -R .stabstr -R .sysmap"
+	do_cmd $LD -o $vmlinuz $LD_ARGS $OBJS $work/image.o $LIBS
+	do_cmd $OBJCOPY $OBJCOPY_ARGS $vmlinuz $vmlinuz.tmp
+	do_cmd $MKBUGBOOT $vmlinuz.tmp $vmlinuz
+	;;
+    prep)
+	LD_ARGS="$LD_ARGS -Ttext 0x00800000 -Bstatic"
+	OBJCOPY_ARGS="-O elf32-powerpc $OBJCOPY_ARGS -R .stab -R .stabstr -R .sysmap"
+	do_cmd $LD -o $vmlinuz $LD_ARGS $OBJS $work/image.o $LIBS
+	do_cmd $OBJCOPY $OBJCOPY_ARGS $vmlinuz $vmlinuz.tmp
+	do_cmd $MKPREP -pbp $vmlinuz.tmp $vmlinuz
+	;;
+    *)
+	echo Sorry, I do not know how to handle PowerPC sub-architecture $arch.
+esac
+
+# move bootable kernel image to its final location
+if test -e $vmlinuz; then
+    test -z "$verbose" || echo === Moving bootable kernel image file to $output...
+    if test -e $output; then
+	echo Output file $output exists, attempting to back it up...
+	mv $output $output.old 2> /dev/null
+    fi
+    cat $vmlinuz > $output
+fi
+
+# clean up
+test -z "$verbose" || echo === Cleaning up...
+rm -rf $work


Property changes on: trunk/utils/mkvmlinuz/mkvmlinuz/mkvmlinuz
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/utils/mkvmlinuz/mkvmlinuz/output
===================================================================
--- trunk/utils/mkvmlinuz/mkvmlinuz/output	2005-02-24 22:09:44 UTC (rev 2557)
+++ trunk/utils/mkvmlinuz/mkvmlinuz/output	2005-02-25 13:43:57 UTC (rev 2558)
@@ -0,0 +1,27 @@
+# This is a shell script fragment that is sourced by mkvmlinuz(8) in
+# order to determine the output file for the compressed kernel image.
+# if the output file is not specified on the command line.  Therefore,
+# it should set the shell variable "output" at some point.
+
+# When this fragment is sourced, the following shell variables are set
+# and may be used to construct the filename:
+#
+# arch    - PowerPC sub-architecture
+# kernel  - path to kernel image file in uncompressed ELF format
+# sysmap  - path to System.map file
+# initrd  - path to ramdisk (initrd) image file
+# objdir  - path to directory with additional object files
+# release - kernel release number
+
+# Example:
+output=/boot/vmlinuz-$release
+
+# Simple example:
+#output=/vmlinuz
+
+# Sophisticated example:
+#if test -z "$initrd"; then
+#output=/boot/vmlinuz-$release.$arch
+#else
+#output=/boot/vmlinuz-initrd-$release.$arch
+#fi