[OpenWrt-Devel] How to install 3rd party package in OpenWrt

2015-07-13 Thread Pratik Prajapati
Hi,

What's the difference between following 2 methods in package makefile:

1) PKG_INSTALL:=1

logs:
make[2]: Leaving directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/package/libs/toolchain'
make[2]: Entering directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/package/radvd-2.11'
make[2]: Leaving directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/package/radvd-2.11'
make[1]: Leaving directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt'

2)
define Package/radvd-2.11/install
   $(call Build/Install/Default)
endef

logs:

make[3]: Entering directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11'
make[4]: Entering directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11'
 /bin/mkdir -p
'/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11/ipkg-install/usr/sbin'
  /usr/bin/install -c radvd radvdump
'/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11/ipkg-install/usr/sbin'
 /bin/mkdir -p
'/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11/ipkg-install/usr/share/man/man5'
 /usr/bin/install -c -m 644 radvd.conf.5
'/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11/ipkg-install/usr/share/man/man5'
 /bin/mkdir -p
'/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11/ipkg-install/usr/share/man/man8'
 /usr/bin/install -c -m 644 radvd.8 radvdump.8
'/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11/ipkg-install/usr/share/man/man8'
make[4]: Leaving directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11'
make[3]: Leaving directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11'
SHELL=
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/staging_dir/host/bin/flock
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/tmp/.root-copy.flock
-c 'cp -fpR
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/root-malta/tmp-radvd-2.11/.
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/root-malta/'
rm -rf
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/root-malta/tmp-radvd-2.11
touch
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/root-malta/stamp/.radvd-2.11_installed
if [ -f
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/pkginfo/radvd-2.11.default.install.clean
]; then rm -f
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/pkginfo/radvd-2.11.default.install
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/pkginfo/radvd-2.11.default.install.clean;
fi; echo "radvd-2.11" >>
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/pkginfo/radvd-2.11.default.install
make[2]: Leaving directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/package/radvd-2.11'
make[1]: Leaving directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt'


Using second method I was able to install package but not with 1st method.
For 1st method following was written here
http://wiki.openwrt.org/doc/devel/packages#dependencytypes:
PKG_INSTALL - Setting it to "1" will call the package's original "make
install" with prefix set to PKG_INSTALL_DIR

Is I am missing something for 1st method ?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] How to download 3rd party package from git in OpenWrt

2015-07-13 Thread Pratik Prajapati
Hi,

I want to build radvd-2.11 package in OpenWrt but i am unable to download
it using Makefile rules.

Makefile:

include $(TOPDIR)/rules.mk

PKG_NAME:=radvd
PKG_VERSION:=2.11
PKG_SOURCE_PROTO:=git

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip
PKG_SOURCE_URL:=https://github.com/reubenhwk/radvd.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=e3e2b38a0433f680a75dadb394692edec3ea66e3
PKG_CAT:=unzip
PKG_FIXUP:=autoreconf

include $(INCLUDE_DIR)/package.mk
.
.
.

Cmd: make ./package/radvd-2.11/compile V=s

Cloning into 'radvd-2.11'...
remote: Counting objects: 3603, done.
remote: Total 3603 (delta 0), reused 0 (delta 0), pack-reused 3603
Receiving objects: 100% (3603/3603), 1.64 MiB | 712.00 KiB/s, done.
Resolving deltas: 100% (2324/2324), done.
Checking connectivity... done.
Note: checking out 'e3e2b38a0433f680a75dadb394692edec3ea66e3'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at e3e2b38... Makefile.am: add --with-check to packages target
Packing checkout...
ERROR: Unknown pack format for file
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/tmp/dl/radvd-2.11.zip


I am not able to download radvd-2.11 using my makefile. What part I am
missing in Makefile ?
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] brcm2708: Implement sysupgrade

2015-07-13 Thread Bruno Randolf
Implement sysupgrade for Raspberry Pi, similar to the way it is done on x86:
The config files are saved in the boot partition and moved to where they are
normally expected in preinit.

Also add optional gzip compression for the SD card image, since this can save
a lot of space (76M vs 6M), also similar to x86.

Signed-off-by: Bruno Randolf 
---
 target/linux/brcm2708/Makefile |  2 +-
 .../brcm2708/base-files/lib/preinit/79_move_config | 18 ++
 .../linux/brcm2708/base-files/lib/upgrade/platform.sh  | 17 +
 target/linux/brcm2708/image/Makefile   |  3 +++
 4 files changed, 39 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/brcm2708/base-files/lib/preinit/79_move_config
 create mode 100644 target/linux/brcm2708/base-files/lib/upgrade/platform.sh

