summaryrefslogtreecommitdiffstats
path: root/scripts/mk-images.ppc
blob: 1d62482e4cc42856d8c57189c1b9113357df6a57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
COMMONMODULES="nfs fat vfat cramfs loop floppy"
FSMODS="msdos vfat ext3 reiserfs jfs xfs"
IDEMODS="ide-cd"
SCSIMODS="sd_mod sg sr_mod st"
USBMODS="ohci-hcd uhci-hcd hid usb-storage sd_mod sr_mod"
LATEUSBMODS="mousedev usb-storage"
LVMMODS="dm-mod dm-zero dm-snapshot dm-mirror"
RAIDMODS="md raid0 raid1 raid5 raid6"
SECSTAGE="$RAIDMODS $LVMMODS $FSMODS $IDEMODS $SCSIMODS $LATEUSBMODS"
NETMODULES="sungem tg3 ne2k-pci 3c59x 8139too olympic
	   de4x5 acenic pcnet32 tulip natsemi e100 e1000 airport"

SCSIMODULES="$SCSIMODS advansys aic7xxx initio sym53c8xx ipr"
ISERIESMODULES="iseries_veth veth viodasd viocd ipr"

# images we only want on the CD (usually for space reasons)
ISOMODULES="ehci-hcd ieee1394 ohci1394 sbp2"

prepareBootImage() {
    mkdir -p $TOPDESTPATH/ppc/chrp
    mkdir -p $TOPDESTPATH/images
}

