Page 1 of 1
Editing the Header: gargoyle_header_footer
Posted: Wed Jan 06, 2010 6:00 pm
by vask
I wanted to put a link in the header to toggle on and off a frame. ie) like when you click on the gargoyle. I do NOT want to edit every single page.
However when I edit:
/usr/bin/gargoyle_header_footer
I get:
Bus Error when viewing the webpage.
I don't know if I can do what I want without being able to edit the header.
Please let me know how I can edit the header.
The frame I want to toggle on and off is:

Re: Editing the Header: gargoyle_header_footer
Posted: Wed Jan 06, 2010 6:35 pm
by Eric
You get an error because that's a binary file. The source code (in C) is in trunk/package/gargoyle/src/gargoyle_header_footer.c, if you check out the source from the SVN.
Implementing this functionality in C vs shell script is necessary because it dramatically improves performance (load time of each page is much faster).
You will need to recompile Gargoyle to make changes to that program.
Re: Editing the Header: gargoyle_header_footer
Posted: Thu Jan 07, 2010 12:28 am
by vask
I tried to compile on freeBSD after installing SVN from ports... There are a bunch of errors first 2 are missing files... the first missing file I moved to the same directory. The second missing file I couldn't find...
Code: Select all
[john]> ll
total 68
-rwxrwxrwx 1 john john 9196 Jan 6 19:59 erics_tools.h
-rwxrwxrwx 1 john john 28107 Jan 6 19:21 gargoyle_header_footer.c
[john]> gcc gargoyle_header_footer.c
gargoyle_header_footer.c:33:25: error: erics_tools.h: No such file or directory
gargoyle_header_footer.c:34:17: error: uci.h: No such file or directory
Re: Editing the Header: gargoyle_header_footer
Posted: Thu Jan 07, 2010 7:14 am
by Eric
You can't just do
Code: Select all
gcc gargoyle_header_footer.c -o gargoyle_header_footer
There are 2 major problems with this:
- You're compiling on your local system, so the binary will be incompatible with your router architecture. You need to cross-compile it.
- It has dependencies on other libraries
This is why the OpenWrt build system was created.
On linux, you can just checkout the SVN and type make [your architecture, usually "atheros-2.6" or "brcm-2.4"], and all the necessary stuff will be built. I don't know if this will work on BSD or not -- I do all my cross-compiling on Ubuntu Linux.
For more info on cross-compiling see a (very old!) tutorial I wrote, which can be found
here. Be warned, that's over 2 years old now, and refers to an ancient version of OpenWrt but the basic idea is the same.
Re: Editing the Header: gargoyle_header_footer
Posted: Fri Jan 08, 2010 7:41 pm
by vask
Following your tutorial:
http://www.gargoyle-router.com/wiki/dok ... wrt_coding
I am still having problems. I am now looking at:
https://forum.openwrt.org/viewtopic.php?id=13326
I have modified code and stuff and I am totally stuck here please help:
Code: Select all
[john@john-2 /Volumes/buildOpenWRT/stable-8.09-latest]% ll package/helloworld/
total 8
-rw-r--r-- 1 john john 999 Jan 10 12:55 Makefile
-rw-r--r-- 1 john john 223 Jan 8 17:35 helloworld.c
[john@john-2 /Volumes/buildOpenWRT/stable-8.09-latest]% cat package/helloworld/Makefile
# PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
# PKG_SOURCE_URL:=http://andrzejekiert.ovh.org/software/fconfig/
# PKG_MD5SUM:=dac355e9f2a0f48c414c52e2034b6346
##############################################
include $(TOPDIR)/rules.mk
PKG_NAME:=helloworld
PKG_VERSION:=20090110
PKG_RELEASE:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
# +
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
include $(INCLUDE_DIR)/package.mk
define Package/helloworld
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Helloworld -- prints a snarky message
URL=http://www.gargoyle-router.com
endef
define Package/helloworld/description
Please help me tell the world hello.
endef
# -
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
$(CP) ./* $(PKG_BUILD_DIR)/
endef
# +
#define Build/Configure
#endef
# +
#define Build/Compile
# $(call Build/Compile/Default)
#endef
define Package/helloworld/install
$(INSTALL_DIR) $(1)/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR) $(1)/bin/
endef
$(eval $(call BuildPackage,helloworld))
[john@john-2 /Volumes/buildOpenWRT/stable-8.09-latest]% cat package/helloworld/helloworld.c
/****************
* Helloworld.c
* An epileptic monkey on crack could write this code.
*****************/
#include <stdio.h>
int main(void)
{
printf("Hell! O' world, why won't my code compile?\n\n");
return 0;
}
[john@john-2 /Volumes/buildOpenWRT/stable-8.09-latest]% make package/helloworld/compile V=99
Collecting package info: done
mkdir -p /Volumes/buildOpenWRT/stable-8.09-latest/build_dir/mips/helloworld
cp -fpR ./* /Volumes/buildOpenWRT/stable-8.09-latest/build_dir/mips/helloworld/
touch /Volumes/buildOpenWRT/stable-8.09-latest/build_dir/mips/helloworld/.prepared_dab1190735021483a4d3dfe73e93fcd0
(cd /Volumes/buildOpenWRT/stable-8.09-latest/build_dir/mips/helloworld/./; if [ -x ./configure ]; then /opt/local/bin/gfind /Volumes/buildOpenWRT/stable-8.09-latest/build_dir/mips/helloworld/ -name config.guess | xargs chmod u+w; /opt/local/bin/gfind /Volumes/buildOpenWRT/stable-8.09-latest/build_dir/mips/helloworld/ -name config.guess | xargs -n1 cp /Volumes/buildOpenWRT/stable-8.09-latest/scripts/config.guess; /opt/local/bin/gfind /Volumes/buildOpenWRT/stable-8.09-latest/build_dir/mips/helloworld/ -name config.sub | xargs chmod u+w; /opt/local/bin/gfind /Volumes/buildOpenWRT/stable-8.09-latest/build_dir/mips/helloworld/ -name config.sub | xargs -n1 cp /Volumes/buildOpenWRT/stable-8.09-latest/scripts/config.sub; AR=mips-linux-uclibc-ar AS="mips-linux-uclibc-gcc -c -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fhonour-copts" LD=mips-linux-uclibc-ld NM=mips-linux-uclibc-nm CC="mips-linux-uclibc-gcc" GCC="mips-linux-uclibc-gcc" CXX="mips-linux-uclibc-g++" RANLIB=mips-linux-uclibc-ranlib STRIP=mips-linux-uclibc-strip OBJCOPY=mips-linux-uclibc-objcopy OBJDUMP=mips-linux-uclibc-objdump SIZE=mips-linux-uclibc-size CFLAGS="-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fhonour-copts " CXXFLAGS="-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fhonour-copts " CPPFLAGS="-I/Volumes/buildOpenWRT/stable-8.09-latest/staging_dir/mips/usr/include -I/Volumes/buildOpenWRT/stable-8.09-latest/staging_dir/mips/include " LDFLAGS="-L/Volumes/buildOpenWRT/stable-8.09-latest/staging_dir/toolchain-mips_gcc4.1.2/lib -L/Volumes/buildOpenWRT/stable-8.09-latest/staging_dir/mips/usr/lib -L/Volumes/buildOpenWRT/stable-8.09-latest/staging_dir/mips/lib " PKG_CONFIG_PATH="/Volumes/buildOpenWRT/stable-8.09-latest/staging_dir/mips/usr/lib/pkgconfig:/Volumes/buildOpenWRT/stable-8.09-latest/staging_dir/host/usr/lib/pkgconfig" PKG_CONFIG_LIBDIR="/Volumes/buildOpenWRT/stable-8.09-latest/staging_dir/mips/usr/lib/pkgconfig" ./configure --target=mips-linux --host=mips-linux --build=i686-apple-darwin9 --program-prefix="" --program-suffix="" --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls ; fi; )
touch /Volumes/buildOpenWRT/stable-8.09-latest/build_dir/mips/helloworld/.configured
CFLAGS="-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fhonour-copts -I/Volumes/buildOpenWRT/stable-8.09-latest/staging_dir/mips/usr/include -I/Volumes/buildOpenWRT/stable-8.09-latest/staging_dir/mips/include " CXXFLAGS="-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fhonour-copts -I/Volumes/buildOpenWRT/stable-8.09-latest/staging_dir/mips/usr/include -I/Volumes/buildOpenWRT/stable-8.09-latest/staging_dir/mips/include " LDFLAGS="-L/Volumes/buildOpenWRT/stable-8.09-latest/staging_dir/toolchain-mips_gcc4.1.2/lib -L/Volumes/buildOpenWRT/stable-8.09-latest/staging_dir/mips/usr/lib -L/Volumes/buildOpenWRT/stable-8.09-latest/staging_dir/mips/lib " make -C /Volumes/buildOpenWRT/stable-8.09-latest/build_dir/mips/helloworld/. AR=mips-linux-uclibc-ar AS="mips-linux-uclibc-gcc -c -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fhonour-copts" LD=mips-linux-uclibc-ld NM=mips-linux-uclibc-nm CC="mips-linux-uclibc-gcc" GCC="mips-linux-uclibc-gcc" CXX="mips-linux-uclibc-g++" RANLIB=mips-linux-uclibc-ranlib STRIP=mips-linux-uclibc-strip OBJCOPY=mips-linux-uclibc-objcopy OBJDUMP=mips-linux-uclibc-objdump SIZE=mips-linux-uclibc-size CROSS="mips-linux-uclibc-" ARCH="mips" ;
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
mkdir -p /Volumes/buildOpenWRT/stable-8.09-latest/build_dir/mips/helloworld
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
cp -fpR ./* /Volumes/buildOpenWRT/stable-8.09-latest/build_dir/mips/helloworld/
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
cp: cannot stat `./*': No such file or directory
make[3]: *** [/Volumes/buildOpenWRT/stable-8.09-latest/build_dir/mips/helloworld/.prepared_3ab9d5a9567f20af021674013bc3b608] Error 1
make[2]: *** [/Volumes/buildOpenWRT/stable-8.09-latest/build_dir/mips/helloworld/.built] Error 2
make[1]: *** [package/helloworld/compile] Error 2
make: *** [package/helloworld/compile] Error 2