diff options
author | Felix Fietkau <nbd@openwrt.org> | 2005-07-21 11:45:36 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2005-07-21 11:45:36 +0000 |
commit | 6217127ff50f90576f06b53bde88065131112a53 (patch) | |
tree | c7e4e5abb560ab0ba739d5cb144b6848ff85fcec /openwrt | |
parent | e0c4f6e568ebe273c3a7f7f02655d3323ca90a30 (diff) | |
download | mtk-20170518-6217127ff50f90576f06b53bde88065131112a53.zip mtk-20170518-6217127ff50f90576f06b53bde88065131112a53.tar.gz mtk-20170518-6217127ff50f90576f06b53bde88065131112a53.tar.bz2 |
move nvram,jffs2root,shared libs into target/linux/package and make them broadcom-specific
SVN-Revision: 1517
Diffstat (limited to 'openwrt')
-rw-r--r-- | openwrt/package/Makefile | 5 | ||||
-rw-r--r-- | openwrt/package/openwrt/Makefile | 45 | ||||
-rw-r--r-- | openwrt/package/openwrt/libnvram/Makefile | 46 | ||||
-rw-r--r-- | openwrt/package/openwrt/libshared/Makefile | 40 | ||||
-rw-r--r-- | openwrt/package/openwrt/mtd.c | 370 | ||||
-rw-r--r-- | openwrt/target/linux/package/Makefile | 7 | ||||
-rw-r--r-- | openwrt/target/linux/package/nvram/Makefile | 33 | ||||
-rw-r--r-- | openwrt/target/linux/package/nvram/ipkg/nvram.control | 7 | ||||
-rw-r--r-- | openwrt/target/linux/package/nvram/src/Makefile | 22 | ||||
-rw-r--r-- | openwrt/target/linux/package/nvram/src/bcmtimer.h (renamed from openwrt/package/openwrt/libshared/bcmtimer.h) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/nvram/src/defaults.c (renamed from openwrt/package/openwrt/libshared/defaults.c) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/nvram/src/linux_timer.c (renamed from openwrt/package/openwrt/libshared/linux_timer.c) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/nvram/src/main.c (renamed from openwrt/package/openwrt/libnvram/main.c) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/nvram/src/nvram_convert.c (renamed from openwrt/package/openwrt/libnvram/nvram_convert.c) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/nvram/src/nvram_convert.h (renamed from openwrt/package/openwrt/libnvram/nvram_convert.h) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/nvram/src/nvram_linux.c (renamed from openwrt/package/openwrt/libnvram/nvram_linux.c) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/nvram/src/shutils.c (renamed from openwrt/package/openwrt/libshared/shutils.c) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/nvram/src/wl.c (renamed from openwrt/package/openwrt/libshared/wl.c) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/nvram/src/wl_linux.c (renamed from openwrt/package/openwrt/libshared/wl_linux.c) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/openwrt/Makefile | 34 | ||||
-rw-r--r-- | openwrt/target/linux/package/openwrt/include/bcmnvram.h (renamed from openwrt/package/openwrt/include/bcmnvram.h) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/openwrt/include/bcmutils.h (renamed from openwrt/package/openwrt/include/bcmutils.h) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/openwrt/include/cy_conf.h (renamed from openwrt/package/openwrt/include/cy_conf.h) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/openwrt/include/epivers.h (renamed from openwrt/package/openwrt/include/epivers.h) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/openwrt/include/proto/802.11.h (renamed from openwrt/package/openwrt/include/proto/802.11.h) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/openwrt/include/proto/ethernet.h (renamed from openwrt/package/openwrt/include/proto/ethernet.h) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/openwrt/include/shutils.h (renamed from openwrt/package/openwrt/include/shutils.h) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/openwrt/include/typedefs.h (renamed from openwrt/package/openwrt/include/typedefs.h) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/openwrt/include/utils.h (renamed from openwrt/package/openwrt/include/utils.h) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/openwrt/include/wlcompat.h (renamed from openwrt/package/openwrt/include/wlcompat.h) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/openwrt/include/wlioctl.h (renamed from openwrt/package/openwrt/include/wlioctl.h) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/openwrt/include/wlutils.h (renamed from openwrt/package/openwrt/include/wlutils.h) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/openwrt/ipkg/openwrt-utils.control (renamed from openwrt/package/openwrt/openwrt-utils.control) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/openwrt/jffs2root.c (renamed from openwrt/package/openwrt/jffs2root.c) | 0 | ||||
-rw-r--r-- | openwrt/target/linux/package/wlcompat/Makefile | 2 |
35 files changed, 106 insertions, 505 deletions
diff --git a/openwrt/package/Makefile b/openwrt/package/Makefile index 8a54481..0d4d75e 100644 --- a/openwrt/package/Makefile +++ b/openwrt/package/Makefile @@ -2,7 +2,6 @@ include $(TOPDIR)/rules.mk package-:=tcp_wrappers -package-y:=openwrt package-$(BR2_PACKAGE_AICCU) += aiccu package-$(BR2_PACKAGE_AMWALL) += amwall package-$(BR2_PACKAGE_ARPTABLES) += arptables @@ -201,7 +200,7 @@ tinc-compile: zlib-compile openssl-compile lzo-compile tor-compile: libevent-compile openssl-compile zlib-compile usbutils-compile: libusb-compile vtun-compile: zlib-compile openssl-compile lzo-compile -wificonf-compile: openwrt-compile wireless-tools-compile +wificonf-compile: wireless-tools-compile wpa_supplicant-compile: openssl-compile asterisk-compile: ncurses-compile openssl-compile @@ -280,7 +279,7 @@ ifneq ($(BR2_PACKAGE_ULOGD_PGSQL),) ulogd-compile: postgresql-compile endif -sdk-compile: $(DEV_LIBS_COMPILE) $(SDK_DEFAULT_COMPILE) openwrt-install +sdk-compile: $(DEV_LIBS_COMPILE) $(SDK_DEFAULT_COMPILE) $(STAMP_DIR): mkdir -p $@ diff --git a/openwrt/package/openwrt/Makefile b/openwrt/package/openwrt/Makefile deleted file mode 100644 index 580777a..0000000 --- a/openwrt/package/openwrt/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# $Id$ - -include $(TOPDIR)/rules.mk - -PKG_NAME := openwrt-utils -PKG_RELEASE := 2 -PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) -PKG_IPK:=$(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_RELEASE)_$(ARCH).ipk -PKG_IPK_DIR:=$(PKG_BUILD_DIR)/ipkg - -SHARED_INCLUDE:=${shell pwd}/include - -libshared-compile libnvram-compile: - @$(MAKE) -C $(patsubst %-compile,%,$@) compile - -libshared-install libnvram-install: libshared-compile libnvram-compile - @$(MAKE) -C $(patsubst %-install,%,$@) install - -libshared-clean libnvram-clean: - @$(MAKE) -C $(patsubst %-clean,%,$@) clean - -$(PKG_IPK_DIR)/sbin/jffs2root: jffs2root.c - mkdir -p $(PKG_IPK_DIR)/sbin - $(TARGET_CC) -o $@ $< - -$(PKG_IPK): $(PKG_IPK_DIR)/sbin/jffs2root - $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_IPK_DIR) $(PKG_NAME).control $(PKG_RELEASE) $(ARCH) - $(STRIP) $(PKG_IPK_DIR)/sbin/* - mkdir -p $(PACKAGE_DIR) - $(IPKG_BUILD) $(PKG_IPK_DIR) $(PACKAGE_DIR) - -$(IPKG_STATE_DIR)/info/$(PKG_NAME).list: $(PKG_IPK) - $(IPKG) install $< - -source: -prepare: -compile: prepare libnvram-compile libshared-compile $(PKG_IPK) $(PKG_WLCOMPAT) - mkdir -p $(STAGING_DIR)/usr/include - cp -a ./include/* $(STAGING_DIR)/usr/include/ -install: libnvram-install libshared-install \ - $(IPKG_STATE_DIR)/info/$(PKG_NAME).list \ - -clean: libshared-clean libnvram-clean - rm -rf $(PKG_BUILD_DIR) - rm -f $(PKG_IPK) diff --git a/openwrt/package/openwrt/libnvram/Makefile b/openwrt/package/openwrt/libnvram/Makefile deleted file mode 100644 index a5b6284..0000000 --- a/openwrt/package/openwrt/libnvram/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# $Id$ - -include $(TOPDIR)/rules.mk - -PKG_NAME:=libnvram -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) - -EXTRA_CFLAGS := -c -I. -I../include - -all: compile - -define OBJ_template -$(PKG_BUILD_DIR)/$(1): $(PKG_BUILD_DIR) - $(TARGET_CC) $(TARGET_CFLAGS) $(EXTRA_CFLAGS) -o $$@ $$(patsubst %.o,%.c,$(1)) -endef - -OBJS := nvram_linux.o nvram_convert.o main.o -LIBNVRAM_OBJS:= $(PKG_BUILD_DIR)/nvram_linux.o $(PKG_BUILD_DIR)/nvram_convert.o -$(foreach obj,$(OBJS),$(eval $(call OBJ_template,$(obj)))) - -$(PKG_BUILD_DIR): - mkdir -p $(PKG_BUILD_DIR) - -$(PKG_BUILD_DIR)/nvram: $(PKG_BUILD_DIR)/main.o $(PKG_BUILD_DIR)/libnvram.so - $(TARGET_CC) $(TARGET_CFLAGS) -o $@ $< -L$(PKG_BUILD_DIR) -lnvram - -$(PKG_BUILD_DIR)/libnvram.so: $(LIBNVRAM_OBJS) - $(TARGET_CC) -shared -o $@ $^ - -$(STAGING_DIR)/lib/libnvram.so: $(PKG_BUILD_DIR)/libnvram.so - install -m 644 $< $@ - -$(TARGET_DIR)/usr/lib/libnvram.so: $(PKG_BUILD_DIR)/libnvram.so - install -m 644 $< $@ - $(STRIP) $@ - -$(TARGET_DIR)/usr/sbin/nvram: $(PKG_BUILD_DIR)/nvram - mkdir -p $(TARGET_DIR)/usr/sbin - install -m 755 $< $@ - $(STRIP) $@ - -compile: $(PKG_BUILD_DIR)/libnvram.so $(STAGING_DIR)/lib/libnvram.so $(PKG_BUILD_DIR)/nvram -install: $(TARGET_DIR)/usr/lib/libnvram.so $(TARGET_DIR)/usr/sbin/nvram - -clean: - rm -rf $(PKG_BUILD_DIR) diff --git a/openwrt/package/openwrt/libshared/Makefile b/openwrt/package/openwrt/libshared/Makefile deleted file mode 100644 index 4309c8c..0000000 --- a/openwrt/package/openwrt/libshared/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# $Id$ - -include $(TOPDIR)/rules.mk - -PKG_NAME:=libshared -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) - -EXTRA_CFLAGS := -c -I. -I../include - -all: compile - -LIBSHARED_OBJS:= -define OBJ_template -$(PKG_BUILD_DIR)/$(1): $(PKG_BUILD_DIR) - $(TARGET_CC) $(TARGET_CFLAGS) $(EXTRA_CFLAGS) -o $$@ $$(patsubst %.o,%.c,$(1)) -LIBSHARED_OBJS += $(PKG_BUILD_DIR)/$(1) -endef - -OBJS := shutils.o wl.o wl_linux.o defaults.o linux_timer.o -$(foreach obj,$(OBJS),$(eval $(call OBJ_template,$(obj)))) - - -$(PKG_BUILD_DIR): - mkdir -p $(PKG_BUILD_DIR) - -$(PKG_BUILD_DIR)/libshared.so: $(LIBSHARED_OBJS) - $(TARGET_CC) -shared -o $@ $^ - -$(STAGING_DIR)/lib/libshared.so: $(PKG_BUILD_DIR)/libshared.so - install -m 644 $< $@ - -$(TARGET_DIR)/usr/lib/libshared.so: $(PKG_BUILD_DIR)/libshared.so - install -m 644 $^ $@ - $(STRIP) $@ - -compile: $(PKG_BUILD_DIR)/libshared.so $(STAGING_DIR)/lib/libshared.so -install: $(TARGET_DIR)/usr/lib/libshared.so - -clean: - rm -rf $(PKG_BUILD_DIR) diff --git a/openwrt/package/openwrt/mtd.c b/openwrt/package/openwrt/mtd.c deleted file mode 100644 index 74949fd..0000000 --- a/openwrt/package/openwrt/mtd.c +++ /dev/null @@ -1,370 +0,0 @@ -/* - * mtd - simple memory technology device manipulation tool - * - * Copyright (C) 2005 Waldemar Brodkorb <wbx@dass-it.de>, - * Felix Fietkau <nbd@vd-s.ath.cx> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * - * code is based on linux-mtd example code - */ - -#include <limits.h> -#include <unistd.h> -#include <stdlib.h> -#include <stdio.h> -#include <stdint.h> -#include <fcntl.h> -#include <errno.h> -#include <error.h> -#include <time.h> -#include <sys/ioctl.h> -#include <sys/types.h> -#include <sys/param.h> -#include <sys/mount.h> -#include <sys/stat.h> -#include <sys/reboot.h> -#include <string.h> - -#include <linux/mtd/mtd.h> - -#define TRX_MAGIC 0x30524448 /* "HDR0" */ -#define BUFSIZE (10 * 1024) -#define MAX_ARGS 8 - -struct trx_header { - uint32_t magic; /* "HDR0" */ - uint32_t len; /* Length of file including header */ - uint32_t crc32; /* 32-bit CRC from flag_version to end of file */ - uint32_t flag_version; /* 0:15 flags, 16:31 version */ - uint32_t offsets[3]; /* Offsets of partitions from start of header */ -}; - -int -trx_check(const char *trxfile, const char *mtd) -{ - struct mtd_info_user mtdInfo; - int trxfd, fd; - size_t count; - struct trx_header trx; - struct stat trxstat; - - trxfd = open(trxfile,O_RDONLY); - if(trxfd < 0) { - fprintf(stderr, "Could not open trx image: %s\n", trxfile); - exit(1); - } - - if (fstat(trxfd,&trxstat) < 0) { - fprintf(stderr, "Could not get trx image file status: %s\n", trxfile); - close(trxfd); - exit(1); - } - - count = read(trxfd, &trx, sizeof(struct trx_header)); - if (count < sizeof(struct trx_header)) { - fprintf(stderr, "Could not trx header, file too small (%ld bytes)\n", count); - close(trxfd); - exit(1); - } - - if (trx.magic != TRX_MAGIC || trx.len < sizeof(struct trx_header)) { - fprintf(stderr, "Bad trx header\n"); - fprintf(stderr, "If this is a firmware in bin format, like some of the\n" - "original firmware files are, use following command to convert to trx:\n" - "dd if=firmware.bin of=firmware.trx bs=32 skip=1\n"); - close(trxfd); - exit(1); - } - - lseek(trxfd, 0, SEEK_SET); - - /* check if image fits to mtd device */ - - fd = mtd_open(mtd, O_RDWR); - if(fd < 0) { - fprintf(stderr, "Could not open mtd device: %s\n", mtd); - exit(1); - } - - if(ioctl(fd, MEMGETINFO, &mtdInfo)) { - fprintf(stderr, "Could not get MTD device info from %s\n", mtd); - close(fd); - exit(1); - } - - if(mtdInfo.size < trxstat.st_size) { - fprintf(stderr, "Image too big for partition: %s\n", mtd); - close(trxfd); - close(fd); - exit(1); - } - - printf("Writing %s to %s ...\n", trxfile, mtd); - - close(fd); - - return(trxfd); -} - -int -mtd_unlock(const char *mtd) -{ - int fd; - struct mtd_info_user mtdInfo; - struct erase_info_user mtdLockInfo; - - fd = mtd_open(mtd, O_RDWR); - if(fd < 0) { - fprintf(stderr, "Could not open mtd device: %s\n", mtd); - exit(1); - } - - if(ioctl(fd, MEMGETINFO, &mtdInfo)) { - fprintf(stderr, "Could not get MTD device info from %s\n", mtd); - close(fd); - exit(1); - } - - printf("Unlocking %s ...\n", mtd); - mtdLockInfo.start = 0; - mtdLockInfo.length = mtdInfo.size; - if(ioctl(fd, MEMUNLOCK, &mtdLockInfo)) { - close(fd); - return 0; - } - - close(fd); - return 0; -} - -int -mtd_open(const char *mtd, int flags) -{ - FILE *fp; - char dev[PATH_MAX]; - int i; - - if ((fp = fopen("/proc/mtd", "r"))) { - while (fgets(dev, sizeof(dev), fp)) { - if (sscanf(dev, "mtd%d:", &i) && strstr(dev, mtd)) { - snprintf(dev, sizeof(dev), "/dev/mtd/%d", i); - fclose(fp); - return open(dev, flags); - } - } - fclose(fp); - } - - return open(mtd, flags); -} - -int -mtd_erase(const char *mtd) -{ - int fd; - struct mtd_info_user mtdInfo; - struct erase_info_user mtdEraseInfo; - - fd = mtd_open(mtd, O_RDWR); - if(fd < 0) { - fprintf(stderr, "Could not open mtd device: %s\n", mtd); - exit(1); - } - - if(ioctl(fd, MEMGETINFO, &mtdInfo)) { - fprintf(stderr, "Could not get MTD device info from %s\n", mtd); - close(fd); - exit(1); - } - - printf("Erasing %s ...\n", mtd); - mtdEraseInfo.length = mtdInfo.erasesize; - - for (mtdEraseInfo.start = 0; - mtdEraseInfo.start < mtdInfo.size; - mtdEraseInfo.start += mtdInfo.erasesize) { - - ioctl(fd, MEMUNLOCK, &mtdEraseInfo); - if(ioctl(fd, MEMERASE, &mtdEraseInfo)) { - fprintf(stderr, "Could not erase MTD device: %s\n", mtd); - close(fd); - exit(1); - } - } - - close(fd); - return 0; - -} - -int -mtd_write(int trxfd, const char *mtd) -{ - int fd,i; - size_t result,size,written; - struct mtd_info_user mtdInfo; - struct erase_info_user mtdEraseInfo; - unsigned char src[BUFSIZE],dest[BUFSIZE]; - struct stat trxstat; - - if (fstat(trxfd,&trxstat) < 0) { - fprintf(stderr, "Could not get trx image file status\n"); - close(trxfd); - exit(1); - } - - fd = mtd_open(mtd, O_RDWR); - if(fd < 0) { - fprintf(stderr, "Could not open mtd device: %s\n", mtd); - exit(1); - } - - if(ioctl(fd, MEMGETINFO, &mtdInfo)) { - fprintf(stderr, "Could not get MTD device info from %s\n", mtd); - close(fd); - exit(1); - } - - mtdEraseInfo.start = 0; - mtdEraseInfo.length = trxstat.st_size & ~(mtdInfo.erasesize -1); - if(trxstat.st_size % mtdInfo.erasesize) mtdEraseInfo.length += mtdInfo.erasesize; - - /* erase the chunk */ - if (ioctl (fd,MEMERASE,&mtdEraseInfo) < 0) { - fprintf(stderr, "Erasing mtd failed: %s\n", mtd); - exit(1); - } - - size = trxstat.st_size; - i = BUFSIZE; - written = 0; - - while (size) { - if (size < BUFSIZE) i = size; - read(trxfd,src,i); - result = write(fd,src,i); - if (i != result) { - if (result < 0) { - fprintf(stderr,"Error while writing image"); - exit(1); - } - fprintf(stderr,"Error writing image"); - exit(1); - } - written += i; - size -= i; - } - - return 0; -} - -void usage(void) -{ - printf("Usage: mtd [<options> ...] <command> [<arguments> ...] <device>\n\n" - "The device is in the format of mtdX (eg: mtd4) or its label.\n" - "mtd recognizes these commands:\n" - " unlock unlock the device\n" - " erase erase all data on device\n" - " write <imagefile> write imagefile to device\n" - "Following options are available:\n" - " -r reboot after successful command\n" - " -e <device> erase <device> before executing the command\n\n" - "Example: To write linux.trx to mtd4 labeled as linux and reboot afterwards\n" - " mtd -r write linux.trx linux\n\n"); - exit(1); -} - -int main (int argc, char **argv) -{ - int ch, i, boot, unlock, trxfd; - char *erase[MAX_ARGS], *device; - enum { - CMD_ERASE, - CMD_WRITE, - CMD_UNLOCK - } cmd; - - erase[0] = NULL; - boot = 0; - - while ((ch = getopt(argc, argv, "re:")) != -1) - switch (ch) { - case 'r': - boot = 1; - break; - case 'e': - i = 0; - while ((erase[i] != NULL) && ((i + 1) < MAX_ARGS)) - i++; - - erase[i++] = optarg; - erase[i] = NULL; - break; - - case '?': - default: - usage(); - } - argc -= optind; - argv += optind; - - if (argc < 2) - usage(); - - if ((strcmp(argv[0], "unlock") == 0) && (argc == 2)) { - cmd = CMD_UNLOCK; - device = argv[1]; - } else if ((strcmp(argv[0], "erase") == 0) && (argc == 2)) { - cmd = CMD_ERASE; - device = argv[1]; - } else if ((strcmp(argv[0], "write") == 0) && (argc == 3)) { - cmd = CMD_WRITE; - device = argv[2]; - /* check trx file before erasing or writing anything */ - trxfd = trx_check(argv[1], device); - } else { - usage(); - } - - sync(); - - i = 0; - while (erase[i] != NULL) { - mtd_unlock(erase[i]); - mtd_erase(erase[i]); - i++; - } - - mtd_unlock(device); - - switch (cmd) { - case CMD_UNLOCK: - break; - case CMD_ERASE: - mtd_erase(device); - break; - case CMD_WRITE: - mtd_write(trxfd, device); - break; - } - - if (boot) - kill(1, 15); // send SIGTERM to init for reboot - - return 0; -} diff --git a/openwrt/target/linux/package/Makefile b/openwrt/target/linux/package/Makefile index f34ad9a..adce4d4 100644 --- a/openwrt/target/linux/package/Makefile +++ b/openwrt/target/linux/package/Makefile @@ -5,10 +5,17 @@ package-$(BR2_PACKAGE_KMOD_FUSE) += fuse package-$(BR2_PACKAGE_KMOD_MINI_FO) += mini_fo package-$(BR2_PACKAGE_KMOD_SHFS) += shfs package-$(BR2_PACKAGE_KMOD_OPENSWAN) += openswan + +ifeq ($(BOARD),brcm) +package-y += nvram openwrt + ifeq ($(LINUX_VERSION),2.4.30) package-$(BR2_PACKAGE_KMOD_WLCOMPAT) += wlcompat endif +nvram-compile: openwrt-compile +endif + all: compile install clean: $(patsubst %,%-clean,$(package-) $(package-y) $(package-m)) compile: $(patsubst %,%-compile,$(package-y) $(package-m)) diff --git a/openwrt/target/linux/package/nvram/Makefile b/openwrt/target/linux/package/nvram/Makefile new file mode 100644 index 0000000..da67ffa --- /dev/null +++ b/openwrt/target/linux/package/nvram/Makefile @@ -0,0 +1,33 @@ +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=nvram +PKG_RELEASE:=1 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) + +include $(TOPDIR)/package/rules.mk + +BR2_PACKAGE_NVRAM:=y # does not depend on menuconfig +$(eval $(call PKG_template,NVRAM,nvram,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) + +$(PKG_BUILD_DIR)/.prepared: + mkdir -p $(PKG_BUILD_DIR) + cp -a ./src/* $(PKG_BUILD_DIR) + touch $@ + +$(PKG_BUILD_DIR)/.built: + $(MAKE) -C $(PKG_BUILD_DIR) \ + $(TARGET_CONFIGURE_OPTS) \ + CFLAGS="$(TARGET_CFLAGS) -I $(STAGING_DIR)/usr/include" + touch $@ + +$(IPKG_NVRAM): + mkdir -p $(IDIR_NVRAM)/usr/lib + cp $(PKG_BUILD_DIR)/*.so $(IDIR_NVRAM)/usr/lib + mkdir -p $(IDIR_NVRAM)/usr/sbin + cp $(PKG_BUILD_DIR)/nvram $(IDIR_NVRAM)/usr/sbin + $(RSTRIP) $(IDIR_NVRAM) + $(IPKG_BUILD) $(IDIR_NVRAM) $(PACKAGE_DIR) + diff --git a/openwrt/target/linux/package/nvram/ipkg/nvram.control b/openwrt/target/linux/package/nvram/ipkg/nvram.control new file mode 100644 index 0000000..bb25813 --- /dev/null +++ b/openwrt/target/linux/package/nvram/ipkg/nvram.control @@ -0,0 +1,7 @@ +Package: nvram +Priority: optional +Section: sys +Maintainer: Felix Fietkau <nbd@vd-s.ath.cx> +Source: buildroot internal +Description: NVRAM utility and libraries for Broadcom hardware + diff --git a/openwrt/target/linux/package/nvram/src/Makefile b/openwrt/target/linux/package/nvram/src/Makefile new file mode 100644 index 0000000..376c2b7 --- /dev/null +++ b/openwrt/target/linux/package/nvram/src/Makefile @@ -0,0 +1,22 @@ +# $Id$ + +EXTRA_CFLAGS := -c -I. -I../include +LIBSHARED_OBJS := shutils.o wl.o wl_linux.o defaults.o linux_timer.o +LIBNVRAM_OBJS := nvram_linux.o nvram_convert.o + +all: libshared.so libnvram.so nvram + +%.o: %.c + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ $^ + +libshared.so: $(LIBSHARED_OBJS) + $(CC) -shared -o $@ $^ + +libnvram.so: $(LIBNVRAM_OBJS) + $(CC) -shared -o $@ $^ + +nvram: main.o + $(CC) -o $@ $^ -L. -lnvram + +clean: + rm -f *.o *.so nvram diff --git a/openwrt/package/openwrt/libshared/bcmtimer.h b/openwrt/target/linux/package/nvram/src/bcmtimer.h index 3db9e62..3db9e62 100644 --- a/openwrt/package/openwrt/libshared/bcmtimer.h +++ b/openwrt/target/linux/package/nvram/src/bcmtimer.h diff --git a/openwrt/package/openwrt/libshared/defaults.c b/openwrt/target/linux/package/nvram/src/defaults.c index 119eaac..119eaac 100644 --- a/openwrt/package/openwrt/libshared/defaults.c +++ b/openwrt/target/linux/package/nvram/src/defaults.c diff --git a/openwrt/package/openwrt/libshared/linux_timer.c b/openwrt/target/linux/package/nvram/src/linux_timer.c index 0402e44..0402e44 100644 --- a/openwrt/package/openwrt/libshared/linux_timer.c +++ b/openwrt/target/linux/package/nvram/src/linux_timer.c diff --git a/openwrt/package/openwrt/libnvram/main.c b/openwrt/target/linux/package/nvram/src/main.c index a64430f..a64430f 100644 --- a/openwrt/package/openwrt/libnvram/main.c +++ b/openwrt/target/linux/package/nvram/src/main.c diff --git a/openwrt/package/openwrt/libnvram/nvram_convert.c b/openwrt/target/linux/package/nvram/src/nvram_convert.c index 4859090..4859090 100644 --- a/openwrt/package/openwrt/libnvram/nvram_convert.c +++ b/openwrt/target/linux/package/nvram/src/nvram_convert.c diff --git a/openwrt/package/openwrt/libnvram/nvram_convert.h b/openwrt/target/linux/package/nvram/src/nvram_convert.h index 70e1232..70e1232 100644 --- a/openwrt/package/openwrt/libnvram/nvram_convert.h +++ b/openwrt/target/linux/package/nvram/src/nvram_convert.h diff --git a/openwrt/package/openwrt/libnvram/nvram_linux.c b/openwrt/target/linux/package/nvram/src/nvram_linux.c index c41e321..c41e321 100644 --- a/openwrt/package/openwrt/libnvram/nvram_linux.c +++ b/openwrt/target/linux/package/nvram/src/nvram_linux.c diff --git a/openwrt/package/openwrt/libshared/shutils.c b/openwrt/target/linux/package/nvram/src/shutils.c index 49ad41a..49ad41a 100644 --- a/openwrt/package/openwrt/libshared/shutils.c +++ b/openwrt/target/linux/package/nvram/src/shutils.c diff --git a/openwrt/package/openwrt/libshared/wl.c b/openwrt/target/linux/package/nvram/src/wl.c index f09317a..f09317a 100644 --- a/openwrt/package/openwrt/libshared/wl.c +++ b/openwrt/target/linux/package/nvram/src/wl.c diff --git a/openwrt/package/openwrt/libshared/wl_linux.c b/openwrt/target/linux/package/nvram/src/wl_linux.c index 126a40b..126a40b 100644 --- a/openwrt/package/openwrt/libshared/wl_linux.c +++ b/openwrt/target/linux/package/nvram/src/wl_linux.c diff --git a/openwrt/target/linux/package/openwrt/Makefile b/openwrt/target/linux/package/openwrt/Makefile new file mode 100644 index 0000000..ee38f75 --- /dev/null +++ b/openwrt/target/linux/package/openwrt/Makefile @@ -0,0 +1,34 @@ +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME := openwrt-utils +PKG_RELEASE := 2 +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(TOPDIR)/package/rules.mk + +BR2_PACKAGE_OPENWRT:=y # ignore menuconfig +$(eval $(call PKG_template,OPENWRT,openwrt-utils,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) + + +$(PKG_BUILD_DIR)/.prepared: + mkdir -p $(PKG_BUILD_DIR) + touch $@ + +$(PKG_BUILD_DIR)/jffs2root: jffs2root.c + $(TARGET_CC) -o $@ $< + +$(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/jffs2root + touch $@ + +$(IPKG_OPENWRT): + mkdir -p $(IDIR_OPENWRT)/sbin + cp $(PKG_BUILD_DIR)/jffs2root $(IDIR_OPENWRT)/sbin + $(RSTRIP) $(IDIR_OPENWRT) + $(IPKG_BUILD) $(IDIR_OPENWRT) $(PACKAGE_DIR) + +compile: install-dev +install-dev: + mkdir -p $(STAGING_DIR)/usr/include + cp -a ./include/* $(STAGING_DIR)/usr/include/ diff --git a/openwrt/package/openwrt/include/bcmnvram.h b/openwrt/target/linux/package/openwrt/include/bcmnvram.h index 3c45263..3c45263 100644 --- a/openwrt/package/openwrt/include/bcmnvram.h +++ b/openwrt/target/linux/package/openwrt/include/bcmnvram.h diff --git a/openwrt/package/openwrt/include/bcmutils.h b/openwrt/target/linux/package/openwrt/include/bcmutils.h index 05ad41d..05ad41d 100644 --- a/openwrt/package/openwrt/include/bcmutils.h +++ b/openwrt/target/linux/package/openwrt/include/bcmutils.h diff --git a/openwrt/package/openwrt/include/cy_conf.h b/openwrt/target/linux/package/openwrt/include/cy_conf.h index dbe387b..dbe387b 100644 --- a/openwrt/package/openwrt/include/cy_conf.h +++ b/openwrt/target/linux/package/openwrt/include/cy_conf.h diff --git a/openwrt/package/openwrt/include/epivers.h b/openwrt/target/linux/package/openwrt/include/epivers.h index e174fb5..e174fb5 100644 --- a/openwrt/package/openwrt/include/epivers.h +++ b/openwrt/target/linux/package/openwrt/include/epivers.h diff --git a/openwrt/package/openwrt/include/proto/802.11.h b/openwrt/target/linux/package/openwrt/include/proto/802.11.h index ea57850..ea57850 100644 --- a/openwrt/package/openwrt/include/proto/802.11.h +++ b/openwrt/target/linux/package/openwrt/include/proto/802.11.h diff --git a/openwrt/package/openwrt/include/proto/ethernet.h b/openwrt/target/linux/package/openwrt/include/proto/ethernet.h index 173464a..173464a 100644 --- a/openwrt/package/openwrt/include/proto/ethernet.h +++ b/openwrt/target/linux/package/openwrt/include/proto/ethernet.h diff --git a/openwrt/package/openwrt/include/shutils.h b/openwrt/target/linux/package/openwrt/include/shutils.h index 783ee9e..783ee9e 100644 --- a/openwrt/package/openwrt/include/shutils.h +++ b/openwrt/target/linux/package/openwrt/include/shutils.h diff --git a/openwrt/package/openwrt/include/typedefs.h b/openwrt/target/linux/package/openwrt/include/typedefs.h index 6b0c25e..6b0c25e 100644 --- a/openwrt/package/openwrt/include/typedefs.h +++ b/openwrt/target/linux/package/openwrt/include/typedefs.h diff --git a/openwrt/package/openwrt/include/utils.h b/openwrt/target/linux/package/openwrt/include/utils.h index b8d1cdb..b8d1cdb 100644 --- a/openwrt/package/openwrt/include/utils.h +++ b/openwrt/target/linux/package/openwrt/include/utils.h diff --git a/openwrt/package/openwrt/include/wlcompat.h b/openwrt/target/linux/package/openwrt/include/wlcompat.h index a4fc134..a4fc134 100644 --- a/openwrt/package/openwrt/include/wlcompat.h +++ b/openwrt/target/linux/package/openwrt/include/wlcompat.h diff --git a/openwrt/package/openwrt/include/wlioctl.h b/openwrt/target/linux/package/openwrt/include/wlioctl.h index d5ef11f..d5ef11f 100644 --- a/openwrt/package/openwrt/include/wlioctl.h +++ b/openwrt/target/linux/package/openwrt/include/wlioctl.h diff --git a/openwrt/package/openwrt/include/wlutils.h b/openwrt/target/linux/package/openwrt/include/wlutils.h index 07e2536..07e2536 100644 --- a/openwrt/package/openwrt/include/wlutils.h +++ b/openwrt/target/linux/package/openwrt/include/wlutils.h diff --git a/openwrt/package/openwrt/openwrt-utils.control b/openwrt/target/linux/package/openwrt/ipkg/openwrt-utils.control index 37ef632..37ef632 100644 --- a/openwrt/package/openwrt/openwrt-utils.control +++ b/openwrt/target/linux/package/openwrt/ipkg/openwrt-utils.control diff --git a/openwrt/package/openwrt/jffs2root.c b/openwrt/target/linux/package/openwrt/jffs2root.c index 36b928f..36b928f 100644 --- a/openwrt/package/openwrt/jffs2root.c +++ b/openwrt/target/linux/package/openwrt/jffs2root.c diff --git a/openwrt/target/linux/package/wlcompat/Makefile b/openwrt/target/linux/package/wlcompat/Makefile index 419b4d2..55f05bf 100644 --- a/openwrt/target/linux/package/wlcompat/Makefile +++ b/openwrt/target/linux/package/wlcompat/Makefile @@ -17,7 +17,7 @@ endif WLCOMPAT_FLAGS:=$(TARGET_CFLAGS) -D__KERNEL__ -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 \ -mno-abicalls -fno-pic -finline-limit=100000 -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 \ -Wa,-mips32 -Wa,--trap -DMODULE -mlong-calls -fno-common -I. -I linux-2.4 -funsigned-char -nostdinc \ - -iwithprefix include -I$(KERNEL_DIR)/include -I$(KERNEL_DIR)/include/asm/gcc -I$(TOPDIR)/package/openwrt/include -c + -iwithprefix include -I$(KERNEL_DIR)/include -I$(KERNEL_DIR)/include/asm/gcc -I../openwrt/include -c $(PKG_BUILD_DIR)/.prepared: mkdir -p $(PKG_BUILD_DIR) |