diff --git a/target/linux/brcm2708/Makefile b/target/linux/brcm2708/Makefile
index 30f6e1d..015aa9c 100644
--- a/target/linux/brcm2708/Makefile
+++ b/target/linux/brcm2708/Makefile
@@ -19,7 +19,7 @@ SUBTARGETS:=bcm2708 bcm2709
 KERNEL_PATCHVER:=3.18
 
 include $(INCLUDE_DIR)/target.mk
-DEFAULT_PACKAGES += brcm2708-gpu-fw kmod-usb-hid kmod-sound-core 
kmod-sound-arm-bcm2835
+DEFAULT_PACKAGES += brcm2708-gpu-fw kmod-usb-hid kmod-sound-core 
kmod-sound-arm-bcm2835 kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1
 
 define Target/Description
Build firmware image for Broadcom BCM2708/BCM2709 SoC devices.
diff --git a/target/linux/brcm2708/base-files/lib/preinit/79_move_config 
b/target/linux/brcm2708/base-files/lib/preinit/79_move_config
new file mode 100644
index 000..7bcea7b
--- /dev/null
+++ b/target/linux/brcm2708/base-files/lib/preinit/79_move_config
@@ -0,0 +1,18 @@
+#!/bin/sh
+# Copyright (C) 2015 OpenWrt.org
+
+BOOTPART=/dev/mmcblk0p1
+
+move_config() {
+   if [ -b $BOOTPART ]; then
+   insmod nls_cp437
+   insmod nls_iso8859-1
+   insmod fat
+   insmod vfat
+   mount -t vfat -o rw,noatime $BOOTPART /mnt
+   [ -f /mnt/sysupgrade.tgz ] && mv -f /mnt/sysupgrade.tgz /
+   umount /mnt
+   fi
+}
+
+boot_hook_add preinit_mount_root move_config
diff --git a/target/linux/brcm2708/base-files/lib/upgrade/platform.sh 
b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh
new file mode 100644
index 000..3e1ee00
--- /dev/null
+++ b/target/linux/brcm2708/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,17 @@
+platform_check_image() {
+   # i know no way to verify the image
+   return 0;
+}
+
+platform_do_upgrade() {
+   sync
+   get_image "$1" | dd of=/dev/mmcblk0 bs=2M conv=fsync
+   sleep 1
+}
+
+platform_copy_config() {
+   mount -t vfat -o rw,noatime /dev/mmcblk0p1 /mnt
+   cp -af "$CONF_TAR" /mnt/
+   sync
+   umount /mnt
+}
diff --git a/target/linux/brcm2708/image/Makefile 
b/target/linux/brcm2708/image/Makefile
index e70bdd0..0dd7b7d 100644
--- a/target/linux/brcm2708/image/Makefile
+++ b/target/linux/brcm2708/image/Makefile
@@ -28,6 +28,9 @@ define Image/Build/RaspberryPi
mcopy -i $(KDIR)/boot.img $(KDIR)/Image ::kernel.img  # Copy OpenWrt 
built kernel
./gen_rpi_sdcard_img.sh $(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img 
$(KDIR)/boot.img $(KDIR)/root.$(1) \
$(CONFIG_BRCM2708_SD_BOOT_PARTSIZE) 
$(CONFIG_TARGET_ROOTFS_PARTSIZE)
+  ifneq ($(CONFIG_TARGET_IMAGES_GZIP),)
+   gzip -k -f9 $(BIN_DIR)/$(IMG_PREFIX)-sdcard-vfat-$(1).img
+  endif
 endef
 
 define Image/Build
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] base-files: Add preinit option to disable config restore

2015-07-13 Thread Bruno Randolf
Sometimes it's desirable to be sure that config files from a new firmware image
overwrite the config files from the previously running firmware and we can not
always expect the user to use 'sysupgrade -n'. In this case the option
TARGET_PREINIT_CONFIG_RESTORE can be set to 'n'.

This is more useful with a custom uci-default scripts which can selectively
migrate config options, since the the old configuration still exists during the
first boot in /sysupgrade.tgz until /etc/init.d/done is called.

Signed-off-by: Bruno Randolf 
---
 package/base-files/Makefile| 3 ++-
 package/base-files/files/etc/preinit   | 1 +
 package/base-files/files/lib/preinit/80_mount_root | 2 +-
 package/base-files/image-config.in | 7 +++
 4 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index a5f15fa..94a6f26 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
 include $(INCLUDE_DIR)/version.mk
 
 PKG_NAME:=base-files
