Thursday, May 7, 2020

RISC-v emulator

Changes are based on https://risc-v-getting-started-guide.readthedocs.io/en/latest/linux-qemu.html

For Ubuntu/Debian, in addition to

sudo apt install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev \
                 gawk build-essential bison flex texinfo gperf libtool patchutils bc \
                 zlib1g-dev libexpat-dev git

You will need the development headers for

sudo apt-get install libglib2.0-dev libpixman-1-dev libncurses-dev


Before building Busybear Linux, you will need to softlink riscv-pk into busy bear-linux because git checkout put riscv-pk into the riscv64-linux.


cd riscv64-linux/busybear-linux
rm -rf src/riscv-pk
ln -s ../riscv-pk src/


You need to enable the following modules within .config in the linux folder.

CONFIG_E100=y
CONFIG_E1000=y
CONFIG_E1000E=y


Start the QEMU emulator with the following command:

  sudo qemu-system-riscv64 \
        -nographic \
        -machine virt \
        -kernel riscv-pk/build/bbl \
        -append "root=/dev/vda ro console=ttyS0" \
        -drive file=busybear-linux/busybear.bin,format=raw,id=hd0 \
        -device virtio-blk-device,drive=hd0 \
        -netdev type=tap,script=./ifup,downscript=./ifdown,id=net0 \
        -device virtio-net-device,netdev=net0


Saturday, February 29, 2020

Hyperledger Problems and Fixes


Problem 1: 
Error: got unexpected status: BAD_REQUEST -- error validating channel creation transaction for new channel 'carsales', could not successfully apply update to template configuration: error authorizing update: error validating DeltaSet: policy for [Group]  /Channel/Application not satisfied: implicit policy evaluation failed - 0 sub-policies were satisfied, but this policy requires 1 of the 'Admins' sub-policies to be satisfied


Solution: 
Remove old channel, chaincode, and other information
$> sudo rm -rf /var/hyperledger

Then, restart all services so that information in the above folder will be recreated. E.g.,

Restart orderer
$> sudo systemctl start fabric-orderer.service

Restart peer
$> sudo systemctl start fabric-peer0-org1.service



Problem 2:
My peer nodes are behind a firewall. The docker container created for building the chaincode cannot resolve URL.

