181fc9f29e5db8894f11ef29fcaa246a87ec7b0d
[petitboot] / utils / ps3-kboot-0.1-petitboot.patch
1 Patch for the Ubuntu (feisty) ps3-kboot package, to add petitboot support.
2
3 Just apply this patch, download libtwin-0.0.1.tar.gz and petitboot-0.0.1.tar.gz
4 to the dl/ directory, and build.
5
6 More info at http://ozlabs.org/~jk/projects/petitboot/
7
8 --- ps3-kboot.orig/ps3-kboot-0.1/Makefile       2007-04-05 20:10:44.000000000 +1000
9 +++ ps3-kboot/ps3-kboot-0.1/Makefile    2007-04-04 20:54:40.000000000 +1000
10 @@ -20,6 +20,9 @@
11  LOCAL_KERNEL_CONFIG=$(PWD)/config/kernel-config
12  LOCAL_KBOOT_CONF=$(PWD)/config/kboot.conf
13  LOCAL_FSTAB=$(PWD)/config/fstab
14 +LOCAL_UDEV_RULES=$(PWD)/config/65-persistent-storage.rules \
15 +                $(PWD)/config/99-petitboot.rules \
16 +               $(PWD)/config/20-input-names.rules
17  KBOOT_MESSAGE=$(PWD)/config/message
18  KBOOT_FEATURES=$(PWD)/config/kboot-features
19  
20 @@ -38,6 +40,14 @@
21  BUSYBOX_DIR=busybox-$(BUSYBOX_VERSION)
22  BUSYBOX_PACKAGE=busybox-$(BUSYBOX_VERSION).tar.bz2
23  
24 +TWIN_VERSION=0.0.2
25 +TWIN_DIR=libtwin-$(TWIN_VERSION)
26 +TWIN_PACKAGE=libtwin-$(TWIN_VERSION).tar.gz
27 +
28 +PETITBOOT_VERSION=0.0.1
29 +PETITBOOT_DIR=petitboot-$(PETITBOOT_VERSION)
30 +PETITBOOT_PACKAGE=petitboot-$(PETITBOOT_VERSION).tar.gz
31 +
32  # ----- General settings ------------------------------------------------------
33  
34  all: otheros.bld
35 @@ -48,14 +58,21 @@
36  root: root-meta/installed/userspace \
37                 root-meta/installed/kexec-tools \
38                 root-meta/installed/busybox \
39 -               Makefile scripts/kboot \
40 +               root-meta/installed/twin \
41 +               root-meta/installed/petitboot \
42 +               Makefile scripts/kboot scripts/petitboot-init \
43                 utils/readline utils/getctty \
44                 $(LOCAL_KBOOT_CONF) $(KBOOT_MESSAGE) \
45 -               $(KBOOT_FEATURES) $(LOCAL_FSTAB)
46 +               $(KBOOT_FEATURES) $(LOCAL_FSTAB) \
47 +               $(LOCAL_UDEV_RULES)
48         rm -f root/etc/{hosts,passwd,kboot.conf,message}
49         rm -rf root/tmp root/dev
50 +       rm -rf root/include root/usr/include
51 +       find root/ -name '*.a' -o -name '*.la' -exec rm {} \;
52         mkdir -p root/etc root/tmp root/proc root/dev root/sys
53         mkdir -p root/mnt/tmp root/mnt/root root/bin root/sbin
54 +       mkdir -p root/var/tmp/mnt
55 +       mkdir -p root/etc/udev/rules.d
56         [ -e root/dev/console ] || mknod root/dev/console c 5 1
57         [ -e root/dev/null ] || mknod root/dev/null c 1 3
58         [ -e root/dev/tty ] || mknod root/dev/tty c 5 0
59 @@ -66,15 +83,18 @@
60         cp "$(KBOOT_MESSAGE)" root/etc/
61         cp "$(LOCAL_FSTAB)" root/etc/
62         cp "$(KBOOT_FEATURES)" root/etc/
63 +       cp $(LOCAL_UDEV_RULES) root/etc/udev/rules.d/
64         touch root/etc/mtab
65         install -D -m755  scripts/kboot root/sbin/kboot
66 +       install -D -m755  scripts/petitboot-init root/sbin/petitboot-init
67         install -D -s -m755 utils/readline root/bin/readline
68         install -D -s -m755 utils/getctty root/sbin/getctty
69 -       ln -sf /sbin/kboot root/init
70 -       for FILE in $$( find root/bin root/sbin \
71 +       ln -sf /sbin/petitboot-init root/init
72 +       for FILE in $$( find root/bin root/sbin root/lib/udev \
73             -type f -perm -100 ) ; do \
74             LIBS=$$( ldd $$FILE | awk '/=>.*\.so/ { print $$3 }' | grep -v fakeroot ) ; \
75             for LIB in $$LIBS ; do \
76 +               [ -e root/$$LIB ] && continue; \
77                 LIB_PATH=$$( echo $$LIB | sed -e 's/[^/]*$$//' ) ; \
78                 mkdir -p root/$$LIB_PATH ; \
79                 cp $$LIB root/$$LIB_PATH ; \
80 @@ -133,6 +153,10 @@
81         install -m755 -D /sbin/udevtrigger root/sbin/udevtrigger
82         install -m755 -D /sbin/udevsettle root/sbin/udevsettle
83         install -m644 -D /etc/udev/udev.conf root/etc/udev/udev.conf
84 +       # udev helpers
85 +       while read helper; do install -m755 -D /lib/udev/$$helper \
86 +               root/lib/udev/$$helper; done < config/udev-helpers
87 +       cp -a /lib/udev/devices root/lib/udev/
88         # ps3pf-utils stuff
89         install -m755 -D /sbin/other-os-flash-util \
90                 $(PWD)/root/sbin/other-os-flash-util
91 @@ -199,6 +223,57 @@
92                 root/sbin/kexec
93         touch $@
94  
95 +# ----- twin library ----------------------------------------------------------
96 +
97 +$(TWIN_DIR)/.twin-extracted: \
98 +         dl/$(TWIN_PACKAGE)
99 +       tar xfz dl/$(TWIN_PACKAGE)
100 +       for i in `ls patches/twin/$(TWIN_VERSION)/*patch*` ; do \
101 +         patch -d $(TWIN_DIR) -p1 < $$i ; \
102 +       done
103 +       touch $@
104 +
105 +$(TWIN_DIR)/.twin-configured: \
106 +         $(TWIN_DIR)/.twin-extracted
107 +       ( cd $(TWIN_DIR) && \
108 +         ./configure --prefix=/ --disable-x11 $(GNU_ARCH); )
109 +       touch $@
110 +
111 +$(TWIN_DIR)/.twin-built: \
112 +         $(TWIN_DIR)/.twin-configured
113 +       make -C $(TWIN_DIR)
114 +       touch $@
115 +
116 +root-meta/installed/twin: \
117 +         $(TWIN_DIR)/.twin-built
118 +       mkdir -p root root-meta/installed
119 +       make -C $(TWIN_DIR) DESTDIR=$(PWD)/root install
120 +       strip root/lib/libtwin.so
121 +       rm root/lib/libtwin.a
122 +       touch $@
123 +
124 +# ----- petitboot GUI ----------------------------------------------------------
125 +
126 +$(PETITBOOT_DIR)/.petitboot-extracted: \
127 +         dl/$(PETITBOOT_PACKAGE)
128 +       tar xfz dl/$(PETITBOOT_PACKAGE)
129 +       for i in `ls patches/petitboot/$(PETITBOOT_VERSION)/*patch*` ; do \
130 +         patch -d $(PETITBOOT_DIR) -p1 < $$i ; \
131 +       done
132 +       touch $@
133 +
134 +$(PETITBOOT_DIR)/.petitboot-built: \
135 +         $(PETITBOOT_DIR)/.petitboot-extracted root-meta/installed/twin
136 +       make -C $(PETITBOOT_DIR) PREFIX=/ "TWIN_CFLAGS=-I$(PWD)/root/include" \
137 +               "TWIN_LDFLAGS=-L$(PWD)/root/lib -ltwin -ljpeg -lpng -lz"
138 +       touch $@
139 +
140 +root-meta/installed/petitboot: \
141 +         $(PETITBOOT_DIR)/.petitboot-built
142 +       mkdir -p root root-meta/installed
143 +       make -C $(PETITBOOT_DIR) PREFIX=/ DESTDIR=$(PWD)/root/ install
144 +       strip root/sbin/petitboot root/sbin/udev-helper
145 +       touch $@
146  
147  # ----- kboot's utilities -----------------------------------------------------
148  
149 @@ -213,6 +288,7 @@
150  # ---- Cleanup ----------------------------------------------------------------
151  
152  clean:
153 -       rm -rf $(KERNEL_DIR) $(KEXEC_TOOLS_DIR) $(BUSYBOX_DIR)
154 +       rm -rf $(KERNEL_DIR) $(KEXEC_TOOLS_DIR) $(BUSYBOX_DIR) $(TWIN_DIR) \
155 +               $(PETITBOOT_DIR)
156         rm -rf root root-meta otheros.bld initrd.bin
157         rm -f otheros.bld initrd.bin utils/getctty utils/readline
158 diff -urN ps3-kboot.orig/ps3-kboot-0.1/config/65-persistent-storage.rules ps3-kboot/ps3-kboot-0.1/config/65-persistent-storage.rules
159 --- ps3-kboot.orig/ps3-kboot-0.1/config/65-persistent-storage.rules     1970-01-01 10:00:00.000000000 +1000
160 +++ ps3-kboot/ps3-kboot-0.1/config/65-persistent-storage.rules  2007-04-03 10:08:03.000000000 +1000
161 @@ -0,0 +1,61 @@
162 +# persistent storage links: /dev/{disk,tape}/{by-id,by-uuid,by-label,by-path,by-name}
163 +# scheme based on "Linux persistent device names", 2004, Hannes Reinecke <hare@suse.de>
164 +
165 +SUBSYSTEM!="block", GOTO="persistent_storage_end"
166 +
167 +KERNEL=="md*", ACTION=="add|change", PROGRAM="watershed -i udev-mdadm true", GOTO="persistent_storage_path_uuid"
168 +
169 +KERNEL=="dm-*", ACTION=="add|change", PROGRAM="devmap_name %M %m", NAME="mapper/$result", GOTO="persistent_storage_identify"
170 +KERNEL=="dm-*", ACTION=="add|change", NAME=""
171 +
172 +ACTION!="add", GOTO="persistent_storage_end"
173 +
174 +# skip rules for inappropriate block devices
175 +KERNEL=="ram*|loop*|fd*|nbd*|gnbd*", GOTO="persistent_storage_end"
176 +
177 +# never access non-cdrom removable ide devices, the drivers are causing event loops on open()
178 +KERNEL=="hd*[!0-9]", ATTRS{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end"
179 +KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end"
180 +
181 +# never add uuid information for whole disk
182 +ATTR{whole_disk}=="", GOTO="persistent_storage_end"
183 +
184 +# for partitions import parent information
185 +KERNEL=="*[0-9]", IMPORT{parent}="ID_*"
186 +
187 +# by-id (hardware serial number)
188 +KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode"
189 +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}"
190 +KERNEL=="hd*[0-9]", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n"
191 +
192 +KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394"
193 +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x"
194 +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode"
195 +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode"
196 +KERNEL=="dasd*[!0-9]", IMPORT{program}="dasd_id --export $tempnode"
197 +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
198 +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n"
199 +KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
200 +
201 +LABEL="persistent_storage_path_uuid"
202 +
203 +# by-path (shortest physical path)
204 +KERNEL=="*[!0-9]|sr*", IMPORT{program}="path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}"
205 +KERNEL=="st*", IMPORT{program}="path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}"
206 +KERNEL=="sr*|st*", GOTO="persistent_storage_end"
207 +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
208 +
209 +LABEL="persistent_storage_identify"
210 +
211 +# by-label/by-uuid (filesystem properties)
212 +KERNEL=="*[!0-9]", ATTR{removable}=="1", GOTO="persistent_storage_end"
213 +IMPORT{program}="vol_id --export $tempnode"
214 +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}"
215 +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}"
216 +
217 +# BIOS Enhanced Disk Device
218 +KERNEL=="*[!0-9]", IMPORT{program}="edd_id --export $tempnode"
219 +KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}"
220 +KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n"
221 +
222 +LABEL="persistent_storage_end"
223 diff -urN ps3-kboot.orig/ps3-kboot-0.1/config/99-petitboot.rules ps3-kboot/ps3-kboot-0.1/config/99-petitboot.rules
224 --- ps3-kboot.orig/ps3-kboot-0.1/config/99-petitboot.rules      1970-01-01 10:00:00.000000000 +1000
225 +++ ps3-kboot/ps3-kboot-0.1/config/99-petitboot.rules   2007-04-03 16:07:23.000000000 +1000
226 @@ -0,0 +1,2 @@
227 +# tell petitboot when we see new block devices ...
228 +SUBSYSTEM=="block",RUN+="/sbin/udev-helper"
229 diff -urN ps3-kboot.orig/ps3-kboot-0.1/config/udev-helpers ps3-kboot/ps3-kboot-0.1/config/udev-helpers
230 --- ps3-kboot.orig/ps3-kboot-0.1/config/udev-helpers    1970-01-01 10:00:00.000000000 +1000
231 +++ ps3-kboot/ps3-kboot-0.1/config/udev-helpers 2007-04-05 14:21:52.000000000 +1000
232 @@ -0,0 +1,12 @@
233 +devmap_name
234 +set_hwclock
235 +cdrom_id
236 +ata_id
237 +path_id
238 +scsi_id
239 +usb_id
240 +usb_device_name
241 +ide_media
242 +iftab_helper
243 +watershed
244 +vol_id
245 diff -urN ps3-kboot.orig/ps3-kboot-0.1/scripts/petitboot-init ps3-kboot/ps3-kboot-0.1/scripts/petitboot-init
246 --- ps3-kboot.orig/ps3-kboot-0.1/scripts/petitboot-init 1970-01-01 10:00:00.000000000 +1000
247 +++ ps3-kboot/ps3-kboot-0.1/scripts/petitboot-init      2007-04-05 15:37:48.000000000 +1000
248 @@ -0,0 +1,49 @@
249 +#!/bin/sh
250 +#
251 +# kboot - Kboot initialization and command-line interface
252 +#
253 +# Written 2005, 2006 by Werner Almesberger
254 +#
255 +
256 +if [ "x$0" = x/init ]; then
257 +    __sysinit=true
258 +else
259 +    __sysinit=false
260 +fi
261 +
262 +###############################################################################
263 +#
264 +# System setup and internal initialization
265 +#
266 +
267 +if $__sysinit; then
268 +    if [ ! -f /proc/partitions ]; then
269 +       mount -n -t proc none /proc
270 +    fi
271 +    if [ ! -d /sys/block ]; then
272 +       mount -n -t sysfs none /sys
273 +
274 +       # Borrowed from initramfs tools. No more hard coded sleep
275 +       echo "" > /proc/sys/kernel/hotplug
276 +       udevd --daemon
277 +       udevtrigger
278 +       udevsettle --timeout=15
279 +    fi
280 +fi
281 +
282 +while /bin/true;
283 +do
284 +       /sbin/petitboot -u
285 +
286 +       # clean up after petitboot
287 +       for dir in /var/tmp/mnt/*;
288 +       do
289 +               umount "$dir"
290 +               rmdir "$dir"
291 +       done
292 +done &
293 +
294 +while /bin/true;
295 +do
296 +       /sbin/getctty /dev/console /bin/sh
297 +done
298 --- ps3-kboot.orig/ps3-kboot-0.1/debian/control 2007-04-05 20:10:44.000000000 +1000
299 +++ ps3-kboot/ps3-kboot-0.1/debian/control      2007-04-03 15:54:04.000000000 +1000
300 @@ -2,7 +2,7 @@
301  Section: base
302  Priority: optional
303  Maintainer: Ubuntu Kernel Team <kernel-team@lists.ubuntu.com>
304 -Build-Depends: debhelper (>= 4.1.67), bzip2, cdbs, fakeroot, udev, ps3pf-utils, zlib1g-dev
305 +Build-Depends: debhelper (>= 4.1.67), bzip2, cdbs, fakeroot, udev, ps3pf-utils, libc6-dev, zlib1g-dev, libpng12-dev, libjpeg62-dev, pkg-config
306  Standards-Version: 3.6.1
307  
308  Package: ps3-kboot
309 --- ps3-kboot.orig/ps3-kboot-0.1/config/kernel-config   2007-06-27 14:25:08.000000000 +1000
310 +++ ps3-kboot/ps3-kboot-0.1/config/kernel-config 7-06-27 14:28:28.000000000 +1000
311 @@ -449,10 +449,13 @@
312  #
313  # Userland interfaces
314  #
315 -# CONFIG_INPUT_MOUSEDEV is not set
316 -# CONFIG_INPUT_JOYDEV is not set
317 +CONFIG_INPUT_MOUSEDEV=y
318 +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
319 +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
320 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
321 +CONFIG_INPUT_JOYDEV=y
322  # CONFIG_INPUT_TSDEV is not set
323 -# CONFIG_INPUT_EVDEV is not set
324 +CONFIG_INPUT_EVDEV=y
325  # CONFIG_INPUT_EVBUG is not set
326  
327  #
328 @@ -668,6 +671,7 @@
329  # CONFIG_USB_STORAGE_SDDR55 is not set
330  # CONFIG_USB_STORAGE_JUMPSHOT is not set
331  # CONFIG_USB_STORAGE_ALAUDA is not set
332 +# CONFIG_USB_STORAGE_ONETOUCH is not set
333  # CONFIG_USB_LIBUSUAL is not set
334  
335  #
336 --- /dev/null   2007-04-18 20:56:03.000000000 +1000
337 +++ ps3-kboot-0.1/ps3-kboot-0.1/config/20-input-names.rules   2007-06-27 14:34:05.000000000 +1000
338 @@ -0,0 +1,5 @@
339 +# Input devices, group under /dev/input
340 +KERNEL=="event[0-9]*",                 NAME="input/%k"
341 +KERNEL=="mice",                                NAME="input/%k"
342 +KERNEL=="mouse[0-9]*",                 NAME="input/%k"
343 +KERNEL=="js[0-9]*",                    NAME="input/%k"