-PKG_RELEASE:=157
+PKG_RELEASE:=158
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
 PKG_BUILD_DEPENDS:=opkg/host usign/host
@@ -79,6 +79,7 @@ define ImageConfigOptions
echo 'pi_broadcast=$(if 
$(CONFIG_TARGET_PREINIT_BROADCAST),$(CONFIG_TARGET_PREINIT_BROADCAST),"192.168.1.255")'
 >>$(1)/lib/preinit/00_preinit.conf
echo 'pi_preinit_net_messages="$(CONFIG_TARGET_PREINIT_SHOW_NETMSG)"' 
>>$(1)/lib/preinit/00_preinit.conf
echo 
'pi_preinit_no_failsafe_netmsg="$(CONFIG_TARGET_PREINIT_SUPPRESS_FAILSAFE_NETMSG)"'
 >>$(1)/lib/preinit/00_preinit.conf
+   echo 'pi_config_restore="$(CONFIG_TARGET_PREINIT_CONFIG_RESTORE)"' 
>>$(1)/lib/preinit/00_preinit.conf
 endef
 endif
 
diff --git a/package/base-files/files/etc/preinit 
b/package/base-files/files/etc/preinit
index 9cc8a9a..c0b3168 100755
--- a/package/base-files/files/etc/preinit
+++ b/package/base-files/files/etc/preinit
@@ -20,6 +20,7 @@ fs_failsafe_wait_timeout=2
 
 pi_suppress_stderr="y"
 pi_init_suppress_stderr="y"
+pi_config_restore="y"
 pi_init_path="/bin:/sbin:/usr/bin:/usr/sbin"
 pi_init_cmd="/sbin/init"
 