When running peer chaincode instantiate ..., I got
2020-03-10 13:52:58.465 EST [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2020-03-10 13:52:58.466 EST [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "Copying from /chaincode/input/src/ to /tmp/tmp.sERrFqHiCD
Gradle build
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':compileClasspath'.
> Could not resolve org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:1.4.5.
  Required by:
      project :
   > Could not resolve org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:1.4.5.
      > Could not get resource 'https://hyperledger.jfrog.io/hyperledger/fabric-maven/org/hyperledger/fabric-chaincode-java/fabric-chaincode-shim/1.4.5/fabric-chaincode-shim-1.4.5.pom'.
         > Could not GET 'https://hyperledger.jfrog.io/hyperledger/fabric-maven/org/hyperledger/fabric-chaincode-java/fabric-chaincode-shim/1.4.5/fabric-chaincode-shim-1.4.5.pom'.
            > hyperledger.jfrog.io
   > Could not resolve org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:1.4.5.
      > Could not get resource 'https://repo.maven.apache.org/maven2/org/hyperledger/fabric-chaincode-java/fabric-chaincode-shim/1.4.5/fabric-chaincode-shim-1.4.5.pom'.
         > Could not GET 'https://repo.maven.apache.org/maven2/org/hyperledger/fabric-chaincode-java/fabric-chaincode-shim/1.4.5/fabric-chaincode-shim-1.4.5.pom'.
            > repo.maven.apache.org: Temporary failure in name resolution
   > Could not resolve org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:1.4.5.
      > Could not get resource 'https://repository.mulesoft.org/nexus/content/repositories/public/org/hyperledger/fabric-chaincode-java/fabric-chaincode-shim/1.4.5/fabric-chaincode-shim-1.4.5.pom'.
         > Could not GET 'https://repository.mulesoft.org/nexus/content/repositories/public/org/hyperledger/fabric-chaincode-java/fabric-chaincode-shim/1.4.5/fabric-chaincode-shim-1.4.5.pom'.
            > repository.mulesoft.org
   > Could not resolve org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:1.4.5.
      > Could not get resource 'https://repo1.maven.org/maven2/org/hyperledger/fabric-chaincode-java/fabric-chaincode-shim/1.4.5/fabric-chaincode-shim-1.4.5.pom'.
         > Could not GET 'https://repo1.maven.org/maven2/org/hyperledger/fabric-chaincode-java/fabric-chaincode-shim/1.4.5/fabric-chaincode-shim-1.4.5.pom'.
            > repo1.maven.org
   > Could not resolve org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:1.4.5.
      > Could not get resource 'https://jcenter.bintray.com/org/hyperledger/fabric-chaincode-java/fabric-chaincode-shim/1.4.5/fabric-chaincode-shim-1.4.5.pom'.
         > Could not GET 'https://jcenter.bintray.com/org/hyperledger/fabric-chaincode-java/fabric-chaincode-shim/1.4.5/fabric-chaincode-shim-1.4.5.pom'.
            > jcenter.bintray.com
   > Could not resolve org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:1.4.5.
      > Could not get resource 'https://jitpack.io/org/hyperledger/fabric-chaincode-java/fabric-chaincode-shim/1.4.5/fabric-chaincode-shim-1.4.5.pom'.
         > Could not GET 'https://jitpack.io/org/hyperledger/fabric-chaincode-java/fabric-chaincode-shim/1.4.5/fabric-chaincode-shim-1.4.5.pom'.
            > jitpack.io
> Could not resolve com.owlike:genson:1.5.
  Required by:
      project :
   > Could not resolve com.owlike:genson:1.5.
      > Could not get resource 'https://hyperledger.jfrog.io/hyperledger/fabric-maven/com/owlike/genson/1.5/genson-1.5.pom'.
         > Could not GET 'https://hyperledger.jfrog.io/hyperledger/fabric-maven/com/owlike/genson/1.5/genson-1.5.pom'.
            > hyperledger.jfrog.io: Temporary failure in name resolution
   > Could not resolve com.owlike:genson:1.5.
      > Could not get resource 'https://repo.maven.apache.org/maven2/com/owlike/genson/1.5/genson-1.5.pom'.
         > Could not GET 'https://repo.maven.apache.org/maven2/com/owlike/genson/1.5/genson-1.5.pom'.
            > repo.maven.apache.org
   > Could not resolve com.owlike:genson:1.5.
      > Could not get resource 'https://repository.mulesoft.org/nexus/content/repositories/public/com/owlike/genson/1.5/genson-1.5.pom'.
         > Could not GET 'https://repository.mulesoft.org/nexus/content/repositories/public/com/owlike/genson/1.5/genson-1.5.pom'.
            > repository.mulesoft.org: Temporary failure in name resolution
   > Could not resolve com.owlike:genson:1.5.
      > Could not get resource 'https://repo1.maven.org/maven2/com/owlike/genson/1.5/genson-1.5.pom'.
         > Could not GET 'https://repo1.maven.org/maven2/com/owlike/genson/1.5/genson-1.5.pom'.
            > repo1.maven.org: Temporary failure in name resolution
   > Could not resolve com.owlike:genson:1.5.
      > Could not get resource 'https://jcenter.bintray.com/com/owlike/genson/1.5/genson-1.5.pom'.
         > Could not GET 'https://jcenter.bintray.com/com/owlike/genson/1.5/genson-1.5.pom'.
            > jcenter.bintray.com: Temporary failure in name resolution
   > Could not resolve com.owlike:genson:1.5.
      > Could not get resource 'https://jitpack.io/com/owlike/genson/1.5/genson-1.5.pom'.
         > Could not GET 'https://jitpack.io/com/owlike/genson/1.5/genson-1.5.pom'.
            > jitpack.io: Temporary failure in name resolution

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 22s
1 actionable task: 1 executed

"

Solution1 (Manual):
In the terminal of peer0org1, run this to attach to the docker
$> docker exec -it $(docker ps | grep hyperledger/fabric-javaenv | cut -d" " -f1) bash
In the attached docker terminal, run this 
$> sudo echo "nameserver 8.8.8.8" >> /etc/resolv.conf
Solution2 (Automated):
$> ssh -n -f USER_NAME@Peer0Org1Address "bash $PEER_ROOT/configDNS.bash 3" &
The content of the configDNS.bash is
```
sleep $SLEEP_TIME
docker exec -t $(docker ps | grep hyperledger/fabric-javaenv | cut -d" " -f1) bash -c 'echo "nameserver 8.8.8.8" >> /etc/resolv.conf'
```

Thursday, May 11, 2017

[solved] Gitlab upgrade problem 'GitlabCiService'

 ================================================================================
    Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
    ================================================================================
    
    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '1'
    ---- Begin output of "bash"  "/tmp/chef-script20170511-11989-rxzicg" ----
    STDOUT: rake aborted!
    StandardError: An error has occurred, this and all later migrations canceled:
    
    The single-table inheritance mechanism failed to locate the subclass: 'GitlabCiService'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite Service.inheritance_column to use another column for that information./opt/gitlab/embedded/service/gitlab-rails/db/migrate/20140907220153_serialize_service_properties.rb:26:in `each'
    /opt/gitlab/embedded/service/gitlab-rails/db/migrate/20140907220153_serialize_service_properties.rb:26:in `change'

    /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:50:in `block (3 levels) in <top (required)>'


try
> sudo gitlab-rails dbconsole 
gitlabhq_production=> DELETE FROM services WHERE type = 'GitlabCiService';

after run 
> gitlab-ctl reconfigure

then it should fix the table.




Monday, August 3, 2015

Homomorphic-Simon implementation: Flint library compile error

g++ -I/usr/local/include -I/opt/local/include -O3 -fopenmp -Wall -pedantic -DYASHE -o Simon main.o Simon.o timing.o YASHE/BitVector.o YASHE/Ciphertext.o YASHE/Entropy.o YASHE/Sampler.o YASHE/YASHEKey.o -L/opt/local/lib -lgmp -lgmpxx -lcrypto -lm -lmpfr -lflint
main.o: In function `YASHEParams::~YASHEParams()':
main.cpp:(.text._ZN11YASHEParamsD2Ev[_ZN11YASHEParamsD5Ev]+0x39): undefined reference to `_fmpz_clear_mpz'
main.cpp:(.text._ZN11YASHEParamsD2Ev[_ZN11YASHEParamsD5Ev]+0x51): undefined reference to `_fmpz_clear_mpz'
main.cpp:(.text._ZN11YASHEParamsD2Ev[_ZN11YASHEParamsD5Ev]+0x74): undefined reference to `_fmpz_clear_mpz'
main.o: In function `std::vector<Ciphertext, std::allocator<Ciphertext> >::~vector()':
main.cpp:(.text._ZNSt6vectorI10CiphertextSaIS0_EED2Ev[_ZNSt6vectorI10CiphertextSaIS0_EED5Ev]+0x1d): undefined reference to `fmpz_mod_poly_clear'
main.o: In function `std::vector<std::vector<Ciphertext, std::allocator<Ciphertext> >, std::allocator<std::vector<Ciphertext, std::allocator<Ciphertext> > > >::~vector()':
main.cpp:(.text._ZNSt6vectorIS_I10CiphertextSaIS0_EESaIS2_EED2Ev[_ZNSt6vectorIS_I10CiphertextSaIS0_EESaIS2_EED5Ev]+0x35): undefined reference to `fmpz_mod_poly_clear'
main.o: In function `void std::__uninitialized_fill_n<false>::__uninit_fill_n<std::vector<Ciphertext, std::allocator<Ciphertext> >*, unsigned long, std::vector<Ciphertext, std::allocator<Ciphertext> > >(std::vector<Ciphertext, std::allocator<Ciphertext> >*, unsigned long, std::vector<Ciphertext, std::allocator<Ciphertext> > const&)':
main.cpp:(.text._ZNSt22__uninitialized_fill_nILb0EE15__uninit_fill_nIPSt6vectorI10CiphertextSaIS3_EEmS5_EEvT_T0_RKT1_[_ZNSt22__uninitialized_fill_nILb0EE15__uninit_fill_nIPSt6vectorI10CiphertextSaIS3_EEmS5_EEvT_T0_RKT1_]+0x113): undefined reference to `fmpz_mod_poly_clear'
main.o: In function `main':
main.cpp:(.text.startup+0x6f): undefined reference to `fmpz_set_str'
main.cpp:(.text.startup+0x7c): undefined reference to `fmpz_cmp'
main.cpp:(.text.startup+0x531): undefined reference to `_fmpz_clear_mpz'

main.cpp:(.text.startup+0x5b1): undefined reference to `_fmpz_clear_mpz'
...
...
...

YASHE/YASHEKey.o:YASHEKey.cpp:(.text._ZNSt6vectorIN5flint26fmpz_mod_polyxx_expressionINS0_10operations9immediateENS0_6detail18fmpz_mod_poly_dataEEESaIS6_EE14_M_fill_insertEN9__gnu_cxx17__normal_iteratorIPS6_S8_EEmRKS6_[_ZNSt6vectorIN5flint26fmpz_mod_polyxx_expressionINS0_10operations9immediateENS0_6detail18fmpz_mod_poly_dataEEESaIS6_EE14_M_fill_insertEN9__gnu_cxx17__normal_iteratorIPS6_S8_EEmRKS6_]+0x4d4): more undefined references to `fmpz_mod_poly_clear' follow
collect2: error: ld returned 1 exit status


This is caused by the installation of the old flint library. Typically done by apt-get install. 
So get remove the error, you need to run
$> sudo apt-get remove libflint-dev

then soft symlink the flint.h to the /usr/local/include/ by this command
$> sudo ln -s /usr/local/include/flint/flint.h /usr/local/include/flint.h


LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH

then it should work.

Monday, June 29, 2015

NTL library: symbol(s) not found for architecture x86_64


It took me a few days to resolve this problem with the NTL library on Mac OS X.
http://www.shoup.net/ntl/doc/tour-unix.html

So I am going to share the solution with anyone who might run into this problem.

The error:

ph$ clang++ -v -g -O2   -o bv_scheme NTL_examples.o  -lm -lgmp -lntl
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.3.0
Thread model: posix
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.10.0 -o bv_scheme NTL_examples.o -lm -lgmp -lntl -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
  "NTL::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, NTL::ZZ const&)", referenced from:
      _main in NTL_examples.o
  "std::istream::get()", referenced from:
      NTL::SkipWhiteSpace(std::istream&) in libntl.a(tools.o)
  "std::istream::peek()", referenced from:
      NTL::SkipWhiteSpace(std::istream&) in libntl.a(tools.o)
  "std::ostream& std::ostream::_M_insert<long>(long)", referenced from:
      NTL::PrintTime(std::ostream&, double) in libntl.a(tools.o)
  "std::ios_base::Init::Init()", referenced from:
      __GLOBAL__sub_I_lip.c in libntl.a(lip.o)
      __GLOBAL__sub_I_tools.c in libntl.a(tools.o)
  "std::ios_base::Init::~Init()", referenced from:
      __GLOBAL__sub_I_lip.c in libntl.a(lip.o)
      __GLOBAL__sub_I_tools.c in libntl.a(tools.o)
  "std::basic_ios<char, std::char_traits<char> >::clear(std::_Ios_Iostate)", referenced from:
      NTL::TerminalError(char const*) in libntl.a(tools.o)
  "std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long)", referenced from:
      NTL::TerminalError(char const*) in libntl.a(tools.o)
      NTL::PrintTime(std::ostream&, double) in libntl.a(tools.o)
  "std::cerr", referenced from:
      NTL::TerminalError(char const*) in libntl.a(tools.o)
ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Because Mac OS X now using libc++ rather than libstdc++, so you will need to compile the NTL library with libc++. You have to force it to use the libc++ option. The new compiling steps:

1. ./configure  NTL_GMP_LIP=on
2. open makefile under src/ and change to the following
CXX=clang++
# A C++ compiler, e.g., g++, CC, xlC 
LDLIBS=-lm -lc++
# libraries for linking C++ programs

3. make & sudo make install

Then you should be able to use the NTL library natively in Mac OS X.

Thursday, May 21, 2015

Things about PhoneLab

I am starting this post to document things about PhoneLab (www.phone-lab.org). Hopefully you find it useful.
https://www.phone-lab.org/experiment/start/


Download source

Initialize the repo
repo init -u http://platform.phone-lab.org:8080/platform/manifest -b phonelab/android-4.4.4_r1/develop

actually download the code with
repo sync


Build the source


source build/envsetup.sh
lunch aosp_hammerhead-userdebug
Compile the code with multiple cores.
make -j4



Build the Cruncher tool

source: https://www.phone-lab.org/experiment/data/#cruncher


git clone http://platform.phone-lab.org:8080/p/phonelab/cruncher.git
cd cruncher/crunchersudo



add these packages to the packages.txt
gfortran
libblas-dev
liblas-bin
liblas-c-dev
libatlas-dev
libatlas-base-dev
 
 
xargs -a packages.txt apt-get install
sudo pip install -r requirements.txt

Monday, April 13, 2015

node-red-contrib-bean installation error

> xpc-connection@0.1.3 install /Users/ph/.node-red/node_modules/node-red-contrib-bean/node_modules/ble-bean/node_modules/noble/node_modules/xpc-connection
> node-gyp rebuild

  CXX(target) Release/obj.target/binding/src/XpcConnection.o
cc1plus: error: argument to '-O' should be a non-negative integer, 'g', 's' or 'fast'
make: *** [Release/obj.target/binding/src/XpcConnection.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Darwin 14.3.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/ph/.node-red/node_modules/node-red-contrib-bean/node_modules/ble-bean/node_modules/noble/node_modules/xpc-connection
gyp ERR! node -v v0.10.36
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok 
npm WARN optional dep failed, continuing xpc-connection@0.1.3

> noble@0.3.13 install /Users/ph/.node-red/node_modules/node-red-contrib-bean/node_modules/ble-bean/node_modules/noble
> node-gyp rebuild

  LINK(target) Release/hci-ble
  LINK(target) Release/hci-ble: Finished
  LINK(target) Release/l2cap-ble
  LINK(target) Release/l2cap-ble: Finished
node-red-contrib-bean@0.3.2 .node-red/node_modules/node-red-contrib-bean

└── ble-bean@2.1.0 (noble-device@0.1.3, crc@2.1.1, noble@0.3.13)


This is because the use of wrong GCC, as documented in 
https://github.com/sandeepmistry/node-xpc-connection/issues/2

$ which gcc
/usr/bin/gcc
Try setting the path, just before npm install:
export PATH=/usr/bin:$PATH

Tuesday, December 9, 2014

Adafruit kernel module for PWM for RaspberryPi

I was trying to use the Adafruit kernel source to build my customized kernel. But for some reasons, the USB hub was not working after installing the kernel. So I spent sometime to extract the kernel modules from Adafruit from their source tree.

Here is the patch that I generate for official RaspberryPi kernel source tree.


Wednesday, November 12, 2014

Thursday, October 23, 2014

Beautify Linux Screen session


Screen is a useful too to maintain remote SSH sessions while working with embedded devices. If you want to have nice and informative screen sessions, you can add the following to the ~/.screenrc file.

autodetach on
startup_message off
hardstatus alwayslastline
shelltitle 'bash'

hardstatus string '%{gk}[%{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= w}%?%+Lw%?%? %{g}][%{d}%l%{g}][ %{= w}%Y/%m/%d %0C:%s%a%{g} ]%{W}'

Tuesday, October 21, 2014

Updating MacPort to Yosemite

I was trying to install a package from MacPort and realized my port installation is broken. To install a new version, I have to recompile it from source.

I follow the SVN path.
https://guide.macports.org/#installing.macports.subversion

The compile is fine, no problem at all. Assume you have everything installed for compilation.

At the end, you might want to upgrade all outdated packages. then You will have a problem like this.

$ sudo port upgrade outdated
--->  Computing dependencies for cmake
--->  Configuring cmake
Error: Failed to configure cmake: configure failure: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/main.log for details.
Error: Follow http://guide.macports.org/#project.tickets to report a bug.

CSs-MacBook-Pro:base ph$ more /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_cmake/cmake/main.log

To solve the problem, you will need to update your xCode SDK. Just go to apple developer site and update it. After that, you are rock.

You will have another problem with gcc46.


$ sudo port upgrade outdated
Password:
--->  Computing dependencies for gcc46
--->  Building gcc46
Error: Failed to build gcc46: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc46/gcc46/main.log for details.

Error: Follow http://guide.macports.org/#project.tickets to report a bug.

I went pass this problem with installing gcc49 and remove gcc46.

sudo port install gcc49
sudo port uninstall gcc46

Wednesday, February 8, 2012

Sunday, November 20, 2011

Running mesh with OLSR with Openwrt (backfire)

1. checkout the svn source codes from official SVN repo.

2.update software packages and install them
 ./scripts/feeds update
 ./scripts/feeds install -a -p luci
 ./scripts/feeds install -a -p olsrd

3. compile the Openwrt system with Luci image

4. under Network/Interface, add new interface

5. configure the new created interface

6. configure wifi under Network/Wifi

7. ssh into the node, and edit /etc/config/olsrd, must set 'interface' to 'wl0' as we configure the wifi interface in previous step.
 config  'Interface'
              list 'interface' 'wl0'     
                                                                                                         
8. then start the olsrd, by /etc/init.d/olsrd start

Tuesday, October 25, 2011

things need to change to enable multiple hop routing

#!/bin/ash

# needed for static multihop routing
echo 1 > /proc/sys/net/ipv4/ip_forward
echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects
echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects
echo 0 > /proc/sys/net/ipv4/conf/ath0/send_redirects
echo 0 > /proc/sys/net/ipv4/conf/ath0/accept_redirects
echo 0 > /proc/sys/net/ipv4/conf/ath1/send_redirects
echo 0 > /proc/sys/net/ipv4/conf/ath1/accept_redirects
echo 0 > /proc/sys/net/ipv4/conf/ath2/send_redirects
echo 0 > /proc/sys/net/ipv4/conf/ath2/accept_redirects

embedded linux tools for android

Busybox
http://www.androidfanatic.com/community-forums.html?func=view&id=228&catid=9

Iperf
http://www.magicandroidapps.com/wiki//index.php?title=Using_iPerf_for_Android

Rooting Galaxy S2
http://samsunggalaxys2review.org/root-your-samsung-galaxy-s2-heres-how/

enable multi-hop routing
http://thindot.blogspot.com/2011/10/things-need-to-change-to-enable.html

Thursday, September 29, 2011

Discontinuation of libhid library in Ubuntu 10.10 causes problems

root@router39:~/mesh-svn-repo/LabBrick-Control# ./LabBrickControl
./LabBrickControl: error while loading shared libraries: libhid.so.0: cannot open shared object file: No such file or directory

all you need to do is to copy /usr/local/lib/libhid.so.0 to the node that needs it.

Tuesday, September 20, 2011

How to disable GRUB 2 menu, even after crash.

Just wanted to share this with anyone wanting to know.
If your headless server crashes, GRUB2 (at least on Ubuntu Server) is designed to force the GRUB menu to load up next time it starts up, which means you are locked out of SSH until someone physically makes a kernel selection on the PC.

To prevent this do the following change to your grub.cfg file.

#nano /boot/grub/grub.cfg

You want to find this line and change it:
Code:
if [ ${recordfail} = 1 ]; then
  set timeout=-1
else
  set timeout=10
fi
And change to:
Code:
if [ ${recordfail} = 1 ]; then
  set timeout=3
else
  set timeout=10
fi
Or a number other than -1.

when install new kernel image, the system will update this grub.cfg file. Therefore, you also need to change the /etc/grub.d/00_header, find the following function:


Code:
make_timeout ()
{
    cat << EOF
if [ "\${recordfail}" = 1 ]; then
  set timeout=1
else
  set timeout=${2}
fi
EOF
}
So we need to change "set timeout=-1" to "set timeout=1" as well.

Also, please enable the "auto answering feature" for fsck:
/etc/default/rcS

Quote:
cat /etc/default/rcS
#
# /etc/default/rcS
#
# Default settings for the scripts in /etc/rcS.d/
#
# For information about these variables see the rcS(5) manual page.
#
# This file belongs to the "initscripts" package.

TMPTIME=0
SULOGIN=no
DELAYLOGIN=no
UTC=yes
VERBOSE=no
FSCKFIX=no
it is enough to change FSCKFIX=no => FSCKFIX=yes

Thursday, September 15, 2011

在Modoer2.0中更换为Google地图后修复“地图坐标不正确” 问题

在./data/cachefiles/item_field_1.php里,找“地图坐标不正确”

 4 =>
  array (
    'fieldid' => '5',
    'modelid' => '1',
    'tablename' => 'subject',
    'fieldname' => 'mappoint',
    'title' => '地图坐标',
    'unit' => '',
    'style' => '',
    'template' => '',
    'note' => '',
    'type' => 'mappoint',
    'listorder' => '4',
    'allownull' => '0',
    'enablesearch' => '0',
    'iscore' => '1',
    'isadminfield' => '0',
    'show_list' => '0',
    'show_detail' => '1',
    'regular' => '/[0-9a-z]+,[0-9a-z]+/i',
    'errmsg' => '地图坐标不正确',
    'datatype' => 'varchar(60)',
    'config' =>
    array (
      'default' => '',
      'size' => '30',
    ),
    'disable' => '0',
  ),


把
'regular' => '/[0-9a-z]+,[0-9a-z]+/i',
改成
'regular' => '/[\-\.0-9a-z]+,[\-\.0-9a-z]+/i',

Wednesday, August 24, 2011

gcc-linaro not found on OpenWRT

--2011-03-29 19:34:17--  http://downloads.openwrt.org/sources/gcc-linaro.tar.bz2
Resolving downloads.openwrt.org... 78.24.191.177
Connecting to downloads.openwrt.org|78.24.191.177|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2011-03-29 19:34:17 ERROR 404: Not Found.

Download failed.
similar to this
https://forum.openwrt.org/viewtopic.php?id=29329 
 
The reason is OpenWRT build system don't know what version of gcc linaro to use. 
Solve that by going into "make menuconfig" and enabling the following option:
[*] Advanced configuration options (for developers)--->
[*]   Toolchain Options  --->  
GCC compiler Version (gcc 4.5.x with Linaro enhancements)  --->
(X) gcc 4.5.x with Linaro enhancements 
 
 
 

Thursday, July 7, 2011

中国银行网上银行不能输入密码, 解决方法

进入中国银行网站后点击地址栏右边的兼容性视图按钮,再登录网上银行即可。
对于安装64位IE9的机器,在使用网上银行时要启动32位的IE9,因为有些银行(包括中国银行的安全插件是不支持64位的)。启动32位IE9 的方法是在“开始菜单/所有程序”里找。有两上IE,其中一个是Internet Explorer (64位), 另外一个没有注明64位的,即为32位IE9。

RISC-v emulator

Changes are based on https://risc-v-getting-started-guide.readthedocs.io/en/latest/linux-qemu.html For Ubuntu/Debian, in addition to sud...