Add recipe for b43_fwcutter.

This commit is contained in:
Adrien Destugues
2020-08-03 21:38:21 +02:00
parent 6fcc100c55
commit a452fdfe71
2 changed files with 121 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
SUMMARY="Broadcom firmware cutter"
DESCRIPTION="A tool to extract the firmware from broadcom drivers"
HOMEPAGE="https://bues.ch/b43/fwcutter/"
COPYRIGHT="2005-2011 Martin Langer
2005-2014 Michael Buesch
2005-2011 Alex Beregszaszi"
LICENSE="BSD (2-clause)"
SOURCE_URI="https://bues.ch/b43/fwcutter/b43-fwcutter-019.tar.bz2"
SOURCE_DIR="b43-fwcutter-$portVersion"
CHECKSUM_SHA256="d6ea85310df6ae08e7f7e46d8b975e17fc867145ee249307413cfbe15d7121ce"
PATCHES="b43_fwcutter-$portVersion.patchset"
REVISION="1"
ARCHITECTURES="x86_gcc2 ?x86 ?x86_64"
PROVIDES="
b43_fwcutter = $portVersion
cmd:b43_fwcutter
"
REQUIRES="
haiku$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:make
cmd:gcc$secondaryArchSuffix
"
BUILD()
{
make $jobArgs
}
INSTALL()
{
mkdir $binDir
cp b43-fwcutter $binDir
}

View File

@@ -0,0 +1,80 @@
From ffa40635425e83c7971522dfcb215e2f8c09f9c6 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Mon, 3 Aug 2020 21:18:05 +0200
Subject: pre-generate deps
This requires gcc8, but the other buildsteps shouldn't need it
diff --git a/dep/fwcutter.d b/dep/fwcutter.d
new file mode 100644
index 0000000..05af350
--- /dev/null
+++ b/dep/fwcutter.d
@@ -0,0 +1,2 @@
+dep/fwcutter.d obj/fwcutter.o: fwcutter.c md5.h fwcutter.h \
+ fwcutter_list.h
diff --git a/dep/md5.d b/dep/md5.d
new file mode 100644
index 0000000..abd9682
--- /dev/null
+++ b/dep/md5.d
@@ -0,0 +1 @@
+dep/md5.d obj/md5.o: md5.c md5.h
--
2.27.0
From 9caca2494686ebb661d8f421d0bcf4e08c309d90 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Mon, 3 Aug 2020 21:26:24 +0200
Subject: Fix build in haiku and with gcc2
diff --git a/Makefile b/Makefile
index 264b97d..7b6737e 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ endif
PREFIX ?= /usr/local
CFLAGS ?= -Os -fomit-frame-pointer
-CFLAGS += -std=c99 -Wall -pedantic -D_BSD_SOURCE
+CFLAGS += -std=gnu9x -Wall -pedantic -D_BSD_SOURCE
LDFLAGS ?=
SRCS = fwcutter.c md5.c
diff --git a/fwcutter.c b/fwcutter.c
index 294502b..e9e9304 100644
--- a/fwcutter.c
+++ b/fwcutter.c
@@ -42,6 +42,10 @@
#include <sys/endian.h>
#elif defined(__APPLE__)
#include <libkern/OSByteOrder.h>
+#elif defined(__HAIKU__)
+#include <os/support/ByteOrder.h>
+#define bswap_32 __swap_int32
+#define bswap_16 __swap_int16
#else
#include <byteswap.h>
#endif
@@ -579,6 +583,7 @@ static void brcmsmac_extract(FILE *f, const struct extract *extract,
int ucode_rev = 0;
int brcmsmac_idx = 0;
be32_t size;
+ int size_idx;
brcmsmac_idx = brcmsmac_name_to_idx(extract->name);
@@ -627,7 +632,7 @@ static void brcmsmac_extract(FILE *f, const struct extract *extract,
}
brcmsmac_write_file(brcmsmac_idx, buf, data_length);
- int size_idx = brcmsmac_name_to_size_idx(extract->name);
+ size_idx = brcmsmac_name_to_size_idx(extract->name);
if (size_idx)
brcmsmac_write_file(size_idx, (uint8_t *)&size, 4);
--
2.27.0