--- /dev/null
+# Copyright © 2023 Nick Bowler
+# License GPLv3+: GNU General Public License version 3 or any later version.
+# This is free software: you are free to change and redistribute it.
+# There is NO WARRANTY, to the extent permitted by law.
+
+EAPI=7
+
+inherit toolchain-funcs
+
+SHA1="2fe10ea6690df9a068cb21cde537236bae784a14"
+MY_P="b43-tools-$SHA1"
+
+DESCRIPTION="b43 wireless firmware (dis)assembler"
+HOMEPAGE="https://bues.ch/cms/hacking/misc.html#linux_b43_driver_firmware_tools"
+SRC_URI="https://bues.ch/cgit/b43-tools.git/snapshot/$MY_P.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc"
+
+S=$WORKDIR/$MY_P
+
+BDEPEND="sys-devel/bison
+ sys-devel/flex"
+
+src_prepare () {
+ cat >build.mk <<'EOF'
+all: assembler/all disassembler/all
+install: assembler/install disassembler/install
+assembler/all disassembler/all: ; $(MAKE) -C $(@D) $(@F)
+assembler/install disassembler/install: ; $(MAKE) -C $(@D) $(@F)
+EOF
+
+ default
+}
+
+src_compile () {
+ emake -f build.mk V=1 CC="$(tc-getCC)"
+}
+
+src_install () {
+ mkdir bin
+ emake -f build.mk PREFIX=$PWD install
+
+ # For now, don't install the python scripts under disassembler/ since
+ # that's just extra pain and is not needed to build openfwwf.
+ dobin bin/*asm*
+
+ einstalldocs
+}
+
+src_test () {
+ ebegin "running b43-asm test.asm test.bin"
+ ( cd assembler && {
+ ./b43-asm test.asm test.bin; }
+ ) || { eend $?; die "b43-asm failed"; }
+ eend 0
+
+ ebegin "running selftest.sh"
+ ( cd assembler && {
+ PATH=:../disassembler:$PATH ./selftest.sh test.bin; }
+ ) || { eend $?; die "selftest.sh failed"; }
+ eend 0
+}