summaryrefslogtreecommitdiff
path: root/sys-freebsd/boot0
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-freebsd/boot0
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-freebsd/boot0')
-rw-r--r--sys-freebsd/boot0/Manifest25
-rw-r--r--sys-freebsd/boot0/boot0-10.3.ebuild82
-rw-r--r--sys-freebsd/boot0/boot0-11.0-r1.ebuild86
-rw-r--r--sys-freebsd/boot0/boot0-11.1.ebuild86
-rw-r--r--sys-freebsd/boot0/boot0-8.2.ebuild53
-rw-r--r--sys-freebsd/boot0/boot0-9.1.ebuild63
-rw-r--r--sys-freebsd/boot0/files/boot0-10.1-gcc46.patch67
-rw-r--r--sys-freebsd/boot0/files/boot0-10.3-clang.patch30
-rw-r--r--sys-freebsd/boot0/files/boot0-10.3-drop-unsupport-cflags.patch28
-rw-r--r--sys-freebsd/boot0/files/boot0-10.3-uefi-support.patch33
-rw-r--r--sys-freebsd/boot0/files/boot0-11.0-gcc46.patch14
-rw-r--r--sys-freebsd/boot0/files/boot0-11.0-uefi-support.patch21
-rw-r--r--sys-freebsd/boot0/files/boot0-8.2-zfsboot-makefile.patch13
-rw-r--r--sys-freebsd/boot0/files/boot0-9.2-gcc46.patch66
-rw-r--r--sys-freebsd/boot0/files/boot0-add-nossp-cflags.patch11
-rw-r--r--sys-freebsd/boot0/metadata.xml12
16 files changed, 690 insertions, 0 deletions
diff --git a/sys-freebsd/boot0/Manifest b/sys-freebsd/boot0/Manifest
new file mode 100644
index 000000000000..a6f55d4a4e07
--- /dev/null
+++ b/sys-freebsd/boot0/Manifest
@@ -0,0 +1,25 @@
+AUX boot0-10.1-gcc46.patch 2180 SHA256 a664f792660fe1dc25b6e54a973ad6d8ac6c19ef309954f5bb7973b52832cc82 SHA512 a0633fe171c668b976277d26c3406d75ec5892cd6fe28845ea9faca03659689ad87fee6eeac5968b00026733e854bb0d2216e6f3987cf1ed9bcedb3bc2b210b6 WHIRLPOOL 2d5ba9602c93ab02aef29838478b578603b39e7d26dbf688e3fccd1cdd7e5fec3aec729db81b4548b69841ab330e8898eb445ee09d06ccd8500fb0f7387c3fc8
+AUX boot0-10.3-clang.patch 847 SHA256 6687fa92439ec0813a61221f5acfc6fe4588432c6660f9e6962437d2589f5a1c SHA512 74a64f9853dc28e5354d1d3d1a97c9543b6f80d48568d264874a23355c4bcab9e6a90a22630b2c7afea4b51c906db4745cb2773feaf42979a9192b8f995d7405 WHIRLPOOL 3a299ffc554ad91a763a974268978755dc7819a6e4c21736efca6df1c0e5a95b07184103724634af3eb634fb2da77abb40d6bfb493cb6effb7463abe2c339905
+AUX boot0-10.3-drop-unsupport-cflags.patch 971 SHA256 26a7aef66e0b436201698f0df262d8af50061da203f90e1bc8babd79815f62b9 SHA512 ca2d36c332515c0c7b89bae24213e5dd21065e7bdd689726e1777d4439dfc850918ad4312751cdc69a417f05724f484f14a8254895e673844245e69133b8cf46 WHIRLPOOL 6ff2f96c33857433ed3160241a7137aef9375d15533f7fd3db979ac8294ee28f21fc9e1c292450fac6a3dd515e86f5969b7b517d36636712ef921af5956faa0f
+AUX boot0-10.3-uefi-support.patch 762 SHA256 5089401accfd622091253ec652b0e86edaf00021ec7372829bec56d08ba4d83c SHA512 6ff9b34969475f9580b364c6fca591901554107ac0eacb7e19888a05411fc4e9928ec632525dba30449678bb14f22cef23605ca5843370f882ca90bb1dc32a1a WHIRLPOOL cb83d397f0a1660b6ee0154b1c2d6e7807e2c6e61d92790e5be37233fa6f8bec3947f9c49d5046329486654a648e758f0e4d9f6d2ce7b2cf448c181059745281
+AUX boot0-11.0-gcc46.patch 481 SHA256 d05e22731b13b3eb12c75034c3f3d5ba74c1d842271ba1c81669698d0cfe1911 SHA512 114580260572d03ae145f38d9e7552e18d1d9eace430c102dbc73de055e453fdff9fd81e1ee6f4237d36b87800ff1da63b78ecdd17208ecf8969919fa245cf01 WHIRLPOOL a4a1620b892850f9affac443399901f52af2344539e251169d08d6b7db588a23db5ec3b4857992acda96b9893a7acde848a3171689eebf332fdbb1c9e18e858a
+AUX boot0-11.0-uefi-support.patch 715 SHA256 ca983122c1a73575ce81cfad1c11378b60cdcb869dea4db4fafd387a38136086 SHA512 e6b4b48e5442ad4d948389aa4862484947fce5f15deedd6603cf5616054ccf9fa61a0c190443cdbe76502225a44da37675d1bccf49476ffedd633fe8128a2db6 WHIRLPOOL 0bf282dff86cd8cd59dbf42ad99aae10cf056260e356f4ac88392698107b4c26970c2028300c795ee28e91b8b5129b414e6c25d8f8587effac6cdf8ee56e6e65
+AUX boot0-8.2-zfsboot-makefile.patch 436 SHA256 74a494fce8011f018542a54d6d188c1aa9977b982a3b0c333ea64445dbfab994 SHA512 2d2c1572415362eed73580b681a6e6cd95b1f4abb415221e8904097ac078c620223ca652282404c4f1881dcb605f25f126b53ec0b8409ad4fbbd9bed603ba7c2 WHIRLPOOL ddf074f25ebf256f543cd5ceb8e64934cc045e6dc81f49ef14aad009de69c84309d0b7927c87ff36c75c008fae975e25708b9ec8f21cb083bba77daf3e5107d4
+AUX boot0-9.2-gcc46.patch 2119 SHA256 745245270e8ac2e8a1084f1785bb31ce7a5d2c7242f762260ad9a97fa02970f5 SHA512 ee834269bdc4a79da6854f59fe896b8e13efd1f60d97aefc8829cd1137f8f84810bba4344aac79424a4f31503a1a8579caf468e83a60d127d81f5d10fcbc4ae9 WHIRLPOOL 0c057ffe2baa7cb1b74912cebed5ec5f31adee7780a77993b40bad256e89baf3ed4dc18567c263bfed9a76e63e274072945e37dd729ac62c8538ab7678e4dfe1
+AUX boot0-add-nossp-cflags.patch 341 SHA256 ed801285f9e9846c7fc4f334a2dfceec2d023be9b22e53aa3713d648cac899be SHA512 980a6b8f247f0d51724f409627c81e5e089e4b2a7b11732bc3cf569f87a5c308e7c2e5985ce3ba32c61c489a5a1e16596bde43ef3c260b0730ec67e50f42e9bb WHIRLPOOL 06ae4058fd8c39abe215e417fdffd1c13fdc641891fcb8f8a37af3ac31e781da666c3cd9cf2b800174439ebcc2ecb5b6efb9e9e5880a216878fb4ced7ffd9bfe
+DIST boot0-EN-1618-loader.patch 1092 SHA256 9c145ceeebcf96e562933ec824a942baa9098177b9c01e5bd56d670f6514030e SHA512 c2d28dc48289683c009a783db59ce62008a8d9231d4ea5b1ebe6dac2d6d0d86a285524195be9a806c23fbc2ceb6e159fcd7a7e8d01fe973b6ea6d154bfca298c WHIRLPOOL f2e7d87ec26b2607ad99eed5516bfd28b6d31fee495fc0c031e7c47bcd6d049ed6ccc7f6c6675c35f1afd3e5ae294584e66d49052a16230bfe15f3e29f177d0f
+DIST freebsd-contrib-9.1.tar.bz2 54751432 SHA256 e7ffa056d4050ce03ee8e23e276e2a9a494326a98d60c43bee2afcc59576deb8 SHA512 71be13049258c6e6b5e4f63cc16da5d349a89d68f04d87446e4ad33ae8bf2a93ea67d9c256b7bec60b61e65db0487268070cfb77a484c3ac0f8ba368b48c2438 WHIRLPOOL a2a84423175499208d34809e802284d6ba649f317c3a9ad8b7312fa19efe142ebadab0048bac0db8e988e59f9a7468ac7c5d0d25e78b82bdb269a20d18153cee
+DIST freebsd-lib-9.1.tar.bz2 3206685 SHA256 f31fa8107b4de711c548f6d0c1bb1f81d09f51bcc3b14a1e9e90bb0e7cc4a35d SHA512 40d0c36b6b889c404fa0e0afa38ba4e84a55bc88ffa2f98a70afbd7a32c4f32c158617ba770567d082a986d62c09b3ec8db3dc5ab853ee1c9bbe0b90bb82396e WHIRLPOOL 581878bf9c43184b043b4293409b85901c9ed1f9bd279e965414aca41ba50950848ebda3ee10a503a028135dfd2765e95a11acd4e62a11c528e104392bbbd8d0
+DIST freebsd-src-10.3.tar.xz 126900216 SHA256 f50763dcac88e9b7ec616b77d537bf338f470350e2c85e0cc7decfcc8372b54d SHA512 a0c95fc4bbc5ad7599d0a83651a497e85cd85a5c433e5e175c57480b466c9eb5aa0390804d6336da8301c75ad499484399d39b8f7efbcfda8cafb09b1aa12d8f WHIRLPOOL bf5320bc506fb73a63d0fb324b60667a196ca2fef5d0215637a657c613f2052d76d002deb205e258f6d4e2aaea15490b26679e59a102606a34b58ab1f6b755ad
+DIST freebsd-src-11.0.tar.xz 140252356 SHA256 0725a7f1d3e8985f4b2e31a2ad714334463a5016b203073a8fc196649f3d5a27 SHA512 ee1271bb38ee46fbab3d49b33f5b5afd76f9402b2e792581d63f02272df8e2a4011fac97ad550434f0c2fc5fe241940276629bde55e75f8638896a81339870cd WHIRLPOOL e1cda77189990c1d2187ab2d9e842ff3c619d8235f1ade56819fadc52f680a871de17cf05f8119614557c615ad19d41d1b6080c4b3768e7252889546b865d827
+DIST freebsd-src-11.1.tar.xz 147661560 SHA256 7e1186c2b3f6d070995b88bef5aded34089fed227c7b584c30b28cecaf428154 SHA512 b97707ec7a601ca6bcb682c45f6d94a38484301ac24630d7285eff6f88b027ce6900c93fc62f8ce36e0cf32c91f73a9d1c999db397b7f8782fd74a8551a03aca WHIRLPOOL 3f88b15153c25c7878d1a730213e5bc8c200c05427895ae97280c4412680bb8e67cf4f8170f9e2b0f21d63ec42365f44f7d5eafe614e9b8726f4bc3cc3825202
+DIST freebsd-sys-8.2.tar.bz2 25835329 SHA256 0c6c7b61aae94db2931f985d5899f3bca78fc8ffab6b598fbaa158142d676f16 SHA512 6ea4516a5c52e25c4f993f7acb875463a5caea93dbdf250c5d48eee95fff226956e9f030cab7e341b5e6a132325bc3dbf93dcb4b1185acb011918e50b1a22be3 WHIRLPOOL 870deeff877c6b9fc812a4260e4fdbb6715a5dc2065cab3bfbf2a42d876f6654703ccb124275a4e2c410cef48f3db02b63cc76059eccf9cf90244826f35b7a15
+DIST freebsd-sys-9.1.tar.bz2 32588103 SHA256 b93a7ac8334ac16cc9f60665048e5ef812c0a6c62f10d0b0a674aec3f56516a8 SHA512 7dc9d9e00dde8f592bb171f4386d02b655b73cb4f153fe5ec063d010a148ef0639eae0dcdb3eeb09ecd1e3653c69e49a2d261329fa6d0381d2ddabe258ddde6d WHIRLPOOL c8348344dfb14bad64bd3a78ee615ddd29203175b292233254f8ba175e7a3fb7218af6f95f7b4dbf394c0354bafe9d8bb0c21cdf0ceaeb697214964b280469b3
+EBUILD boot0-10.3.ebuild 1888 SHA256 119cbee68507d93b39e3b4f4e7e32bc0002e1c221871974e7353c8ec308b1356 SHA512 65d46563288ccb402b22f3f722148d6bdb4d0ab209b69fe2c9fcd97abc6995127007a2f8b8b1fb276a7d5b60bdf74fa397227f77234c3b697a1d106f9ac6d345 WHIRLPOOL a74b6cbc70eadc87df1e2af6abc80e933e5559dc1f0c45ba828fbe30b8dddb72fb7bbb7320700f9d22293550d74c7e8050decc7d3241990e66a992d89e3d1901
+EBUILD boot0-11.0-r1.ebuild 1993 SHA256 a4aaf0c88052c60f99c0dc55e9ad286d2f9e911421ffd46460a80e0176045d8a SHA512 c74a033c1c76277333fa707b0da9e4e27d10f6aa92ad797c628337db9293a497fb6f22df928bcd0bdcfb0c7df89bba24917ebe4aef7f5925674f6944da64bcb5 WHIRLPOOL 9305464e9f0a41f0f9f5051e8788342eff2eda59877fb151a2cd5c0df0494cf415caaab29738f1055220dd70f9f7080aed38bb7819b99930e1fc0bdd9c461553
+EBUILD boot0-11.1.ebuild 1940 SHA256 f8d6fe44b7f185d98678e3b7bd1303ea5f6147988b3a393b6c7d47c7ab0837e0 SHA512 8d8890bac720309a9ee5e56e950139ec0a3862d64643b73f92bb7783da8ac56db1d271fdd09bb7aa19f062ef6b9ffbac3b98d952d982911b3392fc59a4fd94eb WHIRLPOOL 7ae1e314cd24fe2c1d487fb8a5dfbbd04c896c40415d4a938f1072ed09240ea49b47965b1e3031ea443b111d8302a06a3c33f09f7e4cc647826e5b28b5eeac68
+EBUILD boot0-8.2.ebuild 1181 SHA256 88c80a564986c2029803d627fefcce1cf9286288dbbc014f4a13a8bbf1551004 SHA512 955c8d97b4ca370a9e8941ccec006d113c89baa25188abfb0e5e9d14ab1c9723ab3c2e32ccf58adbe2f3730c69f782abf645dd6931e1e6a689cba72b3651fb32 WHIRLPOOL 3365447db144ac83bc083057f07523a8a0d0864c62e37c48c7597ef2ad1b387111305033d4a12cd59d6d1c5537c392b3ad140f6535aa8a2df8f7b67491b567ea
+EBUILD boot0-9.1.ebuild 1477 SHA256 9c9413d705414132214a168f572abe597557ba88b01bdbae74dda6c7acf8665d SHA512 fe21b5d7105aecf6419be9339f989f85112b7f4ef1c061c069a60789af202d49bec44123aaf5f69d8ea732d63d87d041272540ba988b054ff51fc08c0b43bf06 WHIRLPOOL dcebac2809862ded9fca4437eba6300ec76e7a564616acfe3614474994a2627faa7a3cda08ce81d03d1e13acfabca5cd57b30f07601e8727025192690b8e15ba
+MISC ChangeLog 4356 SHA256 d46fb641132655adf9fe74fcfa886e964e6e6e43143e5a68e90b1da83e82f10e SHA512 132d392db914928b87dd9eb68cf9bbad409325b1a7acd6af834b45877f8f6cdbc2f15bf15f16a5d141bafb0d4d266b400138a0b5ecf2fd407b720e62e9bf7e57 WHIRLPOOL 7a8dcf921afe3bf1b33b64c05fe0d07a10f93206d82adb6afdc1cca0aeabda61ac82fa5eb66295014684bb5bb7e03d5b73268896b21cbb84cb4fd95e025acc02
+MISC ChangeLog-2015 8356 SHA256 8c0af2a79e25332eaad01fbc8d7a9f2687f09d78dcb6b64eab3a09c018a5ba72 SHA512 5a6eef7c4b64c46225715cdb9cb1e1d7182a8f5b42f1ac346d71dcdfc95e13a1ddf517ad509963e1e2b832713e44ba1810739834f458ca22e21090f67de113d1 WHIRLPOOL 97aa61125896c790634a8b8f43ddea1e0d2ac274654e4cb9bbdd35c94194653edc3a9c9cd61b4b810f9280e8a3d4a3b94268e92a4f7599a715f56bceba35d2f4
+MISC metadata.xml 385 SHA256 1b6dbb50d321102c9a48b5f6bce5825e88ce8dfcabd86892194b2fa10e540b11 SHA512 b65045bfb5e261f1a26102c00ff576065570701658bc643ded73761de269e72fb8843ce38231e92def5c7823720e1ec687b8cce575307097847d10dd35b8a808 WHIRLPOOL f073e698718e05e55026bad3888ce2809d2a0a7f4d0e4090e5c1fb16be55846e0bbf81c09748b76ea960a77e74b96678031c888852b8e4e259640d67386cc655
diff --git a/sys-freebsd/boot0/boot0-10.3.ebuild b/sys-freebsd/boot0/boot0-10.3.ebuild
new file mode 100644
index 000000000000..d33328cf5f42
--- /dev/null
+++ b/sys-freebsd/boot0/boot0-10.3.ebuild
@@ -0,0 +1,82 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit bsdmk freebsd flag-o-matic toolchain-funcs
+
+DESCRIPTION="FreeBSD's bootloader"
+SLOT="0"
+
+IUSE="bzip2 ieee1394 tftp zfs"
+
+if [[ ${PV} != *9999* ]]; then
+ KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+fi
+
+EXTRACTONLY="
+ sys/
+ lib/
+ contrib/bzip2/
+"
+
+RDEPEND=""
+DEPEND="=sys-freebsd/freebsd-mk-defs-${RV}*
+ =sys-freebsd/freebsd-lib-${RV}*"
+
+S="${WORKDIR}/sys/boot"
+
+PATCHES=( "${FILESDIR}/${PN}-10.1-gcc46.patch"
+ "${FILESDIR}/${PN}-10.3-clang.patch"
+ "${FILESDIR}/${PN}-10.3-drop-unsupport-cflags.patch"
+ "${FILESDIR}/${PN}-10.3-uefi-support.patch"
+ "${FILESDIR}/${PN}-add-nossp-cflags.patch" )
+
+boot0_use_enable() {
+ use ${1} && mymakeopts="${mymakeopts} LOADER_${2}_SUPPORT=\"yes\""
+ use ${1} || mymakeopts="${mymakeopts} WITHOUT_${2}= "
+}
+
+pkg_setup() {
+ boot0_use_enable ieee1394 FIREWIRE
+ boot0_use_enable zfs ZFS
+ boot0_use_enable tftp TFTP
+ boot0_use_enable bzip2 BZIP2
+}
+
+src_prepare() {
+ sed -e '/-mno-align-long-strings/d' \
+ -i "${S}"/i386/boot2/Makefile \
+ -i "${S}"/i386/gptboot/Makefile \
+ -i "${S}"/i386/gptzfsboot/Makefile \
+ -i "${S}"/i386/zfsboot/Makefile || die
+
+ export MAKEOBJDIRPREFIX="${WORKDIR}/build"
+}
+
+src_compile() {
+ strip-flags
+ append-flags "-fno-strict-aliasing"
+
+ cd "${WORKDIR}/lib/libstand" || die
+ freebsd_src_compile
+
+ CFLAGS="${CFLAGS} -I${WORKDIR}/lib/libstand"
+ LDFLAGS="${LDFLAGS} -L${WORKDIR}/lib/libstand"
+ export LIBSTAND="${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libstand/libstand.a"
+
+ cd "${S}" || die
+ NOFLAGSTRIP="yes" freebsd_src_compile
+}
+
+src_install() {
+ dodir /boot/defaults
+ mkinstall FILESDIR=/boot || die "mkinstall failed"
+
+ cd "${WORKDIR}/sys/$(tc-arch-kernel)/conf" || die
+ insinto /boot
+ newins GENERIC.hints device.hints
+
+ echo 'CONFIG_PROTECT="/boot/device.hints"' > "${T}"/50boot0
+ doenvd "${T}"/50boot0
+}
diff --git a/sys-freebsd/boot0/boot0-11.0-r1.ebuild b/sys-freebsd/boot0/boot0-11.0-r1.ebuild
new file mode 100644
index 000000000000..1b56c9159994
--- /dev/null
+++ b/sys-freebsd/boot0/boot0-11.0-r1.ebuild
@@ -0,0 +1,86 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit bsdmk freebsd flag-o-matic toolchain-funcs
+
+DESCRIPTION="FreeBSD's bootloader"
+SLOT="0"
+
+IUSE="bzip2 ieee1394 tftp zfs"
+
+# Security Advisory and Errata patches.
+UPSTREAM_PATCHES=( "EN-16:18/loader.patch" )
+
+if [[ ${PV} != *9999* ]]; then
+ KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+ SRC_URI="${SRC_URI}
+ $(freebsd_upstream_patches)"
+fi
+
+EXTRACTONLY="
+ sys/
+ lib/
+ contrib/bzip2/
+"
+
+RDEPEND=""
+DEPEND="=sys-freebsd/freebsd-mk-defs-${RV}*
+ =sys-freebsd/freebsd-lib-${RV}*"
+
+S="${WORKDIR}/sys/boot"
+
+PATCHES=( "${FILESDIR}/${PN}-11.0-gcc46.patch"
+ "${FILESDIR}/${PN}-11.0-uefi-support.patch"
+ "${FILESDIR}/${PN}-add-nossp-cflags.patch" )
+
+boot0_use_enable() {
+ use ${1} && mymakeopts="${mymakeopts} LOADER_${2}_SUPPORT=\"yes\""
+ use ${1} || mymakeopts="${mymakeopts} WITHOUT_${2}= "
+}
+
+pkg_setup() {
+ boot0_use_enable ieee1394 FIREWIRE
+ boot0_use_enable zfs ZFS
+ boot0_use_enable tftp TFTP
+ boot0_use_enable bzip2 BZIP2
+}
+
+src_prepare() {
+ sed -e '/-mno-align-long-strings/d' \
+ -i "${S}"/i386/boot2/Makefile \
+ -i "${S}"/i386/gptboot/Makefile \
+ -i "${S}"/i386/gptzfsboot/Makefile \
+ -i "${S}"/i386/zfsboot/Makefile || die
+
+ mymakeopts="${mymakeopts} LOADER_NO_GELI_SUPPORT=yes"
+ export MAKEOBJDIRPREFIX="${WORKDIR}/build"
+}
+
+src_compile() {
+ strip-flags
+ append-flags "-fno-strict-aliasing"
+
+ cd "${WORKDIR}/lib/libstand" || die
+ freebsd_src_compile
+
+ CFLAGS="${CFLAGS} -I${WORKDIR}/lib/libstand"
+ LDFLAGS="${LDFLAGS} -L${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libstand"
+ export LIBSTAND="${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libstand/libstand.a"
+
+ cd "${S}" || die
+ NOFLAGSTRIP="yes" freebsd_src_compile
+}
+
+src_install() {
+ dodir /boot/defaults
+ freebsd_src_install FILESDIR=/boot
+
+ cd "${WORKDIR}/sys/$(tc-arch-kernel)/conf" || die
+ insinto /boot
+ newins GENERIC.hints device.hints
+
+ echo 'CONFIG_PROTECT="/boot/device.hints"' > "${T}"/50boot0
+ doenvd "${T}"/50boot0
+}
diff --git a/sys-freebsd/boot0/boot0-11.1.ebuild b/sys-freebsd/boot0/boot0-11.1.ebuild
new file mode 100644
index 000000000000..2f95e76f3e23
--- /dev/null
+++ b/sys-freebsd/boot0/boot0-11.1.ebuild
@@ -0,0 +1,86 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit bsdmk freebsd flag-o-matic toolchain-funcs
+
+DESCRIPTION="FreeBSD's bootloader"
+SLOT="0"
+
+IUSE="bzip2 ieee1394 tftp zfs"
+
+# Security Advisory and Errata patches.
+# UPSTREAM_PATCHES=()
+
+if [[ ${PV} != *9999* ]]; then
+ KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+ SRC_URI="${SRC_URI}
+ $(freebsd_upstream_patches)"
+fi
+
+EXTRACTONLY="
+ sys/
+ lib/
+ contrib/bzip2/
+ contrib/zlib/
+"
+
+RDEPEND=""
+DEPEND="=sys-freebsd/freebsd-mk-defs-${RV}*
+ =sys-freebsd/freebsd-lib-${RV}*"
+
+S="${WORKDIR}/sys/boot"
+
+PATCHES=( "${FILESDIR}/${PN}-11.0-gcc46.patch"
+ "${FILESDIR}/${PN}-add-nossp-cflags.patch" )
+
+boot0_use_enable() {
+ use ${1} && mymakeopts="${mymakeopts} LOADER_${2}_SUPPORT=\"yes\""
+ use ${1} || mymakeopts="${mymakeopts} WITHOUT_${2}= "
+}
+
+pkg_setup() {
+ boot0_use_enable ieee1394 FIREWIRE
+ boot0_use_enable zfs ZFS
+ boot0_use_enable tftp TFTP
+ boot0_use_enable bzip2 BZIP2
+}
+
+src_prepare() {
+ sed -e '/-mno-align-long-strings/d' \
+ -i "${S}"/i386/boot2/Makefile \
+ -i "${S}"/i386/gptboot/Makefile \
+ -i "${S}"/i386/gptzfsboot/Makefile \
+ -i "${S}"/i386/zfsboot/Makefile || die
+
+ mymakeopts="${mymakeopts} LOADER_NO_GELI_SUPPORT=yes"
+ export MAKEOBJDIRPREFIX="${WORKDIR}/build"
+}
+
+src_compile() {
+ strip-flags
+ append-flags "-fno-strict-aliasing"
+
+ cd "${WORKDIR}/lib/libstand" || die
+ freebsd_src_compile
+
+ CFLAGS="${CFLAGS} -I${WORKDIR}/lib/libstand"
+ LDFLAGS="${LDFLAGS} -L${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libstand"
+ export LIBSTAND="${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libstand/libstand.a"
+
+ cd "${S}" || die
+ NOFLAGSTRIP="yes" freebsd_src_compile
+}
+
+src_install() {
+ dodir /boot/defaults
+ freebsd_src_install FILESDIR=/boot
+
+ cd "${WORKDIR}/sys/$(tc-arch-kernel)/conf" || die
+ insinto /boot
+ newins GENERIC.hints device.hints
+
+ echo 'CONFIG_PROTECT="/boot/device.hints"' > "${T}"/50boot0
+ doenvd "${T}"/50boot0
+}
diff --git a/sys-freebsd/boot0/boot0-8.2.ebuild b/sys-freebsd/boot0/boot0-8.2.ebuild
new file mode 100644
index 000000000000..1cf02f669187
--- /dev/null
+++ b/sys-freebsd/boot0/boot0-8.2.ebuild
@@ -0,0 +1,53 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=2
+
+inherit bsdmk freebsd flag-o-matic
+
+DESCRIPTION="FreeBSD's bootloader"
+SLOT="0"
+KEYWORDS="~sparc-fbsd ~x86-fbsd"
+
+IUSE="bzip2 ieee1394 tftp zfs"
+
+SRC_URI="mirror://gentoo/${SYS}.tar.bz2"
+
+RDEPEND=""
+DEPEND="=sys-freebsd/freebsd-mk-defs-${RV}*
+ =sys-freebsd/freebsd-lib-${RV}*"
+
+S="${WORKDIR}/sys/boot"
+
+PATCHES=( "${FILESDIR}"/${P}-zfsboot-makefile.patch )
+
+boot0_use_enable() {
+ use ${1} && mymakeopts="${mymakeopts} LOADER_${2}_SUPPORT=\"yes\""
+}
+
+pkg_setup() {
+ boot0_use_enable ieee1394 FIREWIRE
+ boot0_use_enable zfs ZFS
+ boot0_use_enable tftp TFTP
+ boot0_use_enable bzip2 BZIP2
+}
+
+src_prepare() {
+ sed -e '/-fomit-frame-pointer/d' -e '/-mno-align-long-strings/d' \
+ -i "${S}"/i386/boot2/Makefile \
+ -i "${S}"/i386/gptboot/Makefile \
+ -i "${S}"/i386/gptzfsboot/Makefile \
+ -i "${S}"/i386/zfsboot/Makefile || die
+}
+
+src_compile() {
+ strip-flags
+ append-flags "-I/usr/include/libstand/"
+ append-flags "-fno-strict-aliasing"
+ NOFLAGSTRIP="yes" freebsd_src_compile
+}
+
+src_install() {
+ dodir /boot/defaults
+ mkinstall FILESDIR=/boot || die "mkinstall failed"
+}
diff --git a/sys-freebsd/boot0/boot0-9.1.ebuild b/sys-freebsd/boot0/boot0-9.1.ebuild
new file mode 100644
index 000000000000..df9341b45fd2
--- /dev/null
+++ b/sys-freebsd/boot0/boot0-9.1.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=2
+
+inherit bsdmk freebsd flag-o-matic
+
+DESCRIPTION="FreeBSD's bootloader"
+SLOT="0"
+KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+
+IUSE="bzip2 ieee1394 tftp zfs"
+
+SRC_URI="mirror://gentoo/${SYS}.tar.bz2
+ mirror://gentoo/${LIB}.tar.bz2
+ mirror://gentoo/${CONTRIB}.tar.bz2"
+
+RDEPEND=""
+DEPEND="=sys-freebsd/freebsd-mk-defs-${RV}*
+ =sys-freebsd/freebsd-lib-${RV}*"
+
+S="${WORKDIR}/sys/boot"
+
+PATCHES=( "${FILESDIR}/${PN}-9.2-gcc46.patch"
+ "${FILESDIR}/${PN}-add-nossp-cflags.patch" )
+
+boot0_use_enable() {
+ use ${1} && mymakeopts="${mymakeopts} LOADER_${2}_SUPPORT=\"yes\""
+}
+
+pkg_setup() {
+ boot0_use_enable ieee1394 FIREWIRE
+ boot0_use_enable zfs ZFS
+ boot0_use_enable tftp TFTP
+ boot0_use_enable bzip2 BZIP2
+}
+
+src_prepare() {
+ sed -e '/-fomit-frame-pointer/d' -e '/-mno-align-long-strings/d' \
+ -i "${S}"/i386/boot2/Makefile \
+ -i "${S}"/i386/gptboot/Makefile \
+ -i "${S}"/i386/gptzfsboot/Makefile \
+ -i "${S}"/i386/zfsboot/Makefile || die
+}
+
+src_compile() {
+ strip-flags
+ append-flags "-fno-strict-aliasing"
+
+ cd "${WORKDIR}/lib/libstand" || die
+ freebsd_src_compile
+
+ cd "${S}"
+ CFLAGS="${CFLAGS} -I${WORKDIR}/lib/libstand"
+ LDFLAGS="${LDFLAGS} -L${WORKDIR}/lib/libstand"
+ export LIBSTAND="${WORKDIR}/lib/libstand/libstand.a"
+ NOFLAGSTRIP="yes" freebsd_src_compile
+}
+
+src_install() {
+ dodir /boot/defaults
+ mkinstall FILESDIR=/boot || die "mkinstall failed"
+}
diff --git a/sys-freebsd/boot0/files/boot0-10.1-gcc46.patch b/sys-freebsd/boot0/files/boot0-10.1-gcc46.patch
new file mode 100644
index 000000000000..9b31e7c0d1ba
--- /dev/null
+++ b/sys-freebsd/boot0/files/boot0-10.1-gcc46.patch
@@ -0,0 +1,67 @@
+diff --git a/sys/boot/i386/Makefile.inc b/sys/boot/i386/Makefile.inc
+index 472b275..0c9409d 100644
+--- a/sys/boot/i386/Makefile.inc
++++ b/sys/boot/i386/Makefile.inc
+@@ -13,8 +13,6 @@ LDFLAGS+= -nostdlib
+ .if ${MACHINE_CPUARCH} == "amd64"
+ CFLAGS+= -m32
+ ACFLAGS+= -m32
+-# LD_FLAGS is passed directly to ${LD}, not via ${CC}:
+-LD_FLAGS+= -m elf_i386_fbsd
+ AFLAGS+= --32
+ .endif
+
+diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile
+index 428950e..6a15450 100644
+--- a/sys/boot/i386/boot2/Makefile
++++ b/sys/boot/i386/boot2/Makefile
+@@ -113,3 +113,10 @@ machine:
+ # XXX: clang integrated-as doesn't grok .codeNN directives yet
+ CFLAGS.boot1.S= ${CLANG_NO_IAS}
+ CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
++
++# gcc 4.6 or later version, -fno-asynchronous-unwind-tables is required to build.
++CFLAGS+= -fno-asynchronous-unwind-tables
++
++.if ${MACHINE_CPUARCH} == "amd64"
++LD_FLAGS+= -m elf_i386_fbsd
++.endif
+diff --git a/sys/boot/i386/gptboot/Makefile b/sys/boot/i386/gptboot/Makefile
+index a90e712..d60ae00 100644
+--- a/sys/boot/i386/gptboot/Makefile
++++ b/sys/boot/i386/gptboot/Makefile
+@@ -81,3 +81,8 @@ machine:
+ # XXX: clang integrated-as doesn't grok .codeNN directives yet
+ CFLAGS.gptldr.S= ${CLANG_NO_IAS}
+ CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
++
++.if ${MACHINE_CPUARCH} == "amd64"
++LD_FLAGS+= -m elf_i386_fbsd
++.endif
++
+diff --git a/sys/boot/i386/gptzfsboot/Makefile b/sys/boot/i386/gptzfsboot/Makefile
+index 5eb2383..c10a917 100644
+--- a/sys/boot/i386/gptzfsboot/Makefile
++++ b/sys/boot/i386/gptzfsboot/Makefile
+@@ -78,3 +78,8 @@ machine:
+ # XXX: clang integrated-as doesn't grok .codeNN directives yet
+ CFLAGS.gptldr.S= ${CLANG_NO_IAS}
+ CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
++
++.if ${MACHINE_CPUARCH} == "amd64"
++LD_FLAGS+= -m elf_i386_fbsd
++.endif
++
+diff --git a/sys/boot/i386/zfsboot/Makefile b/sys/boot/i386/zfsboot/Makefile
+index 149f43a..be1e46a 100644
+--- a/sys/boot/i386/zfsboot/Makefile
++++ b/sys/boot/i386/zfsboot/Makefile
+@@ -91,3 +91,8 @@ machine:
+ # XXX: clang integrated-as doesn't grok .codeNN directives yet
+ CFLAGS.zfsldr.S= ${CLANG_NO_IAS}
+ CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
++
++.if ${MACHINE_CPUARCH} == "amd64"
++LD_FLAGS+= -m elf_i386_fbsd
++.endif
++
diff --git a/sys-freebsd/boot0/files/boot0-10.3-clang.patch b/sys-freebsd/boot0/files/boot0-10.3-clang.patch
new file mode 100644
index 000000000000..4245e21a96e1
--- /dev/null
+++ b/sys-freebsd/boot0/files/boot0-10.3-clang.patch
@@ -0,0 +1,30 @@
+Gentoo Bug: https://bugs.gentoo.org/show_bug.cgi?id=542676
+
+https://svnweb.freebsd.org/base/head/sys/boot/i386/boot2/Makefile?r1=272249&r2=276479
+
+diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile
+index 8a6e771..c030853 100644
+--- a/sys/boot/i386/boot2/Makefile
++++ b/sys/boot/i386/boot2/Makefile
+@@ -22,8 +22,7 @@ BOOT2_UFS?= UFS1_AND_UFS2
+ #BOOT2_UFS?= UFS2_ONLY
+ #BOOT2_UFS?= UFS1_ONLY
+
+-CFLAGS= -Os \
+- -fomit-frame-pointer \
++CFLAGS= -fomit-frame-pointer \
+ -mrtd \
+ -mregparm=3 \
+ -DUSE_XREAD \
+@@ -40,7 +39,10 @@ CFLAGS= -Os \
+ -Winline \
+ ${CLANG_OPT_SMALL}
+
+-CFLAGS.gcc+= -fno-guess-branch-probability \
++CFLAGS.clang+= -Oz
++
++CFLAGS.gcc+= -Os \
++ -fno-guess-branch-probability \
+ -fno-unit-at-a-time \
+ --param max-inline-insns-single=100
+ .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} <= 40201
diff --git a/sys-freebsd/boot0/files/boot0-10.3-drop-unsupport-cflags.patch b/sys-freebsd/boot0/files/boot0-10.3-drop-unsupport-cflags.patch
new file mode 100644
index 000000000000..af1d3512e7da
--- /dev/null
+++ b/sys-freebsd/boot0/files/boot0-10.3-drop-unsupport-cflags.patch
@@ -0,0 +1,28 @@
+diff --git a/sys/boot/efi/libefi/Makefile b/sys/boot/efi/libefi/Makefile
+index fc66e01..470453d 100644
+--- a/sys/boot/efi/libefi/Makefile
++++ b/sys/boot/efi/libefi/Makefile
+@@ -17,9 +17,6 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
+ # Pick up the bootstrap header for some interface items
+ CFLAGS+= -I${.CURDIR}/../../common
+
+-
+-# Suppress warning from clang for FreeBSD %b and %D formats
+-CFLAGS+= -fformat-extensions
+ CFLAGS+= -DTERM_EMU
+
+ .include <bsd.lib.mk>
+diff --git a/sys/boot/i386/libi386/Makefile b/sys/boot/i386/libi386/Makefile
+index 24cc4c1..e5d2bae 100644
+--- a/sys/boot/i386/libi386/Makefile
++++ b/sys/boot/i386/libi386/Makefile
+@@ -55,9 +55,6 @@ CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../common \
+ # the location of libstand
+ CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
+
+-# Suppress warning from clang for FreeBSD %b and %D formats
+-CFLAGS+= -fformat-extensions
+-
+ .if ${MACHINE_CPUARCH} == "amd64"
+ CLEANFILES+= machine
+ machine:
diff --git a/sys-freebsd/boot0/files/boot0-10.3-uefi-support.patch b/sys-freebsd/boot0/files/boot0-10.3-uefi-support.patch
new file mode 100644
index 000000000000..fdafe74252bc
--- /dev/null
+++ b/sys-freebsd/boot0/files/boot0-10.3-uefi-support.patch
@@ -0,0 +1,33 @@
+diff --git a/efi/Makefile b/efi/Makefile
+index 30024e3..a33efb2 100644
+--- a/efi/Makefile
++++ b/efi/Makefile
+@@ -2,15 +2,10 @@
+
+ .include <bsd.own.mk>
+
+-# In-tree GCC does not support __attribute__((ms_abi)).
+-.if ${COMPILER_TYPE} != "gcc"
+-
+ .if ${MACHINE_CPUARCH} == "amd64"
+ SUBDIR+= libefi loader boot1
+ .endif
+
+-.endif # ${COMPILER_TYPE} != "gcc"
+-
+ .if ${MACHINE_CPUARCH} == "ia64"
+ SUBDIR+= libefi
+ .endif
+diff --git a/efi/boot1/Makefile b/efi/boot1/Makefile
+index 4ffdfda..8ec0e00 100644
+--- a/efi/boot1/Makefile
++++ b/efi/boot1/Makefile
+@@ -64,7 +64,7 @@ LDFLAGS+= -Wl,-znocombreloc
+ # Add libstand for required string and memory functions for all platforms.
+ #
+ DPADD+= ${LIBSTAND}
+-LDADD+= -lstand
++LDADD+= ${LIBSTAND}
+
+ DPADD+= ${LDSCRIPT}
+
diff --git a/sys-freebsd/boot0/files/boot0-11.0-gcc46.patch b/sys-freebsd/boot0/files/boot0-11.0-gcc46.patch
new file mode 100644
index 000000000000..ec17d92b5790
--- /dev/null
+++ b/sys-freebsd/boot0/files/boot0-11.0-gcc46.patch
@@ -0,0 +1,14 @@
+diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile
+index ead9ad1..af5e021 100644
+--- a/sys/boot/i386/boot2/Makefile
++++ b/sys/boot/i386/boot2/Makefile
+@@ -45,6 +45,9 @@ CFLAGS.gcc+= -Os \
+ .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} <= 40201
+ CFLAGS.gcc+= -mno-align-long-strings
+ .endif
++.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40600
++CFLAGS.gcc+= -fno-asynchronous-unwind-tables
++.endif
+
+ CFLAGS.clang+= -Oz ${CLANG_OPT_SMALL}
+
diff --git a/sys-freebsd/boot0/files/boot0-11.0-uefi-support.patch b/sys-freebsd/boot0/files/boot0-11.0-uefi-support.patch
new file mode 100644
index 000000000000..c7a69d62aa8b
--- /dev/null
+++ b/sys-freebsd/boot0/files/boot0-11.0-uefi-support.patch
@@ -0,0 +1,21 @@
+diff --git a/sys/boot/efi/Makefile b/sys/boot/efi/Makefile
+index 79ee9a9..f7789f1 100644
+--- a/sys/boot/efi/Makefile
++++ b/sys/boot/efi/Makefile
+@@ -4,7 +4,7 @@
+
+ # In-tree GCC does not support __attribute__((ms_abi)), but gcc newer
+ # than 4.5 supports it.
+-.if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 404500
++.if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 40500
+
+ .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm"
+ .if ${MK_FDT} != "no"
+@@ -18,6 +18,6 @@ SUBDIR+= fdt
+ SUBDIR+= libefi loader boot1
+ .endif
+
+-.endif # ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 404500
++.endif # ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 40500
+
+ .include <bsd.subdir.mk>
diff --git a/sys-freebsd/boot0/files/boot0-8.2-zfsboot-makefile.patch b/sys-freebsd/boot0/files/boot0-8.2-zfsboot-makefile.patch
new file mode 100644
index 000000000000..a3a33d5d7c5b
--- /dev/null
+++ b/sys-freebsd/boot0/files/boot0-8.2-zfsboot-makefile.patch
@@ -0,0 +1,13 @@
+diff --git a/sys/boot/i386/zfsboot/Makefile b/sys/boot/i386/zfsboot/Makefile
+index bb16ea3..7dedb49 100644
+--- a/sys/boot/i386/zfsboot/Makefile
++++ b/sys/boot/i386/zfsboot/Makefile
+@@ -83,6 +83,8 @@ zfsboot.bin: zfsboot.out
+ zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o util.o
+ ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
+
++drv.o: drv.c xreadorg.h
++
+ zfsboot.o: zfsboot.s
+
+ SRCS= zfsboot.c xreadorg.h
diff --git a/sys-freebsd/boot0/files/boot0-9.2-gcc46.patch b/sys-freebsd/boot0/files/boot0-9.2-gcc46.patch
new file mode 100644
index 000000000000..ffd9f4351d1f
--- /dev/null
+++ b/sys-freebsd/boot0/files/boot0-9.2-gcc46.patch
@@ -0,0 +1,66 @@
+diff --git a/sys/boot/i386/Makefile.inc b/sys/boot/i386/Makefile.inc
+index f5faec7..a9cf593 100644
+--- a/sys/boot/i386/Makefile.inc
++++ b/sys/boot/i386/Makefile.inc
+@@ -12,7 +12,6 @@ LDFLAGS+= -nostdlib
+ .if ${MACHINE_CPUARCH} == "amd64"
+ CFLAGS+= -m32
+ ACFLAGS+= -m32
+-LDFLAGS+= -m elf_i386_fbsd
+ AFLAGS+= --32
+ .endif
+
+diff --git a/sys/boot/i386/boot2/Makefile b/sys/boot/i386/boot2/Makefile
+index 65815a5..61840dd 100644
+--- a/sys/boot/i386/boot2/Makefile
++++ b/sys/boot/i386/boot2/Makefile
+@@ -109,3 +109,10 @@ machine:
+ # XXX: clang integrated-as doesn't grok .codeNN directives yet
+ CFLAGS.boot1.S= ${CLANG_NO_IAS}
+ CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
++
++# gcc 4.6 or later version, -fno-asynchronous-unwind-tables is required to build.
++CFLAGS+= -fno-asynchronous-unwind-tables
++
++.if ${MACHINE_CPUARCH} == "amd64"
++LDFLAGS+= -m elf_i386_fbsd
++.endif
+diff --git a/sys/boot/i386/gptboot/Makefile b/sys/boot/i386/gptboot/Makefile
+index e1a640a..29886cc 100644
+--- a/sys/boot/i386/gptboot/Makefile
++++ b/sys/boot/i386/gptboot/Makefile
+@@ -78,3 +78,8 @@ machine:
+ # XXX: clang integrated-as doesn't grok .codeNN directives yet
+ CFLAGS.gptldr.S= ${CLANG_NO_IAS}
+ CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
++
++.if ${MACHINE_CPUARCH} == "amd64"
++LDFLAGS+= -m elf_i386_fbsd
++.endif
++
+diff --git a/sys/boot/i386/gptzfsboot/Makefile b/sys/boot/i386/gptzfsboot/Makefile
+index a2b8fcc..107f531 100644
+--- a/sys/boot/i386/gptzfsboot/Makefile
++++ b/sys/boot/i386/gptzfsboot/Makefile
+@@ -76,3 +76,8 @@ machine:
+ # XXX: clang integrated-as doesn't grok .codeNN directives yet
+ CFLAGS.gptldr.S= ${CLANG_NO_IAS}
+ CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
++
++.if ${MACHINE_CPUARCH} == "amd64"
++LDFLAGS+= -m elf_i386_fbsd
++.endif
++
+diff --git a/sys/boot/i386/zfsboot/Makefile b/sys/boot/i386/zfsboot/Makefile
+index b2db778..252dc62 100644
+--- a/sys/boot/i386/zfsboot/Makefile
++++ b/sys/boot/i386/zfsboot/Makefile
+@@ -89,3 +89,8 @@ machine:
+ # XXX: clang integrated-as doesn't grok .codeNN directives yet
+ CFLAGS.zfsldr.S= ${CLANG_NO_IAS}
+ CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
++
++.if ${MACHINE_CPUARCH} == "amd64"
++LDFLAGS+= -m elf_i386_fbsd
++.endif
++
diff --git a/sys-freebsd/boot0/files/boot0-add-nossp-cflags.patch b/sys-freebsd/boot0/files/boot0-add-nossp-cflags.patch
new file mode 100644
index 000000000000..abc6a57bf4b0
--- /dev/null
+++ b/sys-freebsd/boot0/files/boot0-add-nossp-cflags.patch
@@ -0,0 +1,11 @@
+https://bugs.gentoo.org/show_bug.cgi?id=511698
+
+diff --git a/sys/boot/Makefile.inc b/sys/boot/Makefile.inc
+index e0039b9..533dea0 100644
+--- a/sys/boot/Makefile.inc
++++ b/sys/boot/Makefile.inc
+@@ -1,3 +1,3 @@
+ # $FreeBSD: release/10.0.0/sys/boot/Makefile.inc 188895 2009-02-21 15:04:31Z ru $
+
+-SSP_CFLAGS=
++SSP_CFLAGS= -fno-stack-protector
diff --git a/sys-freebsd/boot0/metadata.xml b/sys-freebsd/boot0/metadata.xml
new file mode 100644
index 000000000000..d9f0c8324191
--- /dev/null
+++ b/sys-freebsd/boot0/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+ <email>bsd@gentoo.org</email>
+ <name>BSD Project</name>
+ </maintainer>
+ <use>
+ <flag name="tftp">Enable PXE/TFTP boot support.</flag>
+ <flag name="zfs">Enable booting on ZFS filesystems.</flag>
+ </use>
+</pkgmetadata>