6 # Debug mode (spam/verbose)
12 # command used to get root (needed for tarball creation)
15 # We use fixed addresses to avoid overlap when relocating
16 # and other trouble with initrd
18 # Load the bootstrap at 1Mb
22 # Load kernel and ramdisk at as low as possible
23 KERNELADDR = 0x00000000
25 # Set this to the prefix of your cross-compiler, if you have one.
26 # Else leave it empty.
33 OBJCOPY := $(CROSS)objcopy
35 # The flags for the yaboot binary.
37 YBCFLAGS = -Os $(CFLAGS) -nostdinc -Wall -isystem `$(CC) -m32 -print-file-name=include` -fsigned-char
38 YBCFLAGS += -DVERSION=\"${VERSION}${VERSIONEXTRA}\" #"
39 YBCFLAGS += -DTEXTADDR=$(TEXTADDR) -DDEBUG=$(DEBUG)
40 YBCFLAGS += -DMALLOCADDR=$(MALLOCADDR) -DMALLOCSIZE=$(MALLOCSIZE)
41 YBCFLAGS += -DKERNELADDR=$(KERNELADDR)
42 YBCFLAGS += -I ./include
44 ifeq ($(CONFIG_COLOR_TEXT),y)
45 YBCFLAGS += -DCONFIG_COLOR_TEXT
48 ifeq ($(CONFIG_SET_COLORMAP),y)
49 YBCFLAGS += -DCONFIG_SET_COLORMAP
52 ifeq ($(USE_MD5_PASSWORDS),y)
53 YBCFLAGS += -DUSE_MD5_PASSWORDS
56 ifeq ($(CONFIG_FS_XFS),y)
57 YBCFLAGS += -DCONFIG_FS_XFS
60 ifeq ($(CONFIG_FS_REISERFS),y)
61 YBCFLAGS += -DCONFIG_FS_REISERFS
66 LFLAGS = -Ttext $(TEXTADDR) -Bstatic -melf32ppclinux
72 # For compiling userland utils
74 UCFLAGS = -Os $(CFLAGS) -Wall -I/usr/include
76 # For compiling build-tools that run on the host.
79 HOSTCFLAGS = -O2 $(CFLAGS) -Wall -I/usr/include
81 ## End of configuration section
83 OBJS = second/crt0.o second/yaboot.o second/cache.o second/prom.o second/file.o \
84 second/partition.o second/fs.o second/cfg.o second/setjmp.o second/cmdline.o \
85 second/fs_of.o second/fs_ext2.o second/fs_iso.o second/fs_swap.o \
88 lib/nosys.o lib/string.o lib/strtol.o lib/vsprintf.o lib/ctype.o lib/malloc.o lib/strstr.o
90 ifeq ($(USE_MD5_PASSWORDS),y)
94 ifeq ($(CONFIG_FS_XFS),y)
95 OBJS += second/fs_xfs.o
98 ifeq ($(CONFIG_FS_REISERFS),y)
99 OBJS += second/fs_reiserfs.o
103 lgcc = `$(CC) -m32 -print-libgcc-file-name`
105 all: yaboot addnote mkofboot
108 $(LD) $(LFLAGS) $(OBJS) $(LLIBS) $(lgcc) -o second/$@
109 chmod -x second/yaboot
112 $(CC) $(UCFLAGS) -o util/addnote util/addnote.c
115 $(CC) $(UCFLAGS) -o util/elfextract util/elfextract.c
118 ln -sf ybin ybin/mkofboot
119 @if [ $$(grep '^VERSION=' ybin/ybin | cut -f2 -d=) != ${VERSION} ] ; then \
120 echo "ybin/ybin: warning: VERSION mismatch"; \
125 $(CC) $(YBCFLAGS) -c -o $@ $<
128 $(CC) $(YBCFLAGS) -D__ASSEMBLY__ -c -o $@ $<
131 makedepend -Iinclude *.c lib/*.c util/*.c gui/*.c
137 mkdir ../yaboot-binary-${VERSION}
138 $(GETROOT) make ROOT=../yaboot-binary-${VERSION} install
139 mkdir -p -m 755 ../yaboot-binary-${VERSION}/usr/local/share/doc/yaboot
140 cp -a COPYING ../yaboot-binary-${VERSION}/usr/local/share/doc/yaboot/COPYING
141 cp -a README ../yaboot-binary-${VERSION}/usr/local/share/doc/yaboot/README
142 cp -a doc/README.rs6000 ../yaboot-binary-${VERSION}/usr/local/share/doc/yaboot/README.rs6000
143 cp -a doc/yaboot-howto.html ../yaboot-binary-${VERSION}/usr/local/share/doc/yaboot/yaboot-howto.html
144 cp -a doc/yaboot-howto.sgml ../yaboot-binary-${VERSION}/usr/local/share/doc/yaboot/yaboot-howto.sgml
145 mv ../yaboot-binary-${VERSION}/etc/yaboot.conf ../yaboot-binary-${VERSION}/usr/local/share/doc/yaboot/
146 rmdir ../yaboot-binary-${VERSION}/etc
147 $(GETROOT) tar -C ../yaboot-binary-${VERSION} -zcvpf ../yaboot-binary-${VERSION}.tar.gz .
148 rm -rf ../yaboot-binary-${VERSION}
151 rm -f second/yaboot util/addnote util/elfextract $(OBJS)
152 find . -not -path './\{arch\}*' -name '#*' | xargs rm -f
153 find . -not -path './\{arch\}*' -name '.#*' | xargs rm -f
154 find . -not -path './\{arch\}*' -name '*~' | xargs rm -f
155 find . -not -path './\{arch\}*' -name '*.swp' | xargs rm -f
156 find . -not -path './\{arch\}*' -name ',,*' | xargs rm -rf
163 ## removes arch revision control crap, only to be called for making
164 ## release tarballs. arch should have a export command like cvs...
168 find . -type d -name .arch-ids | xargs rm -rf
169 rm -f 0arch-timestamps0
171 maintclean: clean cleandocs
173 release: docs bindist clean
177 strip --remove-section=.comment second/yaboot
179 strip --remove-section=.comment --remove-section=.note util/addnote
182 install -d -o root -g root -m 0755 ${ROOT}/etc/
183 install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/sbin/
184 install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/lib
185 install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/lib/yaboot
186 install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/${MANDIR}/man5/
187 install -d -o root -g root -m 0755 ${ROOT}/${PREFIX}/${MANDIR}/man8/
188 install -o root -g root -m 0644 second/yaboot ${ROOT}/$(PREFIX)/lib/yaboot
189 install -o root -g root -m 0755 util/addnote ${ROOT}/${PREFIX}/lib/yaboot/addnote
190 install -o root -g root -m 0644 first/ofboot ${ROOT}/${PREFIX}/lib/yaboot/ofboot
191 install -o root -g root -m 0755 ybin/ofpath ${ROOT}/${PREFIX}/sbin/ofpath
192 install -o root -g root -m 0755 ybin/ybin ${ROOT}/${PREFIX}/sbin/ybin
193 install -o root -g root -m 0755 ybin/yabootconfig ${ROOT}/${PREFIX}/sbin/yabootconfig
194 rm -f ${ROOT}/${PREFIX}/sbin/mkofboot
195 ln -s ybin ${ROOT}/${PREFIX}/sbin/mkofboot
197 install -o root -g root -m 0644 man/bootstrap.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/bootstrap.8.gz
198 install -o root -g root -m 0644 man/mkofboot.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/mkofboot.8.gz
199 install -o root -g root -m 0644 man/ofpath.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/ofpath.8.gz
200 install -o root -g root -m 0644 man/yaboot.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/yaboot.8.gz
201 install -o root -g root -m 0644 man/yabootconfig.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/yabootconfig.8.gz
202 install -o root -g root -m 0644 man/ybin.8.gz ${ROOT}/${PREFIX}/${MANDIR}/man8/ybin.8.gz
203 install -o root -g root -m 0644 man/yaboot.conf.5.gz ${ROOT}/${PREFIX}/${MANDIR}/man5/yaboot.conf.5.gz
205 @if [ ! -e ${ROOT}/etc/yaboot.conf ] ; then \
206 echo "install -o root -g root -m 0644 etc/yaboot.conf ${ROOT}/etc/yaboot.conf"; \
207 install -o root -g root -m 0644 etc/yaboot.conf ${ROOT}/etc/yaboot.conf; \
209 echo "/etc/yaboot.conf already exists, leaving it alone"; \
212 @echo "Installation successful."
214 @echo "An example /etc/yaboot.conf has been installed (unless /etc/yaboot.conf already existed)"
215 @echo "You may either alter that file to match your system, or alternatively run yabootconfig"
216 @echo "yabootconfig will generate a simple and valid /etc/yaboot.conf for your system"
220 rm -f ${ROOT}/${PREFIX}/sbin/ofpath
221 rm -f ${ROOT}/${PREFIX}/sbin/ybin
222 rm -f ${ROOT}/${PREFIX}/sbin/yabootconfig
223 rm -f ${ROOT}/${PREFIX}/sbin/mkofboot
224 rm -f ${ROOT}/${PREFIX}/lib/yaboot/yaboot
225 rm -f ${ROOT}/${PREFIX}/lib/yaboot/ofboot
226 rm -f ${ROOT}/${PREFIX}/lib/yaboot/addnote
227 @rmdir ${ROOT}/${PREFIX}/lib/yaboot || true
228 rm -f ${ROOT}/${PREFIX}/${MANDIR}/man8/bootstrap.8.gz
229 rm -f ${ROOT}/${PREFIX}/${MANDIR}/man8/mkofboot.8.gz
230 rm -f ${ROOT}/${PREFIX}/${MANDIR}/man8/ofpath.8.gz
231 rm -f ${ROOT}/${PREFIX}/${MANDIR}/man8/yaboot.8.gz
232 rm -f ${ROOT}/${PREFIX}/${MANDIR}/man8/yabootconfig.8.gz
233 rm -f ${ROOT}/${PREFIX}/${MANDIR}/man8/ybin.8.gz
234 rm -f ${ROOT}/${PREFIX}/${MANDIR}/man5/yaboot.conf.5.gz
235 @if [ -L ${ROOT}/boot/yaboot -a ! -e ${ROOT}/boot/yaboot ] ; then rm -f ${ROOT}/boot/yaboot ; fi
236 @if [ -L ${ROOT}/boot/ofboot.b -a ! -e ${ROOT}/boot/ofboot.b ] ; then rm -f ${ROOT}/boot/ofboot.b ; fi
238 @echo "Deinstall successful."
239 @echo "${ROOT}/etc/yaboot.conf has not been removed, you may remove it yourself if you wish."