summaryrefslogtreecommitdiffstats
path: root/stage2
blob: c6afed29d1d6a816cc9f6c594a958ff2ccc22830 (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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/bin/bash
#
# This script is the second stage in bootstrapping a Fedora build to a
# new platform or architecture.  Running stage1 with no arguments
# builds a cross-development environment, then cross-builds a minimal
# rootfs.  Once you have this minimal rootfs booted (or chroot'd), run
# stage2 (this script) in that rootfs to build the rest of the
# bootstrap packages.
#
# This script assumes that all the needed sources are installed in
# $SRC (below) by stage1.  Each build installs into /usr.
#
# You may pass a single package name on the command line to rebuild
# just that one package.
#
# The master upstream for this script is:
#   git://fedorapeople.org/~djdelorie/bootstrap.git
#
# ------------------------------------------------------------
#
#	      --- NOTES FOR PACKAGE PORTING ---
#
# This script is stage TWO of a bootstrap process.  EVERYTHING that
# this script uses MUST be provided by the stage ONE script -
# filesystem, utilities, sources, etc.  Please keep this in mind when
# editing this script - anything you do manually to "prepare" for your
# build, will NOT be reproducible.
#
# Please make sure your package is not in either stage1 or stage2, and
# that nobody else is already working on your package, before
# starting.  Grep is your friend.  See the wiki page for details.
#
# There are FOUR places you must edit when adding packages to the
# bootstrap build:
#
# 1. Add a clause at the end of this script to actually build your
#    package.
#
# 2. Add your package to the "" case at the beginning of the package
#    list, about a page down from these comments.  Put in the order in
#    which it needs to build based on its dependencies.
#
# 3. Add your SRPM to the list at the end of the stage1 script so that
#    your sources are available in the bootstrap rootfs.
#
# 4. Update the Fedora/ARM bootstrap wiki page.
#
# If you attempt to add a package and discover some unsatisfied build
# dependency, add a clause for it here that documents the dependency
# and exits with a non-zero code.  In that case, do not add your
# package to the "" case.
#
# ------------------------------------------------------------

#set -vx

TOP=/stage2
MYDIR=${0%/*}
STAGE2=$MYDIR/stage2

SRC=$TOP/rpmbuild/BUILD
J=-j2

BUILDDIR=$TOP/builds

# The cross-compiler target
TARGET=armv7hl-redhat-linux-gnueabi

export TARGET BUILDDIR J SRC STAGE2 MYDIR TOP

. $MYDIR/macros.bashrc

if [ ! -c /dev/null -a -w / ]
then
    echo Creating /dev devices...
    mkdir /dev
    mknod /dev/null		c   1 3
    mknod /dev/zero		c   1 5
    mknod /dev/tty		c   5 0
    mknod /dev/console		c   5 1
    mknod /dev/sda		b   8 0
    mknod /dev/sda1		b   8 1
    mknod /dev/sda2		b   8 2
    mknod /dev/sda3		b   8 3
    mknod /dev/sda4		b   8 4
    mknod /dev/mmcblk0		b 179 0
    mknod /dev/mmcblk0p1	b 179 1
    mknod /dev/mmcblk0p2	b 179 2
    mknod /dev/mmcblk0p3	b 179 3
    mknod /dev/mmcblk0p4	b 179 4
    mknod /dev/ttyO0		c 253 0
    mknod /dev/ttyO1		c 253 1
    mknod /dev/ttyO2		c 253 2
    mknod /dev/ttyO3		c 253 3
    chmod a+rw /dev/null /dev/zero
fi

if [ ! -d /tmp ]
then
    echo Creating /tmp...
    mkdir /tmp
    chmod 1777 /tmp
fi

if [ ! -d /var/tmp ]
then
    echo Creating /var/tmp...
    mkdir /var/tmp
    chmod 1777 /var/tmp
    ln -s ../var/tmp /usr/tmp
fi

# ------------------------------------------------------------

mkdirp $BUILDDIR

test -d /stage2/done || mkdir /stage2/done

scriptmake()
{
    test -d $TOP/recipe.mk || mkdir -p $TOP/recipe.mk
    make -f $MYDIR/script2makefile \
	SCRIPTDIR=$TOP/recipe.d \
	FRAGDIR=$TOP/recipe.mk \
	RCFILE=$TOP/macros.bashrc \
	SRC="$SRC" \
	J="$J" \
	BUILDDIR="$BUILDDIR" \
	TARGET="$TARGET" \
	$1
}

case "$1" in
    "" )
	go clean
        scriptmake
	;;

    "clean" )
	;;

    # Packages built by stage1

    binutils | gcc | glibc | kernel | x-loader | u-boot \
    | gmp | mpfr | libmpc | mpc | ppl | cloog | libselinux | zlib \
    | bash | make | sed | coreutils | util-linux | tar | gzip \
    | bzip2 | diffutils | findutils | gawk | patch | unzip | which | gz | grep )

        echo "$1 is built in stage1" >&2
        exit 1
        ;;

#--------------------------------------------------

    *~ ) ;;

    * )
        scriptmake "$1"
	;;
esac

exit 0