Created attachment 307139 [details] sys-freebsd/virtio-kmod This is a port of FreeBSD's emulators/virtio-kmod port: http://www.freshports.org/emulators/virtio-kmod/ I tested this on ~x86-fbsd, but I used the an amd64 FreeBSD system as a reference platform. The ebuild follows the upstream port file very closely, so I believe that this is safe to keyword on both ~amd64-fbsd and ~x86-fbsd.
Created attachment 307141 [details] pkg-descr file from FreeBSD ports Since this is a translation of the upstream port, I am including two files from it, which are referenced by the ebuild.
Created attachment 307143 [details] pkg-message from FreeBSD ports
Created attachment 307145 [details] Manifest file
Created attachment 307147 [details] sys-freebsd/virtio-kmod I am attaching a minor correction to remove RDEPEND from the ebuild.
Created attachment 307149 [details] sys-freebsd/virtio-kmod manifest file
Created attachment 307151 [details] sys-freebsd/virtio-kmod-0.228301 I have revised the ebuild to include custom-optimization and debug USE flags. Since the FreeBSD port doesn't technically provide us with the option to turn this off, I set it to be selected by default in IUSE. Also, we seem to be triggered text relocation QA checks. I checked my Gentoo/FreeBSD install and every module appears to have one. I have added QA_TEXTRELS="*" to the ebuild to turn this off, although it is probably a good idea to find out if upstream FreeBSD suffers from this problem.
Created attachment 307153 [details] sys-freebsd/virtio-kmod manifest file
Created attachment 307155 [details] sys-freebsd/virtio-kmod-0.228301 Additional Improvements from working with naota in IRC.
Created attachment 307157 [details] sys-freebsd/virtio-kmod manifest file
Created attachment 307191 [details] sys-freebsd/virtio-kmod-0.228301 I cleaned up src_unpack.
Created attachment 307193 [details] sys-freebsd/virtio-kmod manifest file
Created attachment 307199 [details] sys-freebsd/virtio-kmod-0.228301 Merge functionality from src_prepare into src_unpack. The ebuild should be ready for inclusion into the main tree.
Created attachment 307201 [details] sys-freebsd/virtio-kmod manifest file
Created attachment 307203 [details] sys-freebsd/virtio-kmod-0.228301.ebuild Remove pkg_info, which was broken and implement floppym's suggestion to use $UID instead of `id -u`.
Created attachment 307205 [details] Manifest
Created attachment 307241 [details] sys-freebsd/virtio-kmod-0.228301.ebuild I removed the QA_TEXTRELS="*" line. It turns out that text relocations are not normal in upstream FreeBSD, but EVERY module on Gentoo/FreeBSD appears to have one, including the ones in /boot/modules. After talking to Zorry and blueness, it seems that this is a security issue because it negatively affects ASLR. Every module has it, so it should not block my inclusion request because, but it is something that needs to be addressed. I will file another bug report when I know more.
I should have re-read that last comment before hitting submit. I had revised that a few times and it was mangled in the process. It should say: I removed the QA_TEXTRELS="*" line. It seems that EVERY module in Gentoo/FreeBSD appears to have one, including the ones in /boot/modules. After talking to Zorry and blueness, it seems that this is a security issue because it negatively affects ASLR. It should not block my inclusion request because since every module has it, but it is something that needs to be addressed. I will file another bug report when I know more.
Could any other bsd team review this ebuild? The point I don't like is that this ebuild copy almost all the kernel source from /usr/src/sys.
-- I removed the QA_TEXTRELS="*" line. It turns out that text relocations are not normal in upstream FreeBSD, but EVERY module on Gentoo/FreeBSD appears to have one, including the ones in /boot/modules. -- please readd them, thats perfectly normal and fine for kernel modules. --- cd /usr/src/sys/ for d in $NEEDSUBDIRS; do find $d ! -name @ | cpio --quiet "${CPIO_ARGS}" "${WORKDIR}" done --- you should really do something alike to the other ebuilds. freebsd-usbin-9.0 has, for example: ln -s "/usr/src/sys-${RV}" "${WORKDIR}/sys" ln -s "/usr/include" "${WORKDIR}/include" moreover, sys may not be pointing to the right kernel. -- use debug && export DEBUG_FLAGS="-g" -- useless imho, people are clever enough to add -g when they want debug symbols. -- dodir /boot/modules cp "${WORKDIR}"/modules/virtio/*/*.ko{,.symbols} "${ED}/boot/modules" -- please use insinto + doins } -- pkg_postinst() { # Update linker.hints file /usr/sbin/kldxref "${EPREFIX}/boot/modules" -- pkg_* functions should be ROOT-aware -- # Print message from FreeBSD Ports elog "$(cat "${FILESDIR}/pkg-message")" } -- better copy the message into the ebuild -- and edit fstab and interface config in rc.conf: # sed -i.bak -Ee 's|/dev/ada?|/dev/vtbd|' /etc/fstab # sed -i.bak -e 's|em0|vtnet0|' /etc/rc.conf -- moreover the message doesnt seem completely accurate: shall we really sed rc.conf with openrc ?
(In reply to comment #19) > -- > I removed the QA_TEXTRELS="*" line. It turns out that text relocations are > not normal in upstream FreeBSD, but EVERY module on Gentoo/FreeBSD appears > to have one, including the ones in /boot/modules. > -- > > please readd them, thats perfectly normal and fine for kernel modules. Okay. > --- > cd /usr/src/sys/ > for d in $NEEDSUBDIRS; do > find $d ! -name @ | cpio --quiet "${CPIO_ARGS}" "${WORKDIR}" > done > --- > > you should really do something alike to the other ebuilds. > freebsd-usbin-9.0 has, for example: > ln -s "/usr/src/sys-${RV}" "${WORKDIR}/sys" > ln -s "/usr/include" "${WORKDIR}/include" That is not possible because the build system expects to write into the kernel sources directory. > moreover, sys may not be pointing to the right kernel. The same is true on Gentoo Linux with out of tree modules. > -- > use debug && export DEBUG_FLAGS="-g" > -- > useless imho, people are clever enough to add -g when they want debug > symbols. This was inherited from emulators/virtio-kmod. > -- > dodir /boot/modules > cp "${WORKDIR}"/modules/virtio/*/*.ko{,.symbols} "${ED}/boot/modules" > -- > > please use insinto + doins Good point. Thanks. :) > -- > pkg_postinst() { > # Update linker.hints file > /usr/sbin/kldxref "${EPREFIX}/boot/modules" > -- > pkg_* functions should be ROOT-aware > > -- > # Print message from FreeBSD Ports > elog "$(cat "${FILESDIR}/pkg-message")" > } > -- > better copy the message into the ebuild That file is lifted from FreeBSD ports, which is why it is separate from the ebuild. > > -- > and edit fstab and interface config in rc.conf: > > # sed -i.bak -Ee 's|/dev/ada?|/dev/vtbd|' /etc/fstab > # sed -i.bak -e 's|em0|vtnet0|' /etc/rc.conf > -- > > moreover the message doesnt seem completely accurate: shall we really sed > rc.conf with openrc ? It is accurate for FreeBSD upstream, but there is no point in Gentoo/FreeBSD. I will try to revise the message.
I have committed this to the main tree. I will maintain it.
I forgot to mention that I believe I have addressed most concerns. The only thing I have not done is put pkg-message into the ebuild. I find it appealing to leave that outside the ebuild, so that I do not have to worry about where newline characters go and how indentation in the ebuild is handled.