diff --git a/package/base-files/files/lib/preinit/80_mount_root 
b/package/base-files/files/lib/preinit/80_mount_root
index f3fe788..770c845 100644
--- a/package/base-files/files/lib/preinit/80_mount_root
+++ b/package/base-files/files/lib/preinit/80_mount_root
@@ -5,7 +5,7 @@
 do_mount_root() {
mount_root
boot_run_hook preinit_mount_root
-   [ -f /sysupgrade.tgz ] && {
+   [ "$pi_config_restore" = "y" ] && [ -f /sysupgrade.tgz ] && {
echo "- config restore -"
cd /
tar xzf /sysupgrade.tgz
diff --git a/package/base-files/image-config.in 
b/package/base-files/image-config.in
index fd0ead6..832bf43 100644
--- a/package/base-files/image-config.in
+++ b/package/base-files/image-config.in
@@ -86,6 +86,13 @@ config TARGET_PREINIT_BROADCAST
Broadcast address to which to send preinit network messages, as
as failsafe messages
 
+config TARGET_PREINIT_CONFIG_RESTORE
+   bool
+   prompt "Restore configuration from sysupgrade" if PREINITOPT
+   default y
+   help
+   Restore configuration from previous firmware when doing
+   sysupgrade. Normally this should be 'y'.
 
 menuconfig INITOPT
bool "Init configuration options" if IMAGEOPT
-- 
1.9.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] firmware-utils mktplinkfw: print amount of exceeding bytes

2015-07-13 Thread Stephan Maka
This is very useful for trimming images towards 4 MiB flash size.

Signed-off-by: Stephan Maka 
---
 tools/firmware-utils/src/mktplinkfw.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/firmware-utils/src/mktplinkfw.c 
b/tools/firmware-utils/src/mktplinkfw.c
index 09536c6..850aff4 100644
--- a/tools/firmware-utils/src/mktplinkfw.c
+++ b/tools/firmware-utils/src/mktplinkfw.c
@@ -657,10 +657,10 @@ static int check_options(void)
kernel_len = kernel_info.file_size;
 
if (combined) {
-   if (kernel_info.file_size >
-   fw_max_len - sizeof(struct fw_header)) {
+   int exceed_bytes = kernel_info.file_size - (fw_max_len - 
sizeof(struct fw_header));
+   if (exceed_bytes > 0) {
if (!ignore_size) {
-   ERR("kernel image is too big");
+   ERR("kernel image is too big by %i bytes", 
exceed_bytes);
return -1;
}
layout->fw_max_len = sizeof(struct fw_header) +
@@ -684,20 +684,20 @@ static int check_options(void)
 
DBG("kernel length aligned to %u", kernel_len);
 
-   if (kernel_len + rootfs_info.file_size >
-   fw_max_len - sizeof(struct fw_header)) {
-   ERR("images are too big");
+   int exceed_bytes = kernel_len + rootfs_info.file_size - 
(fw_max_len - sizeof(struct fw_header));
+   if (exceed_bytes > 0) {
+   ERR("images are too big by %i bytes", 
exceed_bytes);
return -1;
}
} else {
-   if (kernel_info.file_size >
-   rootfs_ofs - sizeof(struct fw_header)) {
+   int exceed_bytes = kernel_info.file_size - (rootfs_ofs 
- sizeof(struct fw_header));
+   if (exceed_bytes > 0) {
ERR("kernel image is too big");
return -1;
}
 
-   if (rootfs_info.file_size >
-   (fw_max_len - rootfs_ofs)) {
+   exceed_bytes = rootfs_info.file_size - (fw_max_len - 
rootfs_ofs);
+   if (exceed_bytes > 0) {
ERR("rootfs image is too big");
return -1;
}
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] How to download 3rd party package from git in OpenWrt

2015-07-13 Thread Yousong Zhou
On Jul 13, 2015 6:53 PM, "Pratik Prajapati" 
wrote:
>
> Hi,
>
> I want to build radvd-2.11 package in OpenWrt but i am unable to download
it using Makefile rules.
>
> Makefile:
>
> include $(TOPDIR)/rules.mk
>
> PKG_NAME:=radvd
> PKG_VERSION:=2.11
> PKG_SOURCE_PROTO:=git
>
> PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
> PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip

try changing the suffix to .tar.gz

> PKG_SOURCE_URL:=https://github.com/reubenhwk/radvd.git
> PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
> PKG_SOURCE_VERSION:=e3e2b38a0433f680a75dadb394692edec3ea66e3
> PKG_CAT:=unzip

and remove this line

> PKG_FIXUP:=autoreconf
>
> include $(INCLUDE_DIR)/package.mk
> .
> .
> .
>
> Cmd: make ./package/radvd-2.11/compile V=s
>
> Cloning into 'radvd-2.11'...
> remote: Counting objects: 3603, done.
> remote: Total 3603 (delta 0), reused 0 (delta 0), pack-reused 3603
> Receiving objects: 100% (3603/3603), 1.64 MiB | 712.00 KiB/s, done.
> Resolving deltas: 100% (2324/2324), done.
> Checking connectivity... done.
> Note: checking out 'e3e2b38a0433f680a75dadb394692edec3ea66e3'.
>
> You are in 'detached HEAD' state. You can look around, make experimental
> changes and commit them, and you can discard any commits you make in this
> state without impacting any branches by performing another checkout.
>
> If you want to create a new branch to retain commits you create, you may
> do so (now or later) by using -b with the checkout command again. Example:
>
>   git checkout -b new_branch_name
>
> HEAD is now at e3e2b38... Makefile.am: add --with-check to packages target
> Packing checkout...
> ERROR: Unknown pack format for file
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/tmp/dl/radvd-2.11.zip
>

looks like git archive cannot do zip packing.

cheers

yousong

>
> I am not able to download radvd-2.11 using my makefile. What part I am
missing in Makefile ?
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] firmware-utils mktplinkfw: print amount of exceeding bytes

2015-07-13 Thread Jonathan Bennett
Tested and seems to work as intended. However, I think the image too big
messages should be printed at the default verbosity.

Currently, if make fails to generate the final image, it doesn't give any
message to acknowledge, and appears to have succeeded, there are just
"mysteriously" missing files in the output directory.

--Jonathan


On Mon, Jul 13, 2015 at 9:16 AM Stephan Maka  wrote:

> This is very useful for trimming images towards 4 MiB flash size.
>
> Signed-off-by: Stephan Maka 
> ---
>  tools/firmware-utils/src/mktplinkfw.c | 20 ++--
>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/tools/firmware-utils/src/mktplinkfw.c
> b/tools/firmware-utils/src/mktplinkfw.c
> index 09536c6..850aff4 100644
> --- a/tools/firmware-utils/src/mktplinkfw.c
> +++ b/tools/firmware-utils/src/mktplinkfw.c
> @@ -657,10 +657,10 @@ static int check_options(void)
> kernel_len = kernel_info.file_size;
>
> if (combined) {
> -   if (kernel_info.file_size >
> -   fw_max_len - sizeof(struct fw_header)) {
> +   int exceed_bytes = kernel_info.file_size - (fw_max_len -
> sizeof(struct fw_header));
> +   if (exceed_bytes > 0) {
> if (!ignore_size) {
> -   ERR("kernel image is too big");
> +   ERR("kernel image is too big by %i bytes",
> exceed_bytes);
> return -1;
> }
> layout->fw_max_len = sizeof(struct fw_header) +
> @@ -684,20 +684,20 @@ static int check_options(void)
>
> DBG("kernel length aligned to %u", kernel_len);
>
> -   if (kernel_len + rootfs_info.file_size >
> -   fw_max_len - sizeof(struct fw_header)) {
> -   ERR("images are too big");
> +   int exceed_bytes = kernel_len +
> rootfs_info.file_size - (fw_max_len - sizeof(struct fw_header));
> +   if (exceed_bytes > 0) {
> +   ERR("images are too big by %i bytes",
> exceed_bytes);
> return -1;
> }
> } else {
> -   if (kernel_info.file_size >
> -   rootfs_ofs - sizeof(struct fw_header)) {
> +   int exceed_bytes = kernel_info.file_size -
> (rootfs_ofs - sizeof(struct fw_header));
> +   if (exceed_bytes > 0) {
> ERR("kernel image is too big");
> return -1;
> }
>
> -   if (rootfs_info.file_size >
> -   (fw_max_len - rootfs_ofs)) {
> +   exceed_bytes = rootfs_info.file_size - (fw_max_len
> - rootfs_ofs);
> +   if (exceed_bytes > 0) {
> ERR("rootfs image is too big");
> return -1;
> }
> --
> 2.1.4
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] How to install 3rd party package in OpenWrt

2015-07-13 Thread Yousong Zhou
On Jul 13, 2015 5:12 PM, "Pratik Prajapati" 
wrote:
>
> Hi,
>
> What's the difference between following 2 methods in package makefile:
>
> 1) PKG_INSTALL:=1
>
> logs:
> make[2]: Leaving directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/package/libs/toolchain'
> make[2]: Entering directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/package/radvd-2.11'
> make[2]: Leaving directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/package/radvd-2.11'
> make[1]: Leaving directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt'
>
> 2)
> define Package/radvd-2.11/install
>$(call Build/Install/Default)
> endef
>
> logs:
>
> make[3]: Entering directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11'
> make[4]: Entering directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11'
>  /bin/mkdir -p
'/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11/ipkg-install/usr/sbin'
>   /usr/bin/install -c radvd radvdump
'/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11/ipkg-install/usr/sbin'
>  /bin/mkdir -p
'/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11/ipkg-install/usr/share/man/man5'
>  /usr/bin/install -c -m 644 radvd.conf.5
'/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11/ipkg-install/usr/share/man/man5'
>  /bin/mkdir -p
'/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11/ipkg-install/usr/share/man/man8'
>  /usr/bin/install -c -m 644 radvd.8 radvdump.8
'/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11/ipkg-install/usr/share/man/man8'
> make[4]: Leaving directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11'
> make[3]: Leaving directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/build_dir/target-mipsel_mips32_uClibc-0.9.33.2/radvd-2.11'
> SHELL=
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/staging_dir/host/bin/flock
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/tmp/.root-copy.flock
-c 'cp -fpR
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/root-malta/tmp-radvd-2.11/.
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/root-malta/'
> rm -rf
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/root-malta/tmp-radvd-2.11
> touch
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/root-malta/stamp/.radvd-2.11_installed
> if [ -f
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/pkginfo/radvd-2.11.default.install.clean
]; then rm -f
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/pkginfo/radvd-2.11.default.install
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/pkginfo/radvd-2.11.default.install.clean;
fi; echo "radvd-2.11" >>
/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/staging_dir/target-mipsel_mips32_uClibc-0.9.33.2/pkginfo/radvd-2.11.default.install
> make[2]: Leaving directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/package/radvd-2.11'
> make[1]: Leaving directory
`/home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt'
>
>
> Using second method I was able to install package but not with 1st method.
> For 1st method following was written here
http://wiki.openwrt.org/doc/devel/packages#dependencytypes:
> PKG_INSTALL - Setting it to "1" will call the package's original "make
install" with prefix set to PKG_INSTALL_DIR
>
> Is I am missing something for 1st method ?
>

I am not sure about this one, but package/xx/install is about packaging the
pkg in ipkg format, contaning dependency info, service script, uci configs,
etc.  and it is ipkg content that will be installed to root.  many times we
refer to PKG_INSTALL_DIR in package/xx/install for constructing .ipkg
content and binaries in .ipkg will be stripped by default.

Well, the above is mostly from past experience of packaging in OpenWrt.
correct me if it is wrong or there is more to add.

cheers

yousong
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwr

Re: [OpenWrt-Devel] [PATCH] firmware-utils mktplinkfw: print amount of exceeding bytes

2015-07-13 Thread Stephan Maka
Jonathan Bennett wrote:
> Tested and seems to work as intended. However, I think the image too big
> messages should be printed at the default verbosity.

The patch doesn't change any levels.

> Currently, if make fails to generate the final image, it doesn't give any
> message to acknowledge, and appears to have succeeded, there are just
> "mysteriously" missing files in the output directory.

All the ERR() outputs are followed by return -1, causing check_options()
and therefore the process and make to fail.

Sorry if I don't see your point but I'll be happy about follow-up
patches. :)


Cheers,
Stephan
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] firmware-utils mktplinkfw: print amount of exceeding bytes

2015-07-13 Thread Jonathan Bennett
My comments weren't a critique of your patch, and probably belong in a
separate thread, or even a bug report on dev.openwrt.org.

Apparently the behavior my machine is showing is not the normal or intended
behavior. On my machine (Fedora 22, but also had the issue in Fedora 21, if
I remember correctly), there is no error message printed when the image
generation fails due to being too large. Running V=s shows:

[mktplinkfw] *** error: images are too big
Makefile:2244: recipe for target 'install' failed
make[5]: [install] Error 255 (ignored)

So, the real problem is that for some reason, my system is ignoring the
make error. This is unrelated to your patch. My thinking is that it was
intended behavior, and would make sense to change it in the same patch.
Sorry about the confusion.


--Jonathan

On Mon, Jul 13, 2015 at 10:46 AM Stephan Maka  wrote:

> Jonathan Bennett wrote:
> > Tested and seems to work as intended. However, I think the image too big
> > messages should be printed at the default verbosity.
>
> The patch doesn't change any levels.
>
> > Currently, if make fails to generate the final image, it doesn't give any
> > message to acknowledge, and appears to have succeeded, there are just
> > "mysteriously" missing files in the output directory.
>
> All the ERR() outputs are followed by return -1, causing check_options()
> and therefore the process and make to fail.
>
> Sorry if I don't see your point but I'll be happy about follow-up
> patches. :)
>
>
> Cheers,
> Stephan
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] firmware-utils mktplinkfw: print amount of exceeding bytes

2015-07-13 Thread Martin Blumenstingl
On Mon, Jul 13, 2015 at 6:04 PM, Jonathan Bennett  wrote:
> So, the real problem is that for some reason, my system is ignoring the make
> error.
I think there was a discussion some time ago that images that are "too
large" should not break the whole image-builder (for nightlies,
release-builds, etc.).
So I guess this is a global thing, not just a problem with "your system".
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] NVRAM > 32K

2015-07-13 Thread Rafał Miłecki
On 12 May 2015 at 10:25, Hante Meuleman  wrote:
> The R8000 AP has more than 32K nvram memory. This was an issue for the
>
> userspace app "nvram". This got fixed at some point, but then it was
> reverted:
>
> http://git.openwrt.org/?p=openwrt.git;a=commit;h=9258d82f1d4a79f86ea72aad349b3f3eeb772d87
>
> Why was it reverted? Would be good to know what exact reason was, to be
>
> able to make a patch which will work on all platforms (assuming that it was
>
> reverted because some platform didn’t work with the 64K setting).

Uh, I just found this ancient e-mail unanswered. It was crashing
because of accessing memory of out buffer. It's fixed now, we support
any NVRAM size now.

-- 
Rafał
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v4 0/2] Support Ubiquiti Unifi Outdoor Plus HSR filter

2015-07-13 Thread Stefan Rompf
On Dienstag, 16. Juni 2015 23:14:05 Stefan Rompf wrote:

> so we arrive at the fourth iteration of the patchset to support the HSR of
> the Ubiquiti Unifi Outdoor Plus access point. This version implements the
> suggestions from Felix.

Ping?

Stefan
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Archer C7 CC 15.05-rc1 Ath9K phy1: Failed to stop TX DMA, queues=0x002!

2015-07-13 Thread camden lindsay
Thank you for noting this, Roman.
c

On Fri, Jul 10, 2015 at 10:55 PM, Roman Yeryomin  wrote:
> On 10 July 2015 at 05:07, camden lindsay
>  wrote:
>> I'm sorry, i said ath9k in the subject but the above seems more likely
>> to be ath10k.
>>
>> On Thu, Jul 9, 2015 at 7:03 PM, camden lindsay
>>  wrote:
>>> Hello-
>>>
>>> Thought I should report this, since there was so much discussion and
>>> confusion on tracker https://dev.openwrt.org/ticket/11862  causing a
>>> lot of work for some folks here.
>>>
>>> ...snip...
>>> ...
>>> [2060235.46] ath: phy1: Failed to stop TX DMA, queues=0x002!
>>> [2060265.46] ath: phy1: Failed to stop TX DMA, queues=0x002!
>>> [2061047.18] ath: phy1: Failed to stop TX DMA, queues=0x002!
>>> [2104015.84] ath: phy1: Unable to reset channel, reset status -5
>>> [2145012.92] ath10k_pci :01:00.0: SWBA overrun on vdev 0,
>>> skipped old beacon
>>> [2145013.03] ath10k_pci :01:00.0: SWBA overrun on vdev 0,
>>> skipped old beacon
>
> It was fixed in trunk (by using newer firmware and driver).
>
> Regards,
> Roman
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH ubox] log: allow filtering messages with a regexp pattern

2015-07-13 Thread John Crispin


On 12/07/2015 15:02, Rafał Miłecki wrote:
> + "-eFilter messages (not hostnames, 
> facilities, etc.)\n"

i think a log line consiste of the hostname + facility + message. hence
listing the bits not included in the message is not needed.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] How to download 3rd party package from git in OpenWrt

2015-07-13 Thread Pratik Prajapati
It worked but still i got some logs but don't know i should worry about it
or not.

logs:

Checking out files from the git repository...
Cloning into 'radvd-2.11'...
remote: Counting objects: 3603, done.
remote: Total 3603 (delta 0), reused 0 (delta 0), pack-reused 3603
Receiving objects: 100% (3603/3603), 1.64 MiB | 591.00 KiB/s, done.
Resolving deltas: 100% (2324/2324), done.
Checking connectivity... done.
Note: checking out 'e3e2b38a0433f680a75dadb394692edec3ea66e3'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at e3e2b38... Makefile.am: add --with-check to packages target


On Mon, Jul 13, 2015 at 8:05 PM, Yousong Zhou  wrote:

>
> On Jul 13, 2015 6:53 PM, "Pratik Prajapati" 
> wrote:
> >
> > Hi,
> >
> > I want to build radvd-2.11 package in OpenWrt but i am unable to
> download it using Makefile rules.
> >
> > Makefile:
> >
> > include $(TOPDIR)/rules.mk
> >
> > PKG_NAME:=radvd
> > PKG_VERSION:=2.11
> > PKG_SOURCE_PROTO:=git
> >
> > PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
> > PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip
>
> try changing the suffix to .tar.gz
>
> > PKG_SOURCE_URL:=https://github.com/reubenhwk/radvd.git
> > PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
> > PKG_SOURCE_VERSION:=e3e2b38a0433f680a75dadb394692edec3ea66e3
> > PKG_CAT:=unzip
>
> and remove this line
>
> > PKG_FIXUP:=autoreconf
> >
> > include $(INCLUDE_DIR)/package.mk
> > .
> > .
> > .
> >
> > Cmd: make ./package/radvd-2.11/compile V=s
> >
> > Cloning into 'radvd-2.11'...
> > remote: Counting objects: 3603, done.
> > remote: Total 3603 (delta 0), reused 0 (delta 0), pack-reused 3603
> > Receiving objects: 100% (3603/3603), 1.64 MiB | 712.00 KiB/s, done.
> > Resolving deltas: 100% (2324/2324), done.
> > Checking connectivity... done.
> > Note: checking out 'e3e2b38a0433f680a75dadb394692edec3ea66e3'.
> >
> > You are in 'detached HEAD' state. You can look around, make experimental
> > changes and commit them, and you can discard any commits you make in this
> > state without impacting any branches by performing another checkout.
> >
> > If you want to create a new branch to retain commits you create, you may
> > do so (now or later) by using -b with the checkout command again.
> Example:
> >
> >   git checkout -b new_branch_name
> >
> > HEAD is now at e3e2b38... Makefile.am: add --with-check to packages
> target
> > Packing checkout...
> > ERROR: Unknown pack format for file
> /home/pratik.prajapati/work/openwrt-radvd/openwrt-tip/openwrt/tmp/dl/radvd-2.11.zip
> >
>
> looks like git archive cannot do zip packing.
>
> cheers
>
> yousong
>
> >
> > I am not able to download radvd-2.11 using my makefile. What part I am
> missing in Makefile ?
> >
> > ___
> > openwrt-devel mailing list
> > openwrt-devel@lists.openwrt.org
> > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
> >
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH V3] cdc_ncm: Add support for moving NDP to end of NCM frame

2015-07-13 Thread John Crispin
Hi,

how is the testing going ? i would like to also pull this intot he CC
which means there is not that much time left.

also the patch sent was missing proper subject and SoB.

John

On 12/07/2015 15:36, Matti Laakso wrote:
>> Ahoy everyone,
>>
>> more on the Telekom Speedstick LTE V (Huawei 3372s) from here:
>>
>> http://www.amazon.de/dp/B00NLJE3O6
>>
>> I've tested Enricos latest patch on MIPS (3.18.17) and x86_64 (3.18.11)
>> and had a little bit of trouble applying it to latest trunk, so here's
>> the latest tested patch from a diff against 3.18.17 (openwrt-trunk).
>>
>> With that patch applied, a simple AT^NDISDUP=1,1,"your.apn.here" and
>> udhcpc -i wwan0 is online and routing immediately.
>>
>> The following config snippet is also working directly with openwrt:
>>
>> config interface '4g'
>>  option proto 'ncm'
>>  option ifname 'wwan0'
>>  option device '/dev/ttyUSB1'
>>  option apn 'internet.eplus.de'
>>
>> Again, big thanks go to Enrico for fixing NDP/SKB issues, much obliged.
> 
> That's great news! Did you try if option device '/dev/cdc-wdm0' works as
> well? I was able to borrow a E3372, and will try the patch soon as well.
> 
> Matti
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
> 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH V2 ubox] log: allow filtering messages with a regexp pattern

2015-07-13 Thread Rafał Miłecki
This allows printing/streaming/writing messages matching a specified
basic regular expression only.

Signed-off-by: Rafał Miłecki 
---
V2: Improve --help description of the new -e argument.
---
 log/logread.c | 15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/log/logread.c b/log/logread.c
index 6255408..dcf3c08 100644
--- a/log/logread.c
+++ b/log/logread.c
@@ -17,6 +17,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -57,7 +58,8 @@ static const struct blobmsg_policy log_policy[] = {
 
 static struct uloop_timeout retry;
 static struct uloop_fd sender;
-static const char *log_file, *log_ip, *log_port, *log_prefix, *pid_file, 
*hostname;
+static regex_t regexp_preg;
+static const char *log_file, *log_ip, *log_port, *log_prefix, *pid_file, 
*hostname, *regexp_pattern;
 static int log_type = LOG_STDOUT;
 static int log_size, log_udp, log_follow, log_trailer_null = 0;
 
@@ -128,6 +130,9 @@ static int log_notify(struct blob_attr *msg)
}
 
m = blobmsg_get_string(tb[LOG_MSG]);
+   if (regexp_pattern &&
+   regexec(®exp_preg, m, 0, NULL, 0) == REG_NOMATCH)
+   return 0;
t = blobmsg_get_u64(tb[LOG_TIME]) / 1000;
c = ctime(&t);
p = blobmsg_get_u32(tb[LOG_PRIO]);
@@ -186,6 +191,7 @@ static int usage(const char *prog)
"Options:\n"
"-s   Path to ubus socket\n"
"-l  Got only the last 'count' messages\n"
+   "-eFilter messages with a regexp\n"
"-r   Stream message to a server\n"
"-F   Log file\n"
"-S  Log size\n"
@@ -235,7 +241,7 @@ int main(int argc, char **argv)
 
signal(SIGPIPE, SIG_IGN);
 
-   while ((ch = getopt(argc, argv, "u0fcs:l:r:F:p:S:P:h:")) != -1) {
+   while ((ch = getopt(argc, argv, "u0fcs:l:r:F:p:S:P:h:e:")) != -1) {
switch (ch) {
case 'u':
log_udp = 1;
@@ -274,6 +280,11 @@ int main(int argc, char **argv)
case 'h':
hostname = optarg;
break;
+   case 'e':
+   if (!regcomp(®exp_preg, optarg, REG_NOSUB)) {
+   regexp_pattern = optarg;
+   }
+   break;
default:
return usage(*argv);
}
-- 
1.8.4.5
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel