mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-29 16:51:33 +02:00
move nvram,jffs2root,shared libs into target/linux/package and make them broadcom-specific
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@1517 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
b3c393cfc4
commit
dba6e9388f
@ -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 $@
|
||||
|
@ -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)
|
@ -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)
|
@ -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)
|
@ -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;
|
||||
}
|
@ -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))
|
||||
|
33
openwrt/target/linux/package/nvram/Makefile
Normal file
33
openwrt/target/linux/package/nvram/Makefile
Normal file
@ -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)
|
||||
|
7
openwrt/target/linux/package/nvram/ipkg/nvram.control
Normal file
7
openwrt/target/linux/package/nvram/ipkg/nvram.control
Normal file
@ -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
|
||||
|
22
openwrt/target/linux/package/nvram/src/Makefile
Normal file
22
openwrt/target/linux/package/nvram/src/Makefile
Normal file
@ -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
|
34
openwrt/target/linux/package/openwrt/Makefile
Normal file
34
openwrt/target/linux/package/openwrt/Makefile
Normal file
@ -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/
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user