makeBootImages() {
    echo "Building boot images for kernel $kernelvers"
    FAKEARCH=""

    if [ "$KERNELARCH" = "ppc64pseries" -o "$KERNELARCH" = "ppc64" ]; then
	echo "Building $KERNELARCH initrd"
	makeinitrd --initrdto $TOPDESTPATH/ppc/chrp/ramdisk.image.gz \
	    --initrdsize 8192 \
	    --loaderbin loader \
	    --modules "$COMMONMODULES $NETMODULES $SCSIMODULES $SCSIMODS $IDEMODS $ISOMODULES $USBMODS =scsi =net"

	mkdir -p $TOPDESTPATH/etc $TOPDESTPATH/ppc/chrp $TOPDESTPATH/images/pseries $TOPDESTPATH/images/mac64
	cp $KERNELROOT/boot/vmlinuz-* $TOPDESTPATH/ppc/chrp/vmlinuz
        cp $BOOTDISKDIR/yaboot.conf.pseries $TOPDESTPATH/etc/yaboot.conf
	cp $BOOTDISKDIR/bootinfo.txt $TOPDESTPATH/ppc/bootinfo.txt
	cp $IMGPATH/usr/lib/yaboot/yaboot $TOPDESTPATH/ppc/chrp
	$IMGPATH/usr/lib/yaboot/addnote $TOPDESTPATH/ppc/chrp/yaboot

	if [ -x $IMGPATH/usr/bin/mkzimage ]; then
		pushd $TOPDESTPATH/ppc/chrp
		cp $IMGPATH/usr/share/ppc64-utils/zImage.lds $TOPDESTPATH/ppc/chrp/zImage.lds
		$IMGPATH/usr/bin/mkzimage $TOPDESTPATH/ppc/chrp/vmlinuz no no $TOPDESTPATH/ppc/chrp/ramdisk.image.gz $KERNELROOT/boot/zImage.stub-* $TOPDESTPATH/images/pseries/netboot.img
		rm -f $TOPDESTPATH/ppc/chrp/zImage.lds
		popd
	fi

	# we also want to make a boot.iso here 
	mkdir -p $TOPDESTPATH/isopath/ppc/chrp $TOPDESTPATH/isopath/etc
	cp $TOPDESTPATH/etc/* $TOPDESTPATH/isopath/etc/
	cp $TOPDESTPATH/ppc/chrp/* $TOPDESTPATH/isopath/ppc/chrp
	cp $TOPDESTPATH/ppc/bootinfo.txt $TOPDESTPATH/isopath/ppc/bootinfo.txt

	# FIXME: this assumes the file gets there by magic
	cp $TOPDESTPATH/boot_image $TOPDESTPATH/isopath/boot_image
	mkisofs -quiet -generic-boot $TOPDESTPATH/isopath/boot_image -A "$PRODUCT $VERSION" -V "PBOOT" -J -R -T -allow-multidot -l -o $TOPDESTPATH/images/pseries/boot.iso $TOPDESTPATH/isopath
	rm -rf $TOPDESTPATH/isopath/
	
	cat > $TOPDESTPATH/images/pseries/README <<EOF
The files in this directory are for use in booting a pSeries 
machine.  They are as follows:
boot.iso - A bootable CD-ROM image for starting an installation on pSeries
netboot.img - A network boot image for starting an installation on pSeries

Images for installing on an iSeries machine can be found in the ppc/iSeries
directory.
EOF

	# Create the Mac G5 boot.iso
	mkdir -p $TOPDESTPATH/ppc/mac64
	cp $TOPDESTPATH/ppc/chrp/ramdisk.image.gz $TOPDESTPATH/ppc/mac64/
	cp $KERNELROOT/boot/vmlinuz-* $TOPDESTPATH/ppc/mac64/vmlinuz
	cp $BOOTDISKDIR/yaboot.conf.mac64 $TOPDESTPATH/ppc/mac64/yaboot.conf
	cp $BOOTDISKDIR/ofboot.b $TOPDESTPATH/ppc/mac64/ofboot.b
	cp $IMGPATH/usr/lib/yaboot/yaboot $TOPDESTPATH/ppc/mac64/

	# we also want to make a boot.iso here 
	mkdir -p $TOPDESTPATH/isopath/ppc/mac64
	cp $TOPDESTPATH/ppc/mac64/* $TOPDESTPATH/isopath/ppc/mac64/

	# Create the boot.iso
	mkisofs -quiet -o $TOPDESTPATH/images/mac64/boot.iso -part -hfs -T -r -l -J -A "$PRODUCT $VERSION" -sysid PPC -V "PBOOT" -volset "$VERSION" -volset-size 1 -volset-seqno 1 -hfs-volid "$VERSION" -hfs-bless "$TOPDESTPATH/isopath/ppc/mac64" -map $BOOTDISKDIR/mapping -magic $BOOTDISKDIR/magic -no-desktop -allow-multidot $TOPDESTPATH/isopath
	rm -rf $TOPDESTPATH/isopath/

    elif [ "$KERNELARCH" = "ppc64iseries" ]; then
	mkdir -p $TOPDESTPATH/ppc/iSeries

	echo "Building iSeries initrd"
	makeinitrd --initrdto $TOPDESTPATH/ppc/iSeries/ramdisk.image.gz \
	    --initrdsize 8192 \
	    --loaderbin loader \
	    --modules "$COMMONMODULES $NETMODULES $SCSIMODULES $IDEMODS $ISOMODULES $ISERIESMODULES =scsi =net"

	cp $KERNELROOT/boot/vmlinuz-* $TOPDESTPATH/ppc/iSeries/vmlinux
	cp $KERNELROOT/boot/System.map-* $TOPDESTPATH/ppc/iSeries/System.map

	$IMGPATH/usr/sbin/addSystemMap $TOPDESTPATH/ppc/iSeries/System.map $TOPDESTPATH/ppc/iSeries/vmlinux $TOPDESTPATH/ppc/iSeries/vmlinux.sm
	$IMGPATH/usr/sbin/addRamDisk $TOPDESTPATH/ppc/iSeries/ramdisk.image.gz $TOPDESTPATH/ppc/iSeries/System.map $TOPDESTPATH/ppc/iSeries/vmlinux.sm $TOPDESTPATH/ppc/iSeries/boot.img
	rm -f $TOPDESTPATH/ppc/iSeries/vmlinux.sm
    elif [ "$KERNELARCH" = "ppc" ]; then
	FAKEARCH="ppc"
	mkdir -p $TOPDESTPATH/ppc/mac $TOPDESTPATH/images/mac

        echo "Building ppc initrd"
        makeinitrd --initrdto $TOPDESTPATH/ppc/mac/ramdisk.image.gz \
            --initrdsize 8192 \
            --loaderbin loader \
            --modules "$COMMONMODULES $NETMODULES $SCSIMODULES $SCSIMODS $IDEMODS $ISOMODULES $USBMODS =scsi =net"

        mkdir -p $TOPDESTPATH/ppc/mac
        cp $KERNELROOT/boot/vmlinuz-* $TOPDESTPATH/ppc/mac/vmlinuz
        cp $BOOTDISKDIR/yaboot.conf.mac $TOPDESTPATH/ppc/mac/yaboot.conf
        cp $BOOTDISKDIR/ofboot.b $TOPDESTPATH/ppc/mac/ofboot.b
        cp $IMGPATH/usr/lib/yaboot/yaboot $TOPDESTPATH/ppc/mac/

        # we also want to make a boot.iso here 
        mkdir -p $TOPDESTPATH/isopath/ppc/mac
        cp $TOPDESTPATH/ppc/mac/* $TOPDESTPATH/isopath/ppc/mac/

        # Create the boot.iso
	mkisofs -quiet -o $TOPDESTPATH/images/mac/boot.iso -part -hfs -T -r -l -J -A "$PRODUCT $VERSION" -sysid PPC -V "PBOOT" -volset "$VERSION" -volset-size 1 -volset-seqno 1 -hfs-volid "$VERSION" -hfs-bless "$TOPDESTPATH/isopath/ppc/mac" -map $BOOTDISKDIR/mapping -magic $BOOTDISKDIR/magic -no-desktop -allow-multidot $TOPDESTPATH/isopath
        rm -rf $TOPDESTPATH/isopath/
    else
        echo "Unknown kernel arch: $KERNELARCH"
    fi
}

makeSecondStage() {
    makeinstimage "netstg" "$SECSTAGE $SCSIMODULES $IDEMODS =scsi"
    makeinstimage "hdstg" "$SECSTAGE $NETMODULES $IDEMODS =net"
    makemainmodules "$SECSTAGE $NETMODULES $SCSIMODULES $IDEMODS =scsi =net"
    makemainimage "stage2" "cramfs"
}