summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeshav Amburay2012-11-07 21:51:07 +0530
committerKeshav Amburay2012-11-07 21:51:07 +0530
commitf24f6ad018db7a20cc4ad4f67ad5b3c0f746659f (patch)
tree568b9d171107e2d3c5c9273df7f74aed8e9aa2cd
parent57179ff42bf345cfef1b0962074910aa44020ac3 (diff)
downloadaur-f24f6ad018db7a20cc4ad4f67ad5b3c0f746659f.tar.gz
Fix lot of things
-rw-r--r--.SRCINFO28
-rw-r--r--PKGBUILD287
-rw-r--r--UDK-MdePkg-Revert-PathNodeCount.patch660
-rw-r--r--refind-efi-tianocore.install28
-rw-r--r--refind_include_more_shell_paths.patch4
-rw-r--r--refind_linux.conf6
6 files changed, 830 insertions, 183 deletions
diff --git a/.SRCINFO b/.SRCINFO
index b8ff2fd9375c..fadb610c5abe 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,29 +1,27 @@
-pkgbase = refind-efi-x86_64-git
- pkgdesc = Rod Smith's fork of rEFIt UEFI Boot Manager - GIT Development Version
- pkgver = 20120623
+pkgbase = refind-efi-tianocore-git
+ pkgdesc = Rod Smith's fork of rEFIt UEFI Boot Manager - built with Tianocore UDK libs - GIT Version
+ pkgver = 20121107
pkgrel = 1
url = http://www.rodsbooks.com/refind/index.html
- install = refind-efi-x86_64.install
arch = any
license = GPL3
license = custom
makedepends = git
- makedepends = python2
makedepends = subversion
+ makedepends = python2
depends = dosfstools
depends = efibootmgr
optdepends = mactel-boot: For bless command in Apple Mac systems
- provides = refind-efi-x86_64
- conflicts = refind-efi-x86_64
- replaces = refind-x86_64-git
- options = !strip
- options = docs
- backup = boot/efi/EFI/arch/refind/refind.conf
- backup = boot/efi/EFI/arch/refind/refind_linux.conf
+ provides = refind-efi
+ provides = refind-efi-tianocore
+ conflicts = refind-efi
+ conflicts = refind-efi-tianocore
+ source = UDK-MdePkg-Revert-PathNodeCount.patch
source = refind_include_more_shell_paths.patch
source = refind_linux.conf
- sha256sums = d1bc373c10cf2e17d436d14e080d1daa4d25d51c4d53e477b68417a2b3f4722c
- sha256sums = 9aac6e65018965ba182ec2d246d37fc5f9269ae96504956d8a51355c3ba1b62f
+ sha1sums = 4d1992699f9b48dd2b7e6bd6c0b25fc065f75894
+ sha1sums = 7ed2870ee76f42a7bed51410b3cae4da3bc2de2a
+ sha1sums = 3d53eb615c3363d45feb95b9bfbf1d5491bf1c24
-pkgname = refind-efi-x86_64-git
+pkgname = refind-efi-tianocore-git
diff --git a/PKGBUILD b/PKGBUILD
index d5e73d13ce7c..aa16593456cb 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,86 +1,56 @@
# Maintainer: Keshav P R <(the.ridikulus.rat) (aatt) (gemmaeiil) (ddoott) (ccoomm)>
-_USE_TIANOCORE_UDK_LIBS="1"
-_USE_TIANO_GIT="0"
+#######
+_TIANOCORE_SVN_URL="https://edk2.svn.sourceforge.net/svnroot/edk2/branches/UDK2010.SR1"
+_TIANOCORE_PKG="Mde"
+_TIANOCORE_TARGET="RELEASE"
+_UDK_TARGET="${_TIANOCORE_PKG}Pkg/${_TIANOCORE_PKG}Pkg.dsc"
+_COMPILER="GCC46"
+#######
-# _GNU_EFI_LIB_DIR="/usr/lib"
-
-_actualname="refind"
-_pkgname="${_actualname}-efi-x86_64"
+_pkgname="refind-efi-tianocore"
pkgname="${_pkgname}-git"
-pkgver=20120623
+pkgver=20121107
pkgrel=1
-pkgdesc="Rod Smith's fork of rEFIt UEFI Boot Manager - GIT Development Version"
+pkgdesc="Rod Smith's fork of rEFIt UEFI Boot Manager - built with Tianocore UDK libs - GIT Version"
url="http://www.rodsbooks.com/refind/index.html"
arch=('any')
license=('GPL3' 'custom')
-makedepends=('git')
-
-if [[ "${_USE_TIANOCORE_UDK_LIBS}" == "1" ]]; then
- makedepends+=('python2')
-
- if [[ "${_USE_TIANO_GIT}" != "1" ]]; then
- makedepends+=('subversion')
- fi
-else
- makedepends+=('gnu-efi>=3.0q')
-fi
+makedepends=('git' 'subversion' 'python2')
depends=('dosfstools' 'efibootmgr')
optdepends=('mactel-boot: For bless command in Apple Mac systems')
-conflicts=("${_pkgname}")
-provides=("${_pkgname}")
-
-replaces=('refind-x86_64-git')
+conflicts=('refind-efi' "${_pkgname}")
+provides=('refind-efi' "${_pkgname}")
-backup=('boot/efi/EFI/arch/refind/refind.conf'
- 'boot/efi/EFI/arch/refind/refind_linux.conf')
-
-options=('!strip' 'docs')
-install="${_pkgname}.install"
-
-source=('refind_include_more_shell_paths.patch'
+source=('UDK-MdePkg-Revert-PathNodeCount.patch'
+ 'refind_include_more_shell_paths.patch'
'refind_linux.conf')
-sha256sums=('d1bc373c10cf2e17d436d14e080d1daa4d25d51c4d53e477b68417a2b3f4722c'
- '9aac6e65018965ba182ec2d246d37fc5f9269ae96504956d8a51355c3ba1b62f')
+sha1sums=('4d1992699f9b48dd2b7e6bd6c0b25fc065f75894'
+ '7ed2870ee76f42a7bed51410b3cae4da3bc2de2a'
+ '3d53eb615c3363d45feb95b9bfbf1d5491bf1c24')
_gitroot="git://git.code.sf.net/p/refind/code"
-_gitname="${_actualname}"
+_gitname="refind"
_gitbranch="master"
-_update_tianocore_udk_git() {
-
- if [[ -d "${srcdir}/${_TIANO_DIR_}/${_DIR_}" ]]; then
- cd "${srcdir}/${_TIANO_DIR_}/${_DIR_}"
- git reset --hard
- git pull --depth=1 origin "${_gitbranch}:${_gitbranch}"
- git checkout "${_gitbranch}"
- echo
- else
- cd "${srcdir}/${_TIANO_DIR_}/"
- git clone --depth=1 "git://tianocore.git.sourceforge.net/gitroot/tianocore/edk2-${_DIR_}" "${srcdir}/${_TIANO_DIR_}/${_DIR_}"
- cd "${srcdir}/${_TIANO_DIR_}/${_DIR_}"
- git checkout "${_gitbranch}"
- echo
- fi
-
- unset _DIR_
-
-}
+# _refind_dsc_gitroot="git://github.com/snarez/refind-edk2.git"
+# _refind_dsc_gitname="RefindPkg"
+# _refind_efi_gitbranch="master"
_update_tianocore_udk_svn() {
if [[ -d "${srcdir}/${_TIANO_DIR_}/${_DIR_}" ]]; then
cd "${srcdir}/${_TIANO_DIR_}/${_DIR_}"
- svn update
+ svn update || true
echo
else
cd "${srcdir}/${_TIANO_DIR_}/"
- svn checkout "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/${_DIR_}" "${srcdir}/${_TIANO_DIR_}/${_DIR_}"
+ svn checkout "${_TIANOCORE_SVN_URL}/${_DIR_}" "${srcdir}/${_TIANO_DIR_}/${_DIR_}"
echo
fi
@@ -110,56 +80,38 @@ _update_git() {
echo
- if [[ "${_USE_TIANOCORE_UDK_LIBS}" == "1" ]]; then
- if [[ "${_USE_TIANO_GIT}" == "1" ]]; then
- _D_="git"
- else
- _D_="svn"
- fi
-
- _TIANO_DIR_="tianocore-udk-${_D_}"
-
- mkdir -p "${srcdir}/${_TIANO_DIR_}"
- cd "${srcdir}/${_TIANO_DIR_}"
-
- # for _DIR_ in BaseTools MdePkg MdeModulePkg IntelFrameworkPkg IntelFrameworkModulePkg EdkCompatibilityPkg ; do
- for _DIR_ in BaseTools MdePkg MdeModulePkg IntelFrameworkPkg ; do
- "_update_tianocore_udk_${_D_}"
- done
-
- unset _DIR_
- echo
-
- rm -f "${srcdir}/${_TIANO_DIR_}/edksetup.sh" || true
- curl --ipv4 -fLC - --retry 3 --retry-delay 3 -o "${srcdir}/${_TIANO_DIR_}/edksetup.sh" "https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/edksetup.sh"
- chmod +x "${srcdir}/${_TIANO_DIR_}/edksetup.sh"
- echo
-
- fi
+ _TIANO_DIR_="tianocore-udk-svn"
- echo
+ mkdir -p "${srcdir}/${_TIANO_DIR_}/"
+ cd "${srcdir}/${_TIANO_DIR_}/"
+
+ for _DIR_ in BaseTools MdePkg MdeModulePkg IntelFrameworkPkg IntelFrameworkModulePkg ; do
+ _update_tianocore_udk_svn
+ done
+
+ unset _DIR_
}
-_build_using_tianocore_udk() {
+_tianocore_udk_common() {
- rm -rf "${srcdir}/${_TIANO_DIR_}_build/" || true
- cp -r "${srcdir}/${_TIANO_DIR_}" "${srcdir}/${_TIANO_DIR_}_build"
+ ## Setup UDK Environment variables
+ export _UDK_DIR="${srcdir}/${_TIANO_DIR_}_build"
+ export EDK_TOOLS_PATH="${_UDK_DIR}/BaseTools"
- cd "${srcdir}/${_TIANO_DIR_}_build"
- echo
+ rm -rf "${_UDK_DIR}/" || true
+ cp -r "${srcdir}/${_TIANO_DIR_}" "${_UDK_DIR}"
- ## Setup UDK Environment variables
- export _UDK_DIR_="${srcdir}/${_TIANO_DIR_}_build"
- export EDK_TOOLS_PATH="${_UDK_DIR_}/BaseTools"
- export _UDK_TARGET_="MdePkg/MdePkg.dsc"
+ cd "${_UDK_DIR}/"
- ## Cleanup UDK config files
- rm -rf "${_UDK_DIR_}/Build" || true
- rm -rf "${_UDK_DIR_}/Conf" || true
+ patch -Np1 -R -i "${srcdir}/UDK-MdePkg-Revert-PathNodeCount.patch"
+ echo
- mkdir -p "${_UDK_DIR_}/Conf"
- mkdir -p "${_UDK_DIR_}/Build"
+ ## Cleanup UDK config files
+ rm -rf "${_UDK_DIR}/Build/" || true
+ rm -rf "${_UDK_DIR}/Conf/" || true
+ mkdir -p "${_UDK_DIR}/Conf/"
+ mkdir -p "${_UDK_DIR}/Build/"
## UDK BaseTools requires python2
sed 's|python |python2 |g' -i "${EDK_TOOLS_PATH}/BinWrappers/PosixLike"/* || true
@@ -179,65 +131,78 @@ _build_using_tianocore_udk() {
sed 's|DEFINE GCC44_ALL_CC_FLAGS = -g |DEFINE GCC44_ALL_CC_FLAGS = -Os -mabi=ms |g' -i "${EDK_TOOLS_PATH}/Conf/tools_def.template" || true
## Fix UDK Target Platform
- sed "s|ACTIVE_PLATFORM = Nt32Pkg/Nt32Pkg.dsc|ACTIVE_PLATFORM = ${_UDK_TARGET_}|g" -i "${EDK_TOOLS_PATH}/Conf/target.template" || true
- sed "s|TARGET = DEBUG|TARGET = RELEASE|g" -i "${EDK_TOOLS_PATH}/Conf/target.template" || true
- sed "s|TARGET_ARCH = IA32|TARGET_ARCH = X64|g" -i "${EDK_TOOLS_PATH}/Conf/target.template" || true
- sed "s|TOOL_CHAIN_TAG = MYTOOLS|TOOL_CHAIN_TAG = GCC46|g" -i "${EDK_TOOLS_PATH}/Conf/target.template" || true
+ sed "s|ACTIVE_PLATFORM = Nt32Pkg/Nt32Pkg.dsc|ACTIVE_PLATFORM = ${_UDK_TARGET}|g" -i "${EDK_TOOLS_PATH}/Conf/target.template" || true
+ sed "s|TARGET = DEBUG|TARGET = ${_TIANOCORE_TARGET}|g" -i "${EDK_TOOLS_PATH}/Conf/target.template" || true
+ sed "s|TOOL_CHAIN_TAG = MYTOOLS|TOOL_CHAIN_TAG = ${_COMPILER}|g" -i "${EDK_TOOLS_PATH}/Conf/target.template" || true
+
+ ## Fix UDK Target ARCH
+ sed 's|IA32|X64|g' -i "${EDK_TOOLS_PATH}/Conf/target.template" || true
## Setup UDK Environment
- source "${_UDK_DIR_}/edksetup.sh" BaseTools
+ chmod +x "${_UDK_DIR}/BaseTools/BuildEnv"
+ source "${_UDK_DIR}/BaseTools/BuildEnv" BaseTools
echo
## Compile UDK BaseTools
make -C "${EDK_TOOLS_PATH}"
echo
- ## Compile UDK Libraries
- "${EDK_TOOLS_PATH}/BinWrappers/PosixLike/build" -p "${_UDK_DIR_}/${_UDK_TARGET_}" -a X64 -b RELEASE -t GCC46
+ ## Compile UDK x86_64-UEFI Libraries
+ "${EDK_TOOLS_PATH}/BinWrappers/PosixLike/build" -p "${_UDK_TARGET}" -a "X64" -b "${_TIANOCORE_TARGET}" -t "${_COMPILER}"
echo
- cd "${srcdir}/${_gitname}_build"
+ ## Compile UDK i386-UEFI Libraries
+ "${EDK_TOOLS_PATH}/BinWrappers/PosixLike/build" -p "${_UDK_TARGET}" -a "IA32" -b "${_TIANOCORE_TARGET}" -t "${_COMPILER}"
echo
- ## Fix UDK Path in rEFInd Makefiles
- sed "s|EDK2BASE = /usr/local/UDK2010/MyWorkSpace|EDK2BASE = ${_UDK_DIR_}|g" -i "${srcdir}/${_gitname}_build/Make.tiano" || true
- sed "s|EDK2BASE = /usr/local/UDK2010/MyWorkSpace|EDK2BASE = ${_UDK_DIR_}|g" -i "${srcdir}/${_gitname}_build/filesystems/Make.tiano" || true
- echo
+}
+
+_refind_changes() {
- ## Fix UDK Target Platform in rEFInd Makefiles
- sed 's|EFILIB = $(EDK2BASE)/Build/MdeModule/|EFILIB = $(EDK2BASE)/Build/Mde/|g' -i "${srcdir}/${_gitname}_build/refind/Make.tiano" || true
- sed 's|EFILIB = $(EDK2BASE)/Build/MdeModule/|EFILIB = $(EDK2BASE)/Build/Mde/|g' -i "${srcdir}/${_gitname}_build/filesystems/Make.tiano" || true
- echo
+ rm -rf "${srcdir}/${_gitname}_build/" || true
+ cp -r "${srcdir}/${_gitname}" "${srcdir}/${_gitname}_build"
- make clean || true
- echo
+ cd "${srcdir}/${_gitname}_build/"
- make tiano
+ patch -Np1 -i "${srcdir}/refind_include_more_shell_paths.patch"
echo
- make fs
- echo
+ ## Use passed ARCH variable value
+ sed 's|ARCH :=|ARCH ?=|g' -i "${srcdir}/${_gitname}_build/Make.tiano" || true
+ sed 's|ARCH :=|ARCH ?=|g' -i "${srcdir}/${_gitname}_build/filesystems/Make.tiano" || true
- ## Unset UDK specific ENV variables
- unset EDK_TOOLS_PATH
- unset _UDK_DIR_
- echo
+ ## Fix UDK Target Platform in rEFInd Makefiles
+ sed "s|EFILIB = \$(EDK2BASE)/Build/MdeModule/|EFILIB = \$(EDK2BASE)/Build/${_TIANOCORE_PKG}/|g" -i "${srcdir}/${_gitname}_build/refind/Make.tiano" || true
+ sed "s|EFILIB = \$(EDK2BASE)/Build/MdeModule/|EFILIB = \$(EDK2BASE)/Build/${_TIANOCORE_PKG}/|g" -i "${srcdir}/${_gitname}_build/filesystems/Make.tiano" || true
}
-_build_using_gnu-efi() {
+_build_refind-efi-common() {
- sed 's|/usr/local/include/efi|/usr/include/efi|g' -i "${srcdir}/${_gitname}_build/Make.common" || true
- sed 's|/usr/local/lib|/usr/lib|g' -i "${srcdir}/${_gitname}_build/Make.common" || true
- echo
+ rm -rf "${srcdir}/${_gitname}_build_${_UEFI_ARCH}/" || true
+ cp -r "${srcdir}/${_gitname}_build" "${srcdir}/${_gitname}_build_${_UEFI_ARCH}/"
+
+ cd "${srcdir}/${_gitname}_build_${_UEFI_ARCH}/"
+
+ ## Fix UDK Target ARCH
+ sed "s|IA32|${_SPEC_ARCH}|g" -i "${_UDK_DIR}/Conf/target.txt" || true
+ sed "s|X64|${_SPEC_ARCH}|g" -i "${_UDK_DIR}/Conf/target.txt" || true
+
+ ## Fix UDK Path in rEFInd Makefiles
+ sed "s|EDK2BASE = /usr/local/UDK2010/MyWorkSpace|EDK2BASE = ${_UDK_DIR}|g" -i "${srcdir}/${_gitname}_build_${_UEFI_ARCH}/Make.tiano" || true
+ sed "s|EDK2BASE = /usr/local/UDK2010/MyWorkSpace|EDK2BASE = ${_UDK_DIR}|g" -i "${srcdir}/${_gitname}_build_${_UEFI_ARCH}/filesystems/Make.tiano" || true
+
+ ## Fix ld "-m elf_ARCH" parameter
+ sed "s|LDFLAGS = |LDFLAGS = -m elf_${_ARCH} |g" -i "${srcdir}/${_gitname}_build_${_UEFI_ARCH}/Make.tiano" || true
+ sed "s|LDFLAGS = |LDFLAGS = -m elf_${_ARCH} |g" -i "${srcdir}/${_gitname}_build_${_UEFI_ARCH}/filesystems/Make.tiano" || true
- sed 's|make -C $(EFILIB_DIR) clean -f Make.tiano|#make -C $(EFILIB_DIR) clean -f Make.tiano|g' -i "${srcdir}/${_gitname}_build/Makefile"
+ ARCH="${_UEFI_ARCH}" make clean || true
echo
- make clean || true
+ ARCH="${_UEFI_ARCH}" make tiano
echo
- make
+ ARCH="${_UEFI_ARCH}" make fs
echo
}
@@ -252,62 +217,58 @@ build() {
echo
fi
- rm -rf "${srcdir}/${_gitname}_build/" || true
- cp -r "${srcdir}/${_gitname}" "${srcdir}/${_gitname}_build"
-
- cd "${srcdir}/${_gitname}_build"
+ _tianocore_udk_common
echo
- patch -Np1 -i "${srcdir}/refind_include_more_shell_paths.patch"
+ _refind_changes
echo
- rm -f "${srcdir}/${_gitname}_build/USED_TIANO.txt" || true
- rm -f "${srcdir}/${_gitname}_build/USED_GNU-EFI.txt" || true
+ _UEFI_ARCH="x86_64"
+ _SPEC_ARCH="X64"
+ _ARCH="x86_64"
+ _build_refind-efi-common
+ echo
- if [[ "${_USE_TIANOCORE_UDK_LIBS}" == "1" ]]; then
- touch "${srcdir}/${_gitname}_build/USED_TIANO.txt"
-
- _build_using_tianocore_udk
- else
- "${srcdir}/${_gitname}_build/USED_GNU-EFI.txt"
-
- _build_using_gnu-efi
- fi
+ _UEFI_ARCH="ia32"
+ _SPEC_ARCH="IA32"
+ _ARCH="i386"
+ _build_refind-efi-common
+ echo
}
package() {
- cd "${srcdir}/${_gitname}_build"
+ ## install the rEFInd UEFI applications
+ install -d "${pkgdir}/usr/lib/refind/"
+ install -D -m0644 "${srcdir}/${_gitname}_build_x86_64/refind/refind_x64.efi" "${pkgdir}/usr/lib/refind/refindx64.efi"
+ install -D -m0644 "${srcdir}/${_gitname}_build_ia32/refind/refind_ia32.efi" "${pkgdir}/usr/lib/refind/refindia32.efi"
- ## Install rEFInd x86_64 UEFI application
- install -d "${pkgdir}/boot/efi/EFI/arch/refind/"
- install -D -m0644 "${srcdir}/${_gitname}_build/refind/refind_x64.efi" "${pkgdir}/boot/efi/EFI/arch/refind/refindx64.efi"
-
- ## Install x86_64 UEFI drivers built from rEFInd if available
- if [[ -e "${srcdir}/${_gitname}_build/USED_TIANO.txt" ]]; then
- install -d "${pkgdir}/boot/efi/EFI/arch/refind/drivers_x64/"
- install -D -m0644 "${srcdir}/${_gitname}_build/drivers"/*_x64.efi "${pkgdir}/boot/efi/EFI/arch/refind/drivers_x64/"
- fi
+ ## Install UEFI drivers built from rEFInd
+ install -d "${pkgdir}/usr/lib/refind/drivers_x64/"
+ install -d "${pkgdir}/usr/lib/refind/drivers_ia32/"
+ install -D -m0644 "${srcdir}/${_gitname}_build_x86_64/drivers"/*_x64.efi "${pkgdir}/usr/lib/refind/drivers_x64/"
+ install -D -m0644 "${srcdir}/${_gitname}_build_ia32/drivers"/*_ia32.efi "${pkgdir}/usr/lib/refind/drivers_ia32/"
- ## Install rEFInd config file
- install -D -m0644 "${srcdir}/${_gitname}_build/refind.conf-sample" "${pkgdir}/boot/efi/EFI/arch/refind/refind.conf"
- install -D -m0644 "${srcdir}/refind_linux.conf" "${pkgdir}/boot/efi/EFI/arch/refind/refind_linux.conf"
+ ## install the rEFInd config file
+ install -d "${pkgdir}/usr/lib/refind/config/"
+ install -D -m0644 "${srcdir}/${_gitname}_build/refind.conf-sample" "${pkgdir}/usr/lib/refind/config/refind.conf"
+ install -D -m0644 "${srcdir}/refind_linux.conf" "${pkgdir}/usr/lib/refind/config/refind_linux.conf"
- ## Install rEFInd icons
- install -d "${pkgdir}/boot/efi/EFI/arch/refind/icons/"
- install -D -m0644 "${srcdir}/${_gitname}_build/icons"/* "${pkgdir}/boot/efi/EFI/arch/refind/icons/"
+ ## install the rEFInd icons
+ install -d "${pkgdir}/usr/share/refind/icons/"
+ install -D -m0644 "${srcdir}/${_gitname}_build/icons"/* "${pkgdir}/usr/share/refind/icons/"
- ## Install rEFInd docs
+ ## install the rEFInd docs
install -d "${pkgdir}/usr/share/refind/docs/html/"
install -d "${pkgdir}/usr/share/refind/docs/Styles/"
install -D -m0644 "${srcdir}/${_gitname}_build/docs/refind"/* "${pkgdir}/usr/share/refind/docs/html/"
install -D -m0644 "${srcdir}/${_gitname}_build/docs/Styles"/* "${pkgdir}/usr/share/refind/docs/Styles/"
- install -D -m0644 "${srcdir}/${_gitname}_build/README.txt" "${pkgdir}/usr/share/refind/docs/README.txt"
- install -D -m0644 "${srcdir}/${_gitname}_build/NEWS.txt" "${pkgdir}/usr/share/refind/docs/NEWS.txt"
+ install -D -m0644 "${srcdir}/${_gitname}_build/README.txt" "${pkgdir}/usr/share/refind/docs/README"
+ install -D -m0644 "${srcdir}/${_gitname}_build/NEWS.txt" "${pkgdir}/usr/share/refind/docs/NEWS"
rm -f "${pkgdir}/usr/share/refind/docs/html/.DS_Store" || true
- ## Install rEFIt license file, since rEFInd is a fork of rEFIt
+ ## install the rEFIt license file, since rEFInd is a fork of rEFIt
install -d "${pkgdir}/usr/share/licenses/refind/"
install -D -m0644 "${srcdir}/${_gitname}_build/LICENSE.txt" "${pkgdir}/usr/share/licenses/refind/LICENSE"
diff --git a/UDK-MdePkg-Revert-PathNodeCount.patch b/UDK-MdePkg-Revert-PathNodeCount.patch
new file mode 100644
index 000000000000..1b8f5a44b436
--- /dev/null
+++ b/UDK-MdePkg-Revert-PathNodeCount.patch
@@ -0,0 +1,660 @@
+commit 771729c77fa49cf0ff17491f371003c4f5d66f85
+Author: niruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
+Date: Mon Sep 24 03:20:35 2012 +0000
+
+ Add new API IsDevicePathValid() to UefiDevicePathLib.
+
+ Signed-off-by: Ruiyu Ni<ruiyu.ni@intel.com>
+ Reviewed-by: Liming Gao<liming.gao@intel.com>
+ Reviewed-by: Kinney Michael D<michael.d.kinney@intel.com>
+
+ git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13737 6f19259b-4bc3-4df7-8a09-765794883524
+
+diff --git a/MdePkg/Include/Library/DevicePathLib.h b/MdePkg/Include/Library/DevicePathLib.h
+index 68b1f1b..37acd45 100644
+--- a/MdePkg/Include/Library/DevicePathLib.h
++++ b/MdePkg/Include/Library/DevicePathLib.h
+@@ -4,7 +4,7 @@
+ This library provides defines, macros, and functions to help create and parse
+ EFI_DEVICE_PATH_PROTOCOL structures.
+
+-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
++Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials are licensed and made available under
+ the terms and conditions of the BSD License that accompanies this distribution.
+ The full text of the license may be found at
+@@ -21,6 +21,28 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+ #define END_DEVICE_PATH_LENGTH (sizeof (EFI_DEVICE_PATH_PROTOCOL))
+
+ /**
++ Determine whether a given device path is valid.
++ If DevicePath is NULL, then ASSERT().
++
++ @param DevicePath A pointer to a device path data structure.
++ @param MaxSize The maximum size of the device path data structure.
++
++ @retval TRUE DevicePath is valid.
++ @retval FALSE The length of any node node in the DevicePath is less
++ than sizeof (EFI_DEVICE_PATH_PROTOCOL).
++ @retval FALSE If MaxSize is not zero, the size of the DevicePath
++ exceeds MaxSize.
++ @retval FALSE If PcdMaximumDevicePathNodeCount is not zero, the node
++ count of the DevicePath exceeds PcdMaximumDevicePathNodeCount.
++**/
++BOOLEAN
++EFIAPI
++IsDevicePathValid (
++ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
++ IN UINTN MaxSize
++ );
++
++/**
+ Returns the Type field of a device path node.
+
+ Returns the Type field of the device path node specified by Node.
+@@ -123,7 +145,8 @@ IsDevicePathEndType (
+ Determines if a device path node is an end node of an entire device path.
+
+ Determines if a device path node specified by Node is an end node of an entire device path.
+- If Node represents the end of an entire device path, then TRUE is returned. Otherwise, FALSE is returned.
++ If Node represents the end of an entire device path, then TRUE is returned.
++ Otherwise, FALSE is returned.
+
+ If Node is NULL, then ASSERT().
+
+@@ -143,7 +166,8 @@ IsDevicePathEnd (
+ Determines if a device path node is an end node of a device path instance.
+
+ Determines if a device path node specified by Node is an end node of a device path instance.
+- If Node represents the end of a device path instance, then TRUE is returned. Otherwise, FALSE is returned.
++ If Node represents the end of a device path instance, then TRUE is returned.
++ Otherwise, FALSE is returned.
+
+ If Node is NULL, then ASSERT().
+
+@@ -169,6 +193,7 @@ IsDevicePathEndInstance (
+
+ If Node is NULL, then ASSERT().
+ If NodeLength >= 0x10000, then ASSERT().
++ If NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL), then ASSERT().
+
+ @param Node A pointer to a device path node data structure.
+ @param Length The length, in bytes, of the device path node.
+@@ -208,13 +233,14 @@ SetDevicePathEndNode (
+ /**
+ Returns the size of a device path in bytes.
+
+- This function returns the size, in bytes, of the device path data structure specified by
+- DevicePath including the end of device path node. If DevicePath is NULL, then 0 is returned.
++ This function returns the size, in bytes, of the device path data structure
++ specified by DevicePath including the end of device path node.
++ If DevicePath is NULL or invalid, then 0 is returned.
+
+- @param DevicePath A pointer to a device path data structure.
+-
+- @retval 0 DevicePath is NULL.
+- @retval Others The size of a device path in bytes.
++ @param DevicePath A pointer to a device path data structure.
++
++ @retval 0 If DevicePath is NULL or invalid.
++ @retval Others The size of a device path in bytes.
+
+ **/
+ UINTN
+@@ -235,7 +261,7 @@ GetDevicePathSize (
+
+ @param DevicePath A pointer to a device path data structure.
+
+- @retval NULL DevicePath is NULL.
++ @retval NULL DevicePath is NULL or invalid.
+ @retval Others A pointer to the duplicated device path.
+
+ **/
+@@ -263,6 +289,7 @@ DuplicateDevicePath (
+ @param SecondDevicePath A pointer to a device path data structure.
+
+ @retval NULL If there is not enough memory for the newly allocated buffer.
++ @retval NULL If FirstDevicePath or SecondDevicePath is invalid.
+ @retval Others A pointer to the new device path if success.
+ Or a copy an end-of-device-path if both FirstDevicePath and SecondDevicePath are NULL.
+
+@@ -316,6 +343,7 @@ AppendDevicePathNode (
+ and a new end-of-device-path-instance node is inserted between.
+ If DevicePath is NULL, then a copy if DevicePathInstance is returned.
+ If DevicePathInstance is NULL, then NULL is returned.
++ If DevicePath or DevicePathInstance is invalid, then NULL is returned.
+ If there is not enough memory to allocate space for the new device path, then NULL is returned.
+ The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
+ free the memory allocated.
+@@ -341,6 +369,7 @@ AppendDevicePathInstance (
+ point to the next device path instance in the device path (or NULL if no more) and updates Size
+ to hold the size of the device path instance copy.
+ If DevicePath is NULL, then NULL is returned.
++ If DevicePath points to a invalid device path, then NULL is returned.
+ If there is not enough memory to allocate space for the new device path, then NULL is returned.
+ The memory is allocated from EFI boot services memory. It is the responsibility of the caller to
+ free the memory allocated.
+@@ -394,12 +423,13 @@ CreateDeviceNode (
+ Determines if a device path is single or multi-instance.
+
+ This function returns TRUE if the device path specified by DevicePath is multi-instance.
+- Otherwise, FALSE is returned. If DevicePath is NULL, then FALSE is returned.
++ Otherwise, FALSE is returned.
++ If DevicePath is NULL or invalid, then FALSE is returned.
+
+ @param DevicePath A pointer to a device path data structure.
+
+ @retval TRUE DevicePath is multi-instance.
+- @retval FALSE DevicePath is not multi-instance, or DevicePath is NULL.
++ @retval FALSE DevicePath is not multi-instance, or DevicePath is NULL or invalid.
+
+ **/
+ BOOLEAN
+diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c
+index db065e4..a91a7a3 100644
+--- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c
++++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.c
+@@ -8,7 +8,7 @@
+ environment varibles. Multi-instance device paths should never be placed
+ on a Handle.
+
+- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
++ Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+@@ -28,6 +28,7 @@
+ #include <Library/MemoryAllocationLib.h>
+ #include <Library/UefiBootServicesTableLib.h>
+ #include <Library/BaseLib.h>
++#include <Library/PcdLib.h>
+
+ //
+ // Template for an end-of-device path node.
+@@ -42,6 +43,61 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_PROTOCOL mUefiDevicePathLib
+ };
+
+ /**
++ Determine whether a given device path is valid.
++ If DevicePath is NULL, then ASSERT().
++
++ @param DevicePath A pointer to a device path data structure.
++ @param MaxSize The maximum size of the device path data structure.
++
++ @retval TRUE DevicePath is valid.
++ @retval FALSE The length of any node node in the DevicePath is less
++ than sizeof (EFI_DEVICE_PATH_PROTOCOL).
++ @retval FALSE If MaxSize is not zero, the size of the DevicePath
++ exceeds MaxSize.
++ @retval FALSE If PcdMaximumDevicePathNodeCount is not zero, the node
++ count of the DevicePath exceeds PcdMaximumDevicePathNodeCount.
++**/
++BOOLEAN
++EFIAPI
++IsDevicePathValid (
++ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
++ IN UINTN MaxSize
++ )
++{
++ UINTN Count;
++ UINTN Size;
++ UINTN NodeLength;
++
++ ASSERT (DevicePath != NULL);
++
++ for (Count = 0, Size = 0; !IsDevicePathEnd (DevicePath); DevicePath = NextDevicePathNode (DevicePath)) {
++ NodeLength = DevicePathNodeLength (DevicePath);
++ if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
++ return FALSE;
++ }
++
++ if (MaxSize > 0) {
++ Size += NodeLength;
++ if (Size + END_DEVICE_PATH_LENGTH > MaxSize) {
++ return FALSE;
++ }
++ }
++
++ if (PcdGet32 (PcdMaximumDevicePathNodeCount) > 0) {
++ Count++;
++ if (Count >= PcdGet32 (PcdMaximumDevicePathNodeCount)) {
++ return FALSE;
++ }
++ }
++ }
++
++ //
++ // Only return TRUE when the End Device Path node is valid.
++ //
++ return (BOOLEAN) (DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH);
++}
++
++/**
+ Returns the Type field of a device path node.
+
+ Returns the Type field of the device path node specified by Node.
+@@ -106,8 +162,12 @@ DevicePathNodeLength (
+ IN CONST VOID *Node
+ )
+ {
++ UINTN Length;
++
+ ASSERT (Node != NULL);
+- return ReadUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0]);
++ Length = ReadUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0]);
++ ASSERT (Length >= sizeof (EFI_DEVICE_PATH_PROTOCOL));
++ return Length;
+ }
+
+ /**
+@@ -227,7 +287,8 @@ IsDevicePathEndInstance (
+ be used to set the contents of the Length field.
+
+ If Node is NULL, then ASSERT().
+- If NodeLength >= 0x10000, then ASSERT().
++ If NodeLength >= SIZE_64KB, then ASSERT().
++ If NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL), then ASSERT().
+
+ @param Node A pointer to a device path node data structure.
+ @param Length The length, in bytes, of the device path node.
+@@ -243,7 +304,7 @@ SetDevicePathNodeLength (
+ )
+ {
+ ASSERT (Node != NULL);
+- ASSERT (Length < 0x10000);
++ ASSERT ((Length >= sizeof (EFI_DEVICE_PATH_PROTOCOL)) && (Length < SIZE_64KB));
+ return WriteUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0], (UINT16)(Length));
+ }
+
+@@ -277,12 +338,12 @@ SetDevicePathEndNode (
+ Returns the size of a device path in bytes.
+
+ This function returns the size, in bytes, of the device path data structure
+- specified by DevicePath including the end of device path node. If DevicePath
+- is NULL, then 0 is returned.
++ specified by DevicePath including the end of device path node.
++ If DevicePath is NULL or invalid, then 0 is returned.
+
+ @param DevicePath A pointer to a device path data structure.
+-
+- @retval 0 If DevicePath is NULL.
++
++ @retval 0 If DevicePath is NULL or invalid.
+ @retval Others The size of a device path in bytes.
+
+ **/
+@@ -298,6 +359,10 @@ GetDevicePathSize (
+ return 0;
+ }
+
++ if (!IsDevicePathValid (DevicePath, 0)) {
++ return 0;
++ }
++
+ //
+ // Search for the end of the device path structure
+ //
+@@ -324,7 +389,7 @@ GetDevicePathSize (
+
+ @param DevicePath A pointer to a device path data structure.
+
+- @retval NULL If DevicePath is NULL.
++ @retval NULL DevicePath is NULL or invalid.
+ @retval Others A pointer to the duplicated device path.
+
+ **/
+@@ -370,6 +435,7 @@ DuplicateDevicePath (
+ @param SecondDevicePath A pointer to a device path data structure.
+
+ @retval NULL If there is not enough memory for the newly allocated buffer.
++ @retval NULL If FirstDevicePath or SecondDevicePath is invalid.
+ @retval Others A pointer to the new device path if success.
+ Or a copy an end-of-device-path if both FirstDevicePath and SecondDevicePath are NULL.
+
+@@ -398,6 +464,10 @@ AppendDevicePath (
+ return DuplicateDevicePath (FirstDevicePath);
+ }
+
++ if (!IsDevicePathValid (FirstDevicePath, 0) || !IsDevicePathValid (SecondDevicePath, 0)) {
++ return NULL;
++ }
++
+ //
+ // Allocate space for the combined device path. It only has one end node of
+ // length EFI_DEVICE_PATH_PROTOCOL.
+@@ -500,6 +570,7 @@ AppendDevicePathNode (
+ path instance and a new end-of-device-path-instance node is inserted between.
+ If DevicePath is NULL, then a copy if DevicePathInstance is returned.
+ If DevicePathInstance is NULL, then NULL is returned.
++ If DevicePath or DevicePathInstance is invalid, then NULL is returned.
+ If there is not enough memory to allocate space for the new device path, then
+ NULL is returned.
+ The memory is allocated from EFI boot services memory. It is the responsibility
+@@ -531,6 +602,10 @@ AppendDevicePathInstance (
+ return NULL;
+ }
+
++ if (!IsDevicePathValid (DevicePath, 0) || !IsDevicePathValid (DevicePathInstance, 0)) {
++ return NULL;
++ }
++
+ SrcSize = GetDevicePathSize (DevicePath);
+ InstanceSize = GetDevicePathSize (DevicePathInstance);
+
+@@ -559,6 +634,7 @@ AppendDevicePathInstance (
+ DevicePath to point to the next device path instance in the device path (or NULL
+ if no more) and updates Size to hold the size of the device path instance copy.
+ If DevicePath is NULL, then NULL is returned.
++ If DevicePath points to a invalid device path, then NULL is returned.
+ If there is not enough memory to allocate space for the new device path, then
+ NULL is returned.
+ The memory is allocated from EFI boot services memory. It is the responsibility
+@@ -596,6 +672,10 @@ GetNextDevicePathInstance (
+ return NULL;
+ }
+
++ if (!IsDevicePathValid (*DevicePath, 0)) {
++ return NULL;
++ }
++
+ //
+ // Find the end of the device path instance
+ //
+@@ -681,13 +761,14 @@ CreateDeviceNode (
+
+ This function returns TRUE if the device path specified by DevicePath is
+ multi-instance.
+- Otherwise, FALSE is returned. If DevicePath is NULL, then FALSE is returned.
++ Otherwise, FALSE is returned.
++ If DevicePath is NULL or invalid, then FALSE is returned.
+
+ @param DevicePath A pointer to a device path data structure.
+
+ @retval TRUE DevicePath is multi-instance.
+- @retval FALSE DevicePath is not multi-instance or DevicePath
+- is NULL.
++ @retval FALSE DevicePath is not multi-instance, or DevicePath
++ is NULL or invalid.
+
+ **/
+ BOOLEAN
+@@ -702,6 +783,10 @@ IsDevicePathMultiInstance (
+ return FALSE;
+ }
+
++ if (!IsDevicePathValid (DevicePath, 0)) {
++ return FALSE;
++ }
++
+ Node = DevicePath;
+ while (!IsDevicePathEnd (Node)) {
+ if (IsDevicePathEndInstance (Node)) {
+@@ -776,15 +861,14 @@ FileDevicePath (
+ IN CONST CHAR16 *FileName
+ )
+ {
+- UINT16 Size;
++ UINTN Size;
+ FILEPATH_DEVICE_PATH *FilePath;
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;
+ EFI_DEVICE_PATH_PROTOCOL *FileDevicePath;
+
+ DevicePath = NULL;
+
+- Size = (UINT16) StrSize (FileName);
+-
++ Size = StrSize (FileName);
+ FileDevicePath = AllocatePool (Size + SIZE_OF_FILEPATH_DEVICE_PATH + END_DEVICE_PATH_LENGTH);
+ if (FileDevicePath != NULL) {
+ FilePath = (FILEPATH_DEVICE_PATH *) FileDevicePath;
+diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+index c34301d..2ae151d 100644
+--- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
++++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+@@ -3,7 +3,7 @@
+ #
+ # Device Path Library that layers on top of the Memory Allocation Library.
+ #
+-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
++# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
+ #
+ # This program and the accompanying materials
+ # are licensed and made available under the terms and conditions of the BSD License
+@@ -42,8 +42,10 @@
+ MemoryAllocationLib
+ DebugLib
+ BaseMemoryLib
+-
++ PcdLib
+
+ [Protocols]
+ gEfiDevicePathProtocolGuid ## CONSUMES
+
++[Pcd]
++ gEfiMdePkgTokenSpaceGuid.PcdMaximumDevicePathNodeCount
+diff --git a/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c b/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c
+index 8275dd6..1052988 100644
+--- a/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c
++++ b/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLib.c
+@@ -2,7 +2,7 @@
+ Library instance that implement UEFI Device Path Library class based on protocol
+ gEfiDevicePathUtilitiesProtocolGuid.
+
+- Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
++ Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+@@ -24,6 +24,7 @@
+ #include <Library/MemoryAllocationLib.h>
+ #include <Library/BaseMemoryLib.h>
+ #include <Library/UefiBootServicesTableLib.h>
++#include <Library/PcdLib.h>
+
+ EFI_DEVICE_PATH_UTILITIES_PROTOCOL *mDevicePathUtilities = NULL;
+
+@@ -72,6 +73,61 @@ DevicePathLibConstructor (
+ }
+
+ /**
++ Determine whether a given device path is valid.
++ If DevicePath is NULL, then ASSERT().
++
++ @param DevicePath A pointer to a device path data structure.
++ @param MaxSize The maximum size of the device path data structure.
++
++ @retval TRUE DevicePath is valid.
++ @retval FALSE The length of any node node in the DevicePath is less
++ than sizeof (EFI_DEVICE_PATH_PROTOCOL).
++ @retval FALSE If MaxSize is not zero, the size of the DevicePath
++ exceeds MaxSize.
++ @retval FALSE If PcdMaximumDevicePathNodeCount is not zero, the node
++ count of the DevicePath exceeds PcdMaximumDevicePathNodeCount.
++**/
++BOOLEAN
++EFIAPI
++IsDevicePathValid (
++ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath,
++ IN UINTN MaxSize
++ )
++{
++ UINTN Count;
++ UINTN Size;
++ UINTN NodeLength;
++
++ ASSERT (DevicePath != NULL);
++
++ for (Count = 0, Size = 0; !IsDevicePathEnd (DevicePath); DevicePath = NextDevicePathNode (DevicePath)) {
++ NodeLength = DevicePathNodeLength (DevicePath);
++ if (NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL)) {
++ return FALSE;
++ }
++
++ if (MaxSize > 0) {
++ Size += NodeLength;
++ if (Size + END_DEVICE_PATH_LENGTH > MaxSize) {
++ return FALSE;
++ }
++ }
++
++ if (PcdGet32 (PcdMaximumDevicePathNodeCount) > 0) {
++ Count++;
++ if (Count >= PcdGet32 (PcdMaximumDevicePathNodeCount)) {
++ return FALSE;
++ }
++ }
++ }
++
++ //
++ // Only return TRUE when the End Device Path node is valid.
++ //
++ return (BOOLEAN) (DevicePathNodeLength (DevicePath) == END_DEVICE_PATH_LENGTH);
++}
++
++/**
+ Returns the Type field of a device path node.
+
+ Returns the Type field of the device path node specified by Node.
+@@ -136,8 +192,12 @@ DevicePathNodeLength (
+ IN CONST VOID *Node
+ )
+ {
++ UINTN Length;
++
+ ASSERT (Node != NULL);
+- return ReadUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0]);
++ Length = ReadUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0]);
++ ASSERT (Length >= sizeof (EFI_DEVICE_PATH_PROTOCOL));
++ return Length;
+ }
+
+ /**
+@@ -256,7 +316,8 @@ IsDevicePathEndInstance (
+ be used to set the contents of the Length field.
+
+ If Node is NULL, then ASSERT().
+- If NodeLength >= 0x10000, then ASSERT().
++ If NodeLength >= SIZE_64KB, then ASSERT().
++ If NodeLength < sizeof (EFI_DEVICE_PATH_PROTOCOL), then ASSERT().
+
+ @param Node A pointer to a device path node data structure.
+ @param Length The length, in bytes, of the device path node.
+@@ -272,7 +333,7 @@ SetDevicePathNodeLength (
+ )
+ {
+ ASSERT (Node != NULL);
+- ASSERT (Length < 0x10000);
++ ASSERT ((Length >= sizeof (EFI_DEVICE_PATH_PROTOCOL)) && (Length < SIZE_64KB));
+ return WriteUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0], (UINT16)(Length));
+ }
+
+@@ -305,13 +366,14 @@ SetDevicePathEndNode (
+ /**
+ Returns the size of a device path in bytes.
+
+- This function returns the size, in bytes, of the device path data structure specified by
+- DevicePath including the end of device path node. If DevicePath is NULL, then 0 is returned.
++ This function returns the size, in bytes, of the device path data structure
++ specified by DevicePath including the end of device path node.
++ If DevicePath is NULL or invalid, then 0 is returned.
+
+- @param DevicePath A pointer to a device path data structure.
+-
+- @retval 0 If DevicePath is NULL.
+- @retval Others The size of a device path in bytes.
++ @param DevicePath A pointer to a device path data structure.
++
++ @retval 0 If DevicePath is NULL or invalid.
++ @retval Others The size of a device path in bytes.
+
+ **/
+ UINTN
+@@ -336,7 +398,7 @@ GetDevicePathSize (
+
+ @param DevicePath A pointer to a device path data structure.
+
+- @retval NULL If DevicePath is NULL.
++ @retval NULL If DevicePath is NULL or invalid.
+ @retval Others A pointer to the duplicated device path.
+
+ **/
+@@ -367,6 +429,7 @@ DuplicateDevicePath (
+ @param SecondDevicePath A pointer to a device path data structure.
+
+ @retval NULL If there is not enough memory for the newly allocated buffer.
++ @retval NULL If FirstDevicePath or SecondDevicePath is invalid.
+ @retval Others A pointer to the new device path if success.
+ Or a copy an end-of-device-path if both FirstDevicePath and
+ SecondDevicePath are NULL.
+@@ -431,6 +494,7 @@ AppendDevicePathNode (
+ path instance and a new end-of-device-path-instance node is inserted between.
+ If DevicePath is NULL, then a copy if DevicePathInstance is returned.
+ If DevicePathInstance is NULL, then NULL is returned.
++ If DevicePath or DevicePathInstance is invalid, then NULL is returned.
+ If there is not enough memory to allocate space for the new device path, then
+ NULL is returned.
+ The memory is allocated from EFI boot services memory. It is the responsibility
+@@ -524,15 +588,16 @@ CreateDeviceNode (
+ /**
+ Determines if a device path is single or multi-instance.
+
+- This function returns TRUE if the device path specified by DevicePath is
++ This function returns TRUE if the device path specified by DevicePath is
+ multi-instance.
+- Otherwise, FALSE is returned. If DevicePath is NULL, then FALSE is returned.
++ Otherwise, FALSE is returned.
++ If DevicePath is NULL or invalid, then FALSE is returned.
+
+ @param DevicePath A pointer to a device path data structure.
+
+ @retval TRUE DevicePath is multi-instance.
+- @retval FALSE DevicePath is not multi-instance or DevicePath
+- is NULL.
++ @retval FALSE DevicePath is not multi-instance, or DevicePath
++ is NULL or invalid.
+
+ **/
+ BOOLEAN
+diff --git a/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf b/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
+index 3393830..16b47e3 100644
+--- a/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
++++ b/MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
+@@ -4,7 +4,7 @@
+ # Device Path Library that layers on top of the UEFI 2.0 Device Path Protocol.
+ # This library is not available for EFI 1.10 modules.
+ #
+-# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
++# Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
+ #
+ # This program and the accompanying materials
+ # are licensed and made available under the terms and conditions of the BSD License
+@@ -44,11 +44,14 @@
+ MemoryAllocationLib
+ BaseLib
+ DebugLib
+-
++ PcdLib
+
+ [Protocols]
+ gEfiDevicePathProtocolGuid ## CONSUMES
+ gEfiDevicePathUtilitiesProtocolGuid ## CONSUMES
+
++[Pcd]
++ gEfiMdePkgTokenSpaceGuid.PcdMaximumDevicePathNodeCount
++
+ [Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER]
+ gEfiDevicePathUtilitiesProtocolGuid
+diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
+index b29cb01..aefba3f 100644
+--- a/MdePkg/MdePkg.dec
++++ b/MdePkg/MdePkg.dec
+@@ -1287,6 +1287,9 @@
+ ## Indicates the maximum node number of linked list
+ gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000|UINT32|0x00000003
+
++ ## Indicates the maximum node number of device path
++ gEfiMdePkgTokenSpaceGuid.PcdMaximumDevicePathNodeCount|0|UINT32|0x00000029
++
+ ## Indicates the timeout tick of holding spin lock
+ gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000|UINT32|0x00000004
+
diff --git a/refind-efi-tianocore.install b/refind-efi-tianocore.install
new file mode 100644
index 000000000000..72f6850f4a01
--- /dev/null
+++ b/refind-efi-tianocore.install
@@ -0,0 +1,28 @@
+post_install() {
+
+ cat << EOF
+
+refind-efi applications have been installed at /usr/lib/refind/*.efi
+
+UEFI FS drivers have deen installed at /usr/lib/refind/drivers_*/
+
+Copy the efi application (according to your UEFI ARCH)
+and /usr/lib/refind/config/refind.conf to a sub-directory of <EFISYS>/EFI/
+and add an entry to firmware boot menu using efibootmgr or mactel-boot (for Macs)
+
+rEFInd icons have been installed at /usr/share/refind/icons/
+
+HTML Documentation is available at /usr/share/refind/docs/html/
+
+More info at https://wiki.archlinux.org/index.php/UEFI_Bootloaders#Using_rEFInd
+
+EOF
+
+}
+
+post_upgrade() {
+
+ post_install
+
+}
+
diff --git a/refind_include_more_shell_paths.patch b/refind_include_more_shell_paths.patch
index a456e30da758..445a33c86451 100644
--- a/refind_include_more_shell_paths.patch
+++ b/refind_include_more_shell_paths.patch
@@ -1,8 +1,8 @@
diff --git a/refind/main.c b/refind/main.c
-index 9558655..3f54b4f 100644
+index beac3bf..1a2cf58 100644
--- a/refind/main.c
+++ b/refind/main.c
-@@ -58,13 +58,13 @@
+@@ -62,13 +62,13 @@
#define MACOSX_LOADER_PATH L"System\\Library\\CoreServices\\boot.efi"
#if defined (EFIX64)
diff --git a/refind_linux.conf b/refind_linux.conf
index 614ebda93381..a34536b37a03 100644
--- a/refind_linux.conf
+++ b/refind_linux.conf
@@ -1,5 +1,5 @@
-## This file should be present in the same directory as the kernel file(s)
+## This file should be present in the same directory as the EFISTUB kernel and initramfs files
## More info at http://www.rodsbooks.com/refind/linux.html , http://www.rodsbooks.com/efi-bootloaders/efistub.html
-"Boot with defaults" "root=/dev/disk/by-uuid/XXXXXXXXXXXXXXXXX ro rootfstype=ext4 add_efi_memmap"
-"Boot into terminal" "root=/dev/disk/by-uuid/XXXXXXXXXXXXXXXXX ro rootfstype=ext4 add_efi_memmap 3"
+"Boot with defaults" "root=PARTUUID=XXXXXXXX rootfstype=XXXX ro"
+"Boot to terminal" "root=PARTUUID=XXXXXXXX rootfstype=XXXX ro systemd.unit=multi-user.target"