mirror of
https://github.com/hak5/wifipineapple-openwrt.git
synced 2025-10-29 16:57:19 +00:00
build: BSD compile fixes
following patch allows to build images for Qemu ARM on OpenBSD 5.2 amd64 and FreeBSD 9.1 amd64. Mostly small pieces of code changes to get things right on the specific platform. Updated the README to describe better, which tools on the host are required. Added some kind of prepare scripts to install needed tools on BSD via packages. Signed-off-by: Waldemar Brodkorb <mail@waldemar-brodkorb.de> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35900 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
@@ -15,7 +15,7 @@ tools-y += gmp mpfr mpc libelf
|
||||
endif
|
||||
tools-y += m4 libtool autoconf automake flex bison pkg-config sed mklibs
|
||||
tools-y += sstrip ipkg-utils genext2fs e2fsprogs mtd-utils mkimage
|
||||
tools-y += firmware-utils patch-image quilt yaffs2 flock padjffs2
|
||||
tools-y += firmware-utils patch-image patch quilt yaffs2 flock padjffs2
|
||||
tools-y += mm-macros xorg-macros xfce-macros missing-macros xz cmake scons
|
||||
tools-$(CONFIG_TARGET_orion_generic) += wrt350nv2-builder upslug2
|
||||
tools-$(CONFIG_powerpc) += upx
|
||||
@@ -119,6 +119,8 @@ $(STAGING_DIR_HOST)/bin/stat: $(STAGING_DIR)/.prepared
|
||||
ln -s `which stat` $@; \
|
||||
elif gstat --version > /dev/null 2>&1; then \
|
||||
ln -s `which gstat` $@; \
|
||||
elif gnustat --version > /dev/null 2>&1; then \
|
||||
ln -s `which gnustat` $@; \
|
||||
else \
|
||||
echo "GNU stat not found"; \
|
||||
false; \
|
||||
@@ -128,10 +130,14 @@ $(eval $(call PrepareCommand,find,gfind find))
|
||||
$(eval $(call PrepareCommand,md5sum,gmd5sum md5sum $(SCRIPT_DIR)/md5sum))
|
||||
$(eval $(call PrepareCommand,cp,gcp cp))
|
||||
$(eval $(call PrepareCommand,seq,gseq seq))
|
||||
$(eval $(call PrepareCommand,python,python2 python))
|
||||
$(eval $(call PrepareCommand,python,python2 python2.7 python))
|
||||
$(eval $(call PrepareCommand,awk,gawk awk))
|
||||
$(eval $(call PrepareCommand,getopt,gnugetopt /usr/local/bin/getopt getopt))
|
||||
$(eval $(call PrepareCommand,grep,ggrep grep))
|
||||
$(eval $(call PrepareCommand,tar,gtar tar))
|
||||
$(eval $(call PrepareCommand,diff,gdiff diff))
|
||||
|
||||
$(curdir)/cmddeps = $(patsubst %,$(STAGING_DIR_HOST)/bin/%,find md5sum cp stat seq python awk)
|
||||
$(curdir)/cmddeps = $(patsubst %,$(STAGING_DIR_HOST)/bin/%,find md5sum cp stat seq python awk getopt grep tar diff)
|
||||
$(curdir)//prepare = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared $($(curdir)/cmddeps)
|
||||
$(curdir)//compile = $(STAGING_DIR)/.prepared $(STAGING_DIR_HOST)/.prepared $($(curdir)/cmddeps)
|
||||
|
||||
|
||||
24
tools/e2fsprogs/patches/003-openbsd-compat.patch
Normal file
24
tools/e2fsprogs/patches/003-openbsd-compat.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
diff -Nur e2fsprogs-1.42.7.orig/lib/blkid/getsize.c e2fsprogs-1.42.7/lib/blkid/getsize.c
|
||||
--- e2fsprogs-1.42.7.orig/lib/blkid/getsize.c Fri Nov 30 03:40:18 2012
|
||||
+++ e2fsprogs-1.42.7/lib/blkid/getsize.c Thu Mar 7 14:21:59 2013
|
||||
@@ -26,6 +26,9 @@
|
||||
#include <fcntl.h>
|
||||
#ifdef HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
+#ifdef __OpenBSD__
|
||||
+#include <sys/dkio.h>
|
||||
+#endif
|
||||
#endif
|
||||
#ifdef HAVE_LINUX_FD_H
|
||||
#include <linux/fd.h>
|
||||
diff -Nur e2fsprogs-1.42.7.orig/lib/quota/mkquota.c e2fsprogs-1.42.7/lib/quota/mkquota.c
|
||||
--- e2fsprogs-1.42.7.orig/lib/quota/mkquota.c Wed Jan 2 01:47:20 2013
|
||||
+++ e2fsprogs-1.42.7/lib/quota/mkquota.c Thu Mar 7 14:21:59 2013
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
+#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
13
tools/e2fsprogs/patches/004-freebsd-compat.patch
Normal file
13
tools/e2fsprogs/patches/004-freebsd-compat.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
diff -Nur e2fsprogs-1.42.7.orig/lib/ext2fs/tdb.c e2fsprogs-1.42.7/lib/ext2fs/tdb.c
|
||||
--- e2fsprogs-1.42.7.orig/lib/ext2fs/tdb.c 2012-07-06 15:37:27.000000000 +0200
|
||||
+++ e2fsprogs-1.42.7/lib/ext2fs/tdb.c 2013-03-07 14:54:59.000000000 +0100
|
||||
@@ -56,7 +56,9 @@
|
||||
#include <utime.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
+#ifndef __FreeBSD__
|
||||
#include <sys/file.h>
|
||||
+#endif
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
@@ -15,6 +15,11 @@
|
||||
#define bswap_16(x) bswap16(x)
|
||||
#define bswap_32(x) bswap32(x)
|
||||
#define bswap_64(x) bswap64(x)
|
||||
#elif defined(__OpenBSD__)
|
||||
#include <sys/types.h>
|
||||
#define bswap_16(x) __swap16(x)
|
||||
#define bswap_32(x) __swap32(x)
|
||||
#define bswap_64(x) __swap64(x)
|
||||
#else
|
||||
#include <machine/endian.h>
|
||||
#define bswap_16(x) swap16(x)
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if !defined(__linux__) && !(defined(__APPLE__) && __DARWIN_C_LEVEL >= 200809L)
|
||||
#if !defined(__linux__) && !defined(__OpenBSD__) && !(defined(__APPLE__) && __DARWIN_C_LEVEL >= 200809L)
|
||||
/*
|
||||
* Emulate glibc getline() via BSD fgetln().
|
||||
* Note that outsize is not changed unless memory is allocated.
|
||||
|
||||
19
tools/mkimage/patches/020-openbsd_fixes.patch
Normal file
19
tools/mkimage/patches/020-openbsd_fixes.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
diff -Nur u-boot-2012.04.01.orig/tools/mkimage.c u-boot-2012.04.01/tools/mkimage.c
|
||||
--- u-boot-2012.04.01.orig/tools/mkimage.c Wed Apr 25 15:22:50 2012
|
||||
+++ u-boot-2012.04.01/tools/mkimage.c Wed Mar 6 17:09:29 2013
|
||||
@@ -449,6 +449,7 @@
|
||||
#if defined(_POSIX_SYNCHRONIZED_IO) && \
|
||||
!defined(__sun__) && \
|
||||
!defined(__FreeBSD__) && \
|
||||
+ !defined(__OpenBSD__) && \
|
||||
!defined(__APPLE__)
|
||||
(void) fdatasync (ifd);
|
||||
#else
|
||||
@@ -492,6 +493,7 @@
|
||||
#if defined(_POSIX_SYNCHRONIZED_IO) && \
|
||||
!defined(__sun__) && \
|
||||
!defined(__FreeBSD__) && \
|
||||
+ !defined(__OpenBSD__) && \
|
||||
!defined(__APPLE__)
|
||||
(void) fdatasync (ifd);
|
||||
#else
|
||||
18
tools/patch/Makefile
Normal file
18
tools/patch/Makefile
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# Copyright (C) 2013 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=patch
|
||||
PKG_VERSION:=2.7.1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
|
||||
PKG_SOURCE_URL:=ftp://ftp.gnu.org/gnu/patch
|
||||
PKG_MD5SUM:=e9ae5393426d3ad783a300a338c09b72
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
@@ -15,12 +15,8 @@ PKG_MD5SUM:=f77adda60039ffa753f3c584a286f12b
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
GETOPT:=$(shell which getopt)
|
||||
|
||||
HOST_CONFIGURE_ARGS += \
|
||||
--with-patch=$(PATCH) \
|
||||
--with-find=$(FIND) \
|
||||
--with-getopt=$(GETOPT)
|
||||
--with-find=$(FIND)
|
||||
|
||||
define Host/Configure
|
||||
cd $(HOST_BUILD_DIR) && autoconf
|
||||
|
||||
26
tools/squashfs4/patches/180-openbsd_compat.patch
Normal file
26
tools/squashfs4/patches/180-openbsd_compat.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
diff -Nur squashfs4.2.orig/squashfs-tools/mksquashfs.c squashfs4.2/squashfs-tools/mksquashfs.c
|
||||
--- squashfs4.2.orig/squashfs-tools/mksquashfs.c Tue Mar 5 16:20:49 2013
|
||||
+++ squashfs4.2/squashfs-tools/mksquashfs.c Tue Mar 5 16:25:10 2013
|
||||
@@ -32,6 +32,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/time.h>
|
||||
+#if defined(__OpenBSD__)
|
||||
+#include <sys/param.h>
|
||||
+#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
diff -Nur squashfs4.2.orig/squashfs-tools/unsquashfs.h squashfs4.2/squashfs-tools/unsquashfs.h
|
||||
--- squashfs4.2.orig/squashfs-tools/unsquashfs.h Tue Mar 5 16:20:49 2013
|
||||
+++ squashfs4.2/squashfs-tools/unsquashfs.h Tue Mar 5 16:25:57 2013
|
||||
@@ -25,6 +25,9 @@
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#include <stdio.h>
|
||||
+#if defined(__OpenBSD__)
|
||||
+#include <sys/param.h>
|
||||
+#endif
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
14
tools/yaffs2/patches/110-openbsd-compat.patch
Normal file
14
tools/yaffs2/patches/110-openbsd-compat.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
diff -Nur yaffs2_android.orig/yaffs2/yaffs_guts.h yaffs2_android/yaffs2/yaffs_guts.h
|
||||
--- yaffs2_android.orig/yaffs2/yaffs_guts.h Sun Feb 15 16:23:50 2009
|
||||
+++ yaffs2_android/yaffs2/yaffs_guts.h Tue Mar 5 15:45:21 2013
|
||||
@@ -823,6 +823,10 @@
|
||||
int yaffs_SetAttributes(yaffs_Object * obj, struct iattr *attr);
|
||||
int yaffs_GetAttributes(yaffs_Object * obj, struct iattr *attr);
|
||||
|
||||
+#if defined(__OpenBSD__)
|
||||
+#define loff_t off_t
|
||||
+#endif
|
||||
+
|
||||
/* File operations */
|
||||
int yaffs_ReadDataFromFile(yaffs_Object * obj, __u8 * buffer, loff_t offset,
|
||||
int nBytes);
|
||||
Reference in New Issue
Block a user