Gentoo Archives: gentoo-commits

From: "Michael Januszewski (spock)" <spock@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-apps/memtest86+/files: make-memtest86+-boot-floppy make-memtest86+-boot-floppy.1
Date: Thu, 26 Mar 2009 08:42:07
Message-Id: E1LmlA4-0007IS-BB@stork.gentoo.org
1 spock 09/03/26 08:42:04
2
3 Added: make-memtest86+-boot-floppy
4 make-memtest86+-boot-floppy.1
5 Log:
6 Add a script to install memtest86+ on floppy disks (bug #252996).
7 (Portage version: 2.1.6.10/cvs/Linux x86_64, RepoMan options: --force)
8
9 Revision Changes Path
10 1.1 sys-apps/memtest86+/files/make-memtest86+-boot-floppy
11
12 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/memtest86+/files/make-memtest86+-boot-floppy?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/memtest86+/files/make-memtest86+-boot-floppy?rev=1.1&content-type=text/plain
14
15 Index: make-memtest86+-boot-floppy
16 ===================================================================
17 #!/bin/sh
18 #
19 # Script for making a memtest86 boot floppy using GRUB as bootloader
20 #
21
22 # (c) 2003 Peter Loje Hansen <pl@××.dk>
23 # - original version
24 # (c) 2004 Yann Dirson <dirson@××××××.org>
25 # - added parameters
26 # - ability to work on a floppy image instead of a real floppy
27 # - adapted patches from Martin Koeppe <martin@××××××××××.de>, to use
28 # mtools and install full grub
29
30 # TODO:
31 # - add a flag to generate a default boot entry for (hd0)
32
33 set -e
34
35 MEMTEST=/boot/memtest86plus/memtest.bin
36 FLOPPYIMAGE=/dev/fd0
37 GRUBBIN=/sbin/grub
38 GRUBLIB=/lib/grub
39 MFORMAT=/usr/bin/mformat
40
41 arch=$(uname -m)
42
43 case "$arch" in
44 i386|i486|i686) GRUBARCH=i386-pc;;
45 x86_64) GRUBARCH=x86_64-pc;;
46 *) error "Unsupported architecture: $arch";;
47 esac
48
49 error()
50 {
51 echo >&2 "$0: $*"
52 exit 1
53 }
54
55 needsarg()
56 {
57 [ $1 -ge 2 ] || error "syntax error"
58 }
59
60 [ -d $GRUBLIB ] || error "Can't find $GRUBLIB - did you install a recent grub package (0.95+cvs20040624 or later) ?"
61 [ -x $MFORMAT ] || error "Can't find mformat - did you install the mtools package ?"
62
63 while [ $# -gt 0 ]
64 do
65 case "$1" in
66 --help) echo "$0 [--memtest $MEMTEST] [--floppyimage $FLOPPYIMAGE]"; exit 0 ;;
67 --memtest) needsarg $#; MEMTEST="$2"; shift ;;
68 --floppyimage) needsarg $#; FLOPPYIMAGE="$2"; shift ;;
69 *) error "syntax error" ;;
70 esac
71 shift
72 done
73
74 MOUNTPOINT=$(mktemp -d)
75
76 if [ -b "$FLOPPYIMAGE" ]
77 then
78 FINALDEV="$FLOPPYIMAGE"
79 FLOPPYIMAGE="$(mktemp)"
80 else
81 FINALDEV=""
82 fi
83
84 echo "* Creating msdos file system"
85 echo
86 if [ ! -s "$FLOPPYIMAGE" ]; then
87 # unless a non-empty image exists, create a blank one first
88 dd bs=1024 count=1440 if=/dev/zero of="$FLOPPYIMAGE"
89 fi
90 # FIXME: "-f 1440" should probably be dropped
91 mformat -i $FLOPPYIMAGE -f 1440 ::
92
93 mmd -i $FLOPPYIMAGE ::/boot
94 mmd -i $FLOPPYIMAGE ::/boot/grub
95
96 echo
97 echo "* Installing GRUB files"
98 mcopy -v -i "$FLOPPYIMAGE" - ::/boot/grub/menu.lst <<EOF
99 color green/black light-green/black
100 default 0
101 timeout 10
102 title memtest
103 kernel (fd0)/boot/memtest.bin
104 EOF
105 mcopy -v -i "$FLOPPYIMAGE" $GRUBLIB/$GRUBARCH/* ::/boot/grub
106
107 echo
108 echo "* Installing $MEMTEST"
109 mcopy -v -i "$FLOPPYIMAGE" "$MEMTEST" ::/boot/memtest.bin
110
111 echo
112 echo -n "* Installing GRUB"
113 $GRUBBIN --batch --device-map=/dev/null <<EOF
114 device (fd0) $FLOPPYIMAGE
115 root (fd0)
116 setup (fd0)
117 quit
118 EOF
119
120 if [ -n "$FINALDEV" ]; then
121 echo
122 echo "Insert a writable floppy for $FINALDEV and press enter"
123 read FOO
124
125 dd bs=1024 if="$FLOPPYIMAGE" of="$FINALDEV"
126 rm "$FLOPPYIMAGE"
127 fi
128
129
130
131 1.1 sys-apps/memtest86+/files/make-memtest86+-boot-floppy.1
132
133 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/memtest86+/files/make-memtest86+-boot-floppy.1?rev=1.1&view=markup
134 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/memtest86+/files/make-memtest86+-boot-floppy.1?rev=1.1&content-type=text/plain
135
136 Index: make-memtest86+-boot-floppy.1
137 ===================================================================
138 .\" Man page for make-memtest86+-boot-floppy
139
140 .TH make-memtest86+-boot-floppy 1
141
142 .SH NAME
143 make-memtest86+-boot-floppy \- create a memtest86+ boot-floppy using GRUB.
144
145 .SH SYNOPSIS
146
147 .B make-memtest86+-boot-floppy [ \-\-memtest
148 .I <path to memtest86+-image>
149 .B ] [ \-\-floppyimage
150 .I <path to floppyimage/device>
151 .B ]
152
153 .SH DESCRIPTION
154 .B make-memtest86+-boot-floppy
155 can create a memtest86+ boot floppy using GRUB as the bootloader.
156
157 .SH OPTIONS
158
159 .IP "\-\-memtest <path to the memtest-image>"
160 Path to the memtest86+-image, default is /boot/memtest86+.bin.
161
162 .IP "\-\-floppyimage <path to the floppyimage or device>"
163 File or device where the boot-image should be written to, default is /dev/fd0.
164
165 .IP "\-\-help"
166 Display a short message about the options of the tool.
167
168 .SH AUTHOR
169 This man-page has been written by Thomas Schmidt <thomas@××××××.de>
170 .PP
171 Permission is granted to copy, distribute and/or modify this document under
172 the terms of the GNU General Public License, Version 2 any
173 later version published by the Free Software Foundation.
174 .PP
175 On Debian systems, the complete text of the GNU General Public
176 License can be found in /usr/share/common\-licenses/GPL.