summaryrefslogtreecommitdiffstats
path: root/scripts/mk-images.ppc
blob: f8d14d4e006c867a218495a0bd3c8326edbb464e (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
COMMONMODULES="nfs fat vfat cramfs loop floppy"
FSMODS="msdos vfat ext3 reiserfs jfs"
IDEMODS="ide-cd"
SCSIMODS="sd_mod sg sr_mod st"
LATEUSBMODS="mousedev usb-storage"
SECSTAGE="raid0 raid1 raid5 lvm-mod $FSMODS $IDEMODS $SCSIMODS $LATEUSBMODS"
NETMODULES="sungem tg3 ne2k-pci 3c59x 8139too
	   de4x5 acenic pcnet32 tulip natsemi e100 e1000 airport"

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

# 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"

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

	mkdir -p $TOPDESTPATH/etc $TOPDESTPATH/ppc/chrp
	cp $KERNELROOT/boot/vmlinux-* $TOPDESTPATH/ppc/chrp/vmlinux
	cp $BOOTDISKDIR/yaboot.conf $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

	# 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 -generic-boot $TOPDESTPATH/isopath/boot_image -A "$PRODUCT $VERSION" -V "PBOOT" -J -R -T -allow-multidot -l -o $TOPDESTPATH/images/boot.iso $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"

	cp $KERNELROOT/boot/vmlinux-* $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
    else
	echo "Unknown kernel arch: $KERNELARCH"
    # mac?
    # echo "Building Mac initrd"
    # makeinitrd --initrdto $TOPDESTPATH/images/ramdisk.image.gz \
    #            --initrdsize 8192 \
    #            --loaderbin loader \
    #            --modules "nfs fat vfat cramfs $NETMODULES $SCSIMODULES $IDEMODS $ISOMODULES"
    fi
}

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