diff --git a/grub2-xcat.recompile/FILELIST b/grub2-xcat.recompile/FILELIST new file mode 100644 index 0000000..e69de29 diff --git a/grub2-xcat.recompile/Makefile b/grub2-xcat.recompile/Makefile new file mode 100644 index 0000000..9a3888e --- /dev/null +++ b/grub2-xcat.recompile/Makefile @@ -0,0 +1,70 @@ +# +# Maintainer: GONG Jie +# + +SRC_RPM = grub2-2.02-0.16.xcat.src.rpm +SPEC_TEMPLATE = grub2-xcat.spec.template + +BUILD_NUMBER_FILE = build-number.txt + +build: rpm + +rpm: grub2-xcat.noarch.rpm +deb: grub2-xcat.all.deb + +grub2.ppc64.rpm: $(SRC_RPM) + rpmbuild --rebuild $^ 2>&1 | tee rpmbuild.out + ln -sf $$(awk '/Wrote: .*\/grub2-[0-9].*\.rpm/ { print $$NF }' rpmbuild.out) \ + grub2.ppc64.rpm + +timestamp.extract: grub2.ppc64.rpm + umask 0022 + mkdir -p grub2 + rpm2cpio $^ | ( cd grub2 ; cpio -idv ) + touch timestamp.extract + +timestamp.grub2.mknetdir: timestamp.extract + umask 0022 + mkdir -p grub2-xcat/tftpboot + grub2-mknetdir --directory=grub2/usr/lib/grub/powerpc-ieee1275 \ + --net-directory=grub2-xcat/tftpboot + touch timestamp.grub2.mknetdir + +grub2-xcat.spec: $(SPEC_TEMPLATE) $(BUILD_NUMBER_FILE) timestamp.grub2.mknetdir + umask 0022 + ( cd grub2-xcat ; find tftpboot -type d -exec echo '%dir "/{}"' ';' ) >filelist + ( cd grub2-xcat ; find tftpboot -type f -exec echo '"/{}"' ';' ) >>filelist + cat $(SPEC_TEMPLATE) | sed -e \ + 's@###<<>>###@build'$$(cat $(BUILD_NUMBER_FILE))'.xcat@g' \ + -e '/%files/ r filelist' >$@ + $(RM) filelist + +grub2-xcat.noarch.rpm: grub2-xcat.spec timestamp.grub2.mknetdir + umask 0022 + mkdir -p grub2-xcat-repack + ( cd grub2-xcat ; tar cf - . ) | ( cd grub2-xcat-repack ; tar xf - ) + ( cd grub2-xcat-repack ; rpmbuild -bb ../grub2-xcat.spec --buildroot=`pwd` ) 2>&1 | \ + tee rpmbuild.out.2 + ln -sf $$(awk -F '/' '/Wrote: .*\/grub2-xcat-[0-9].*\.rpm/ { print $$NF }' \ + rpmbuild.out.2) grub2-xcat.noarch.rpm + +grub2-xcat.all.deb: grub2-xcat.noarch.rpm + alien -d -c -k $^ 2>&1 | tee alien.out + ln -sf $$(awk '/grub2-xcat_.*_all.deb generated/ { print $$1 }' \ + alien.out) grub2-xcat.all.deb + +$(BUILD_NUMBER_FILE): $(SPEC_TEMPLATE) $(BINARY_RPM) + @if ! test -f $(BUILD_NUMBER_FILE); then echo 0 > $(BUILD_NUMBER_FILE); fi + @echo $$(($$(cat $(BUILD_NUMBER_FILE)) + 1)) > $(BUILD_NUMBER_FILE) + +clean: + $(RM) rpmbuild.out grub2.ppc64.rpm + $(RM) -r timestamp.extract grub2 + $(RM) -r timestamp.grub2.mknetdir grub2-xcat + $(RM) -r grub2-xcat.spec filelist + $(RM) -r grub2-xcat-repack rpmbuild.out.2 + $(RM) grub2-xcat-*.noarch.rpm grub2-xcat.noarch.rpm + $(RM) alien.out + $(RM) grub2-xcat_*_all.deb grub2-xcat.all.deb + +.PHONY: build clean rpm diff --git a/grub2-xcat.recompile/README b/grub2-xcat.recompile/README new file mode 100644 index 0000000..9eefb33 --- /dev/null +++ b/grub2-xcat.recompile/README @@ -0,0 +1,12 @@ +The latest source rpm file of grub2 can be obtained from the source codes of +the Red Hat Enterprse Linux. The current source rpm file, +grub2-2.02-0.16.xcat.src.rpm, was obtained from RHEL 7.1 Alpha with a little +modification. When a new source rpm file is available, please update the +Makefile accordingly. And the Version and Release sections in the template +of the spec file, grub2-xcat.spec.template should also be updated. + +For rpm package compling, a RHEL 7 environment on powerpc64 is needed. + +For deb package generating, a Debian or Ubunutu environment on any architecture +should work. It will re-pack the grub2-xcat.noarch.rpm to deb package. Thus, +the rpm package must be compiled at first. diff --git a/grub2-xcat.recompile/build-number.txt b/grub2-xcat.recompile/build-number.txt new file mode 100644 index 0000000..a45fd52 --- /dev/null +++ b/grub2-xcat.recompile/build-number.txt @@ -0,0 +1 @@ +24 diff --git a/grub2-xcat.recompile/grub2-2.02-0.16.xcat.src.rpm b/grub2-xcat.recompile/grub2-2.02-0.16.xcat.src.rpm new file mode 100644 index 0000000..596f700 Binary files /dev/null and b/grub2-xcat.recompile/grub2-2.02-0.16.xcat.src.rpm differ diff --git a/grub2-xcat.recompile/grub2-xcat.spec.template b/grub2-xcat.recompile/grub2-xcat.spec.template new file mode 100644 index 0000000..a40836a --- /dev/null +++ b/grub2-xcat.recompile/grub2-xcat.spec.template @@ -0,0 +1,26 @@ +BuildArch: noarch +Name: grub2-xcat +Version: 2.02 +Release: 0.16.###<<>>### +Summary: grub2 resources generated by grub2-mknetdir +License: GPLv3+ +Distribution: Slackware/tarball +Group: Applications/System +Packager: IBM Corp. +Vendor: IBM Corp. + +%define _rpmdir ../ +%define _rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm +%define _binaries_in_noarch_packages_terminate_build 0 + +%description +grub2-xcat provides some grub2 resources generated by grub2-mknetdir,including grub2 modules and grub2 image. + +%files + +%post +ln -f /tftpboot/boot/grub2/powerpc-ieee1275/core.elf /tftpboot/boot/grub2/grub2.ppc +exit 0 +%preun +[ "$1" = "0" ] && rm -f /tftpboot/boot/grub2/grub2.ppc +exit 0 diff --git a/grub2-xcat.recompile/makedeb b/grub2-xcat.recompile/makedeb new file mode 100755 index 0000000..a73cfc7 --- /dev/null +++ b/grub2-xcat.recompile/makedeb @@ -0,0 +1,2 @@ +#!/bin/sh +exec make deb diff --git a/grub2-xcat.recompile/makerpm b/grub2-xcat.recompile/makerpm new file mode 100755 index 0000000..581ccfe --- /dev/null +++ b/grub2-xcat.recompile/makerpm @@ -0,0 +1,2 @@ +#!/bin/sh +exec make rpm