May 27, 2015

ath9k create multiple interfaces

  • To create/delete virtual interfaces:
    iw dev wlan0 interface add [virtual-sta-name] type station
    iw dev wlan0 interface add [virtual-ap-name] type __ap
    ip link set [interface-name] address [unique-mac-addr]
  • To delete virtual interface:
    iw dev [dev-name] del
  • use iw to check wlan device status

    $ cat /proc/net/wireless 
    Inter-| sta-|   Quality        |   Discarded packets               | Missed | WE
     face | tus | link level noise |  nwid  crypt   frag  retry   misc | beacon | 22
     wlan0: 0000   56.  -54.  -256        0      0      0      0      0        0
    
    
    
    
    OR
    
    
    $ iw dev wlan0 link
    Connected to 00:10:7A:93:AE:BF (on wlan0)
        SSID: SECRETSSID
        freq: 2462
        RX: 89045514 bytes (194863 packets)
        TX: 34783321 bytes (164504 packets)
        signal: -54 dBm
        tx bitrate: 48.0 MBit/s

    May 26, 2015

    openwrt unbind led gpios

    # Turn off the LEDs
    root@OpenWrt:/# echo "leds-gpio" > /sys/bus/platform/drivers/leds-gpio/unbind
    root@OpenWrt:/# cat /sys/kernel/debug/gpio
    GPIOs 0-21, ar2315-gpio:
    gpio-0   (sysfs               ) in  lo
    gpio-5   (reset               ) in  hi
    gpio-6   (sysfs               ) in  lo

    Now you can use gpio export (i.e echo 11 > /sys/class/gpio/export), and change 'direction' and 'value'  of the gpio to directly control it.

    use time to test multiple commans

    /usr/bin/time /bin/sh -c 'ls;pwd;ls'

    May 20, 2015

    cross compile openJDK for ARM

    Source: http://mail.openjdk.java.net/pipermail/zero-dev/2014-December/000538.html

    when I cross-compile OpenJDK 9 for ARM32 I pass the following configure 
    options
    
    configure
    # these options tell openjdk to do a cross compile build.
    --build=x86_64-unknown-linux-gnu
    --host=arm-buildroot-linux-gnueabi
    --target=arm-buildroot-linux-gnueabi
    
    # these two options enable zero
    --with-jvm-interpreter=cpp
    --with-jvm-variants=zero
    
    # specific options to make the build find the X and freetype headers and 
    librarys found on the ARM32 root filesystem.
    --disable-freetype-bundling
    --with-freetype-include=/home/xranby/rpi-buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/include/freetype2
    --with-freetype-lib=/home/xranby/rpi-buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/lib
    --with-freetype=/home/xranby/rpi-buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/
    --with-x=/home/xranby/rpi-buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/include
    
    # the sysroot shall point to the ARM32 root file system, the build will 
    use librarys inside the sys root during linking native libraries.
    --with-sys-root=/home/xranby/rpi-buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot
    # The tools dir contains binarys to run on the host x86 system, you may 
    point this to your system root dir /
    # in my case the tools i use have been compiled by buildroot thus I use 
    the buildroot tools dir.
    --with-tools-dir=/home/xranby/rpi-buildroot/output/host
    # OpenJDK 9 require OpenJDK 8, i point with boot jdk to an OpenJDK 8 
    image that can be run on the host x86 system.
    --with-boot-jdk=/home/xranby/images-jdk8/j2sdk-image/
    
    # some parts of the openjdk build still expect that the cross compile 
    tools are found in the system PATH
    # on my system i have to explicitly tell where the tools are located 
    because my cross compile toolchain is not found on the path.
    # i use gcc to do the linking instead of ld because the openjdk build 
    passes -Xlinker -z
    OBJCOPY=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-objcopy
    STRIP=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-strip
    CPP=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-cpp
    CXX=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-g++
    CC=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-gcc
    LD=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-gcc
    CPP_FLAGS=-lstdc++
    CXX_FLAGS=-lstdc++
    
    
    when running make i pass the following options to make
    # BUILD_CC and BUILD_LD shall point to host x86 executables.
    BUILD_CC=gcc
    BUILD_LD=gcc
    OBJCOPY=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-objcopy
    STRIP=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-strip
    CPP=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-cpp
    CXX=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-g++
    CC=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-gcc
    LD=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-gcc
    #and finally the target, this will build compact profiles, jre and jdk 
    images.
    all images profiles CONF=linux-arm-normal-zero-release
    
    
    I have automated these configure and make options for openjdk 9 into 
    buildroot build scripts
    https://github.com/xranby/rpi-buildroot/tree/openjdk
    
    >
    > I've done Zero builds before but have never used OpenJDK's cross-compile
    > feature to build it on ARMv7. There is an Arm32 bit JIT in IcedTea[1],
    > but I don't know if that can be cross-compiled.
    
    If you cross compile icedtea then you need to make sure that the 
    bytecode generator tool is compiled by the host x86 toolchain.
    openembedded meta-java contains buildscripts that can cross compile the 
    Arm32 JIT found in IcedTea.
    https://github.com/woglinde/meta-java
    
    Cheers
    Xerxes

    May 6, 2015

    hg change history

    hg rebase, hg histedit, hg graft, hg strip, hg strip --keep, and hg commit --amend.