2013年12月15日 星期日

Tesseract on ubuntu

refer to:
https://tesseract-ocr.github.io/tessdoc/Command-Line-Usage.html

preinstall:
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ xenial main'
sudo apt update
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DE19EB17684BA42D
apt install cmake cmake-qt-gui cmake-curses-gui
apt install automake autoconf libtool pkg-config libcurl4-gnutls-dev libjpeg8-dev libpng12-dev libtiff5-dev

1. font database
git clone --recursive https://github.com/tesseract-ocr/tessdata_best

PPO AI algorithm on PyTorch

1. Algorithm
https://spinningup.openai.com/en/latest/algorithms/ppo.html
https://zhuanlan.zhihu.com/p/108034550

2. Pytorch python source
https://github.com/fatalfeel/PPO_Pytorch (with full comment)

2013年12月11日 星期三

How linux initramfs start and simulate

1. 
###after linux built
~/objs/linux-5.10.107/arch/arm64/kernel/vmlinux.lds
__initcall_start = 
.; 
KEEP(*(.initcallearly.init)) __initcall0_start = .;
KEEP(*(.initcall0.init)) KEEP(*(.initcall0s.init)) __initcall1_start = .;
KEEP(*(.initcall1.init)) KEEP(*(.initcall1s.init)) __initcall2_start = .;
KEEP(*(.initcall2.init)) KEEP(*(.initcall2s.init)) __initcall3_start = .;
KEEP(*(.initcall3.init)) KEEP(*(.initcall3s.init)) __initcall4_start = .;
KEEP(*(.initcall4.init)) KEEP(*(.initcall4s.init)) __initcall5_start = .;
KEEP(*(.initcall5.init)) KEEP(*(.initcall5s.init)) __initcallrootfs_start = .;
KEEP(*(.initcallrootfs.init)) KEEP(*(.initcallrootfss.init)) __initcall6_start = .;
KEEP(*(.initcall6.init)) KEEP(*(.initcall6s.init)) __initcall7_start = .;
KEEP(*(.initcall7.init)) KEEP(*(.initcall7s.init)) __initcall_end = .;

2013年12月7日 星期六

Slim yolov3 install step in pytorch

refer to https://arxiv.org/pdf/1907.11093.pdf
#clone ktian08-hyp branch not master branch
apt install git-coloa
run git-coloa
clone https://github.com/ultralytics/yolov3.git
actions
pull
enable rebase
origin/ktian08-hyp pull

TFTP upload to IPMI board

1. pc host
apt install tftpd-hpa
gedit /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/mnt/harddisk/upload"
TFTP_ADDRESS="192.168.59.228:69"
TFTP_OPTIONS="-c -l -s"

#-c: Allow new files to be created
#-l:  Run the server in standalone (listen) mode, rather than run from inetd.
#-s: Change  root  directory  on startup.

2013年12月3日 星期二

Install Nvidia cuda & python3.7/3.8 & Yolov3 in Pytorch

#######################################################################
#install nvidia driver + cuda 10.2 + cudnn 7.6.5
#######################################################################
1. remove old driver
sudo apt list --installed | grep cuda
sudo apt purge libcudnn7 libcudnn7-dev libcudnn7-doc
sudo rm -rf /usr/local/cuda-10.0

2. check gpu version and install driver
sudo lspci -v  #find VGA compatible controller

3. stop linux default driver if you are using
gedit /etc/modprobe.d/blacklist.conf
#necessary
blacklist nouveau
#option
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off

#terminal check
echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf

update-initramfs -u
reboot

2013年12月1日 星期日

Qt Widgets C++ building

refer to: 
https://www.cntofu.com/book/46/qt/ubuntubian_yi_an_zhuang_qt5__0__1.md
https://codertw.com/%E7%A8%8B%E5%BC%8F%E8%AA%9E%E8%A8%80/617555
https://blog.51cto.com/u_15295315/2997065
https://www.cnblogs.com/fengyaoyao/p/10549320.html

Preinstall:
sudo add-apt-repository ppa:levi-armstrong/qt-libraries-xenial
sudo apt update
sudo apt install bison build-essential flex gperf libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev libasound2-dev libatkmm-1.6-dev \
libbz2-dev libcap-dev libcups2-dev libdrm-dev \
libgl1-mesa-dev libglu1-mesa-dev libgl1-mesa-glx libfontconfig1-dev libfreetype6-dev \
libicu-dev libnss3-dev libpci-dev libpulse-dev libssl-dev libudev-dev \
libx11-dev libx11-xcb-dev libxcb-composite0 libxcb-composite0-dev libxcb-cursor-dev \
libxcb-cursor0 libxcb-damage0 libxcb-damage0-dev libxcb-dpms0 libxcb-dpms0-dev \
libxcb-dri2-0 libxcb-dri2-0-dev libxcb-dri3-0 libxcb-dri3-dev libxcb-ewmh-dev libxcb-ewmh2 \
libxcb-glx0 libxcb-glx0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-image0 libxcb-image0-dev \
libxcb-keysyms1 libxcb-keysyms1-dev libxcb-present-dev libxcb-present0 libxcb-randr0 \
libxcb-randr0-dev libxcb-record0 libxcb-record0-dev libxcb-render-util0 \
libxcb-render-util0-dev libxcb-render0 libxcb-render0-dev libxcb-res0 libxcb-res0-dev \
libxcb-screensaver0 libxcb-screensaver0-dev libxcb-shape0 libxcb-shape0-dev libxcb-shm0 \
libxcb-shm0-dev libxcb-sync-dev libxcb-sync-dev libxcb-sync1 libxcb-util-dev \
libxcb-util0-dev libxcb-util1 libxcb-xf86dri0 \
libxcb-xf86dri0-dev libxcb-xfixes0 libxcb-xfixes0-dev libxcb-xinerama0 \
libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xkb1 \
libxcb-xtest0 libxcb-xtest0-dev libxcb-xv0 libxcb-xv0-dev libxcb-xvmc0 libxcb-xvmc0-dev \
libxcb1 libxcb1-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxext-dev \
libxfixes-dev libxi-dev libxrandr-dev libxrender-dev libxslt1-dev libxss-dev \
libxtst-dev libgcrypt11-dev libsigc++-2.0-dev libgtk2.0-dev perl ruby
apt install qt5-default qt59creator
~~~run /opt/qt59/bin/qtcreator

Remote desktop multi-user connection

###########server###########
1. apt remove vino (another vnc sevrer)

2. apt install x11vnc

3. click -> application -> internet -> x11vnc server
port: 5900
File transfer: UltraVnc

Rtsp server for H264 / H265 / AAC

Refer to:
https://github.com/PHZ76/RtspServer
https://github.com/ImSjt/RtspServer
https://gitee.com/marcode/RtspServer-1
https://github.com/ChristianFeldmann/h264Bitstream
https://github.com/Dillon14281118/h265bitstream
https://github.com/BobCromwell/aac-stream-analyzer

Preinstall:
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ xenial main'
sudo apt update
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DE19EB17684BA42D
apt install cmake cmake-qt-gui cmake-curses-gui
apt install libavcodec-dev libavutil-dev libavformat-dev libswscale-dev libavdevice-dev libsdl1.2-dev

Android studio Eclipse jni C/C++ debug

Eclipse jni C/C++ debug provide breakpoint, watchpoint, watch value, memory value,
Arm register value, disassembly code.

Please refer this first :
http://fatalfeel.blogspot.com/2013/09/debug-android-jni-with-eclipse-gui-on.html

1. Install Ubuntu 16.04 x64 and openjdk 8
sudo apt install openjdk-8-jdk openjdk-8-jre
#check version
root@homelinux:~/CardView/Application/src/main# java -version
openjdk version "1.8.0_222"
root@homelinux:~/CardView/Application/src/main# javac -version
javac 1.8.0_222
root@homelinux:~/CardView/Application/src/main# javadoc -J-version
openjdk version "1.8.0_222"

2. Eclipse dependency
sudo apt install gtk2.0 libgtk2.0-dev

3. Android Studio 3.6.2 install to /opt/android-studio

Arduino Jtag Debug (Mega2560)

1. Prepare
#Hardware
Arduino Mega 2560
Atmel ICE
#Software
Atmel Studio 7 install
Arduino IDE install

2013年9月30日 星期一

Android Board HAL Led control

Ref.
http://www.linuxforu.com/2010/12/writing-your-first-linux-driver
http://www.tldp.org/LDP/lkmpg/2.6/html/lkmpg.html

http://bbs.witech.com.cn/forum.php?mod=viewthread&tid=46598&extra=page%3D1%26filter%3Dtypeid%26typeid%3D28%26typeid%3D28

1.
///set serial number on android
android2.3.4_32bit/system/core/init/init.c
//property_set("ro.serialno", serialno[0] ? serialno : "");
property_set("ro.serialno", "OK1ATV800006"); //by stone

2.
//find define mk
/xxxxxx/android2.3.4_32bit/build/core/core/envsetup.mk
TARGET_OUT := $(PRODUCT_OUT)/system
TARGET_OUT_SHARED_LIBRARIES:= $(TARGET_OUT)/lib

3.
//////////////HAL files reference///////////
C:\xxxxxx\android2.3.4_32bit\frameworks\base\services
C:\xxxxxx\android2.3.4_32bit\hardware\libhardware
C:\xxxxxx\android2.3_kernel_v1.01\arch\arm
C:\xxxxxx\android2.3_kernel_v1.01\drivers\char


OpenAL HRTF 3d sound on Linux & Android

source code download on 2016/06/25

https://github.com/kcat/openal-soft
also refer to
https://github.com/soundsrc/openal-soft

///////////////////////Ubuntu 14.04 linux system///////////////////////
1. preinstall
sudo apt-get install cmake
sudo apt-get install libsdl-sound1.2-dev

sudo add-apt-repository ppa:adrozdoff/ffmpeg-opti
sudo apt-get update
sudo apt-get install libavformat-ffmpeg-dev libavcodec-ffmpeg-dev libavutil-ffmpeg-dev libavfilter-ffmpeg-dev libswscale-ffmpeg-dev libswresample-ffmpeg-dev libpostproc-ffmpeg-dev

2013年9月29日 星期日

Build OK6041 environment

http://note.jhpeng.com/2013/01/sudo-apt-get-install-git-core-gnupg.html
http://e-xiao.blogspot.tw/2011/10/resolve-build-errors-for-android-234.html

1.
gedit /etc/init.d/rc.local
//add
mount /dev/sda3 /extdriver

add-apt-repository ppa:sun-java-community-team/sun-java6
apt-get update
apt-get install sun-java6-jdk

//remove ppa:sun-java-community-team/sun-java6 list, option
gedit /etc/apt/sources.list

arm gdb trace u-boot to start_kernel on i.mx6

1.
In Eclipse right click project
Debug As -> Debug Configurations -> GDB Hardware Debugging

2.
click Startup tab
uncheck the all items on startup page
add those lines under [Halt] box but do not check [Halt]
add-symbol-file /root/project_board/free_imx/out/matrix_io/uboot/u-boot 0x4FF04000
start debugging and trace code
(ps: in u-boot os keyin [bdinfo] show relocaddr = 0x4FF04000)

How to debug android linux kernel or driver by KGTP

Ref. http://code.google.com/p/kgtp/wiki/HOWTOCN

1. install pci serial port card (option install)

2. Vmware add hardware serial port (option install)

3. serial port assign com9 (option install)

Jtag Openocd Eclipse debug

OpenOCD debugging is the most efficient than KGDB.

1.
Seeedstudio Bus Blaster price is less than 40 US$ on Ebay. Very cheap.
bus blaster v3 or v3c or v4 or v4.1 connect to i.mx6dq jtag pings.(Vtg, Vcc disconnect)
Blaster      - I.Mx6dq
TRST         - TRSTn (Test access port reset)
TDI            - TDI
TMS          - TMS
TCK          - TCK
TDO          - TDO
TSRST      - nSRST (System reset)
GND         - GND

http://dangerousprototypes.com/docs/Bus_Blaster
http://www.mediafire.com/view/ozh1f11zx8s2g5s/BusBlaster_jtag.png#
http://www.mediafire.com/view/9tbesr2g5j1bp82/IMX6dq_jtag.png#

2. arm-eabi-gdb dependency lib
add-apt-repository ppa:fkrull/deadsnakes
apt-get update
apt-get install python2.6 python2.6-dev

3. openocd pre-install lib
apt-get update
apt-get install libftdi-dev
apt-get install libusb-1.0-0-dev
apt-get install texinfo
apt-get install automake autoconf libtool pkg-config

4.
http://sourceforge.net/projects/openocd/files/openocd/0.9.0
download file openocd-0.9.0.tar.gz
extract to
[~home]/openocd-0.9.0
or
open terminal window -> git clone git://git.code.sf.net/p/openocd/code

2013年9月28日 星期六

Bus Blaster flash to Swd mode in OpenOcd

Refer to
https://yeah.nah.nz/embedded/busblaster-kt-link
https://bgamari.github.io/posts/2014-08-23-swd-with-busblaster-and-openocd.html
http://bgamari.github.io/posts/2013-07-24-flashing-busblaster-cpld-with-openocd.html
https://discuss.96boards.org/t/sdw-debugging-carbon-stm32-using-bus-blaster-v3/958
https://gist.github.com/natevw/14d1f1fe669ec6e201c5

1.
~circuit
Bus Blaster SWD connect to Target
TCK ──────────────────────── SWCK
TMS ──────────────────────── SWDAT
GND ──────────────────────── GND

Using Bus Blaster V3C or V4.1a
http://dangerousprototypes.com/docs/Bus_Blaster_v3_design_overview
http://dangerousprototypes.com/docs/Bus_Blaster_v4_design_overview

2.
~Preinstall openocd 
https://github.com/fatalfeel/openocd_integrated

GitServer GitWeb GitLab on Bitnami

1. download GitLab 7.2.1-1
https://bitnami.com/stack/gitlab/installer

2. install open ssh
apt-get install openssh-server
http://bojack.pixnet.net/blog/post/29040829-%E3%80%90linux%E3%80%91%E5%9C%A8-ubuntu-%E4%B8%8A%E5%AE%89%E8%A3%9D-ssh-server

2013年9月27日 星期五

Install ubuntu 14.04/16.04/20.04 and above looks like 10.04

1. update sabertooth z87 bios to latest version in boot setup menu

2. install ubuntu 12.04.5 or 14.04.2
http://releases.ubuntu.com/12.04/
http://old-releases.ubuntu.com/releases/14.04.2/

ubuntu 14.04.2 linux kernel version is 3.16.0-xxx

3. burn iso file in DVD

4. setting DVD first boot in motherboard bios

5. create primary partition assign mount / ([/] = root directory)
My PC: 1Tb Hard disk and 8gb physical ram
size         : 496gb
type         : Primary
use as      : Ext4
Mount point : /

2013年9月26日 星期四

Vivante 3d gc2000 work flow

///////////////////////////create device node /dev/galcore/////////////////////////////
$home/myandroid/kernel_imx/drivers/mxc/gpu-viv/Kbuild
MODULE_NAME ?= galcore
/* define node name*/
$home/myandroid/kernel_imx/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_linux.h
define DEVICE_NAME "galcore"

$home/myandroid/kernel_imx/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_probe.c
drv_init call
ret = register_chrdev(major, DEVICE_NAME, &driver_fops);

boot.img to image (binary vmlinux)

1. download image unpack tools
http://www.mediafire.com/file/2zcwc74bzjxej4b/android_bootimg_tools.tar.gz

2.
mkdir ./zimage
./unpackbootimg -i boot.img -o ./zimage

2013年9月24日 星期二

BaudRate setting for u-boot and kernel on i.mx6

gedit /root/project_board/free_imx/myandroid/bootable/bootloader/uboot-imx/include/configs/mx6_matrix_common.h
//#define CONFIG_BAUDRATE               115200 //by stone
#define CONFIG_BAUDRATE                  460800

gedit /root/project_board/free_imx/myandroid/bootable/bootloader/uboot-imx/include/config_fallbacks.h
//#define CONFIG_SYS_BAUDRATE_TABLE    { 9600, 19200, 38400, 57600, 115200 } //by stone
#define CONFIG_SYS_BAUDRATE_TABLE    { 9600, 19200, 38400, 57600, 115200, 230400, 460800 }

2013年9月22日 星期日

Task queue and ini

1.
using pthread_mutex_t for lock
using pthread_cond_t for signal
using std::vector for queue
using singleton in class
static TaskQueue*   Get();
static void         Free();

2. task queue source clip
int TaskQueue::Process(int type, NODE_YUV* node_yuv)
{
    int ret; //each thread own it's local variable address
    pthread_mutex_lock(&m_process_lock);

    switch(type)
    {
        case 0: //read first node
            if ( ret = m_vqueue.size() > 0 )
            {
                memcpy(node_yuv, &(*m_vqueue.begin()), sizeof(NODE_YUV));
                m_vqueue.erase(m_vqueue.begin());
            }
            break;

        case 1: //save last node
            m_vqueue.push_back(*node_yuv);
            break;
    }

    pthread_mutex_unlock(&m_process_lock);

    return ret;
}

void TaskQueue::TaskThreadLoop()
{
    int         ret;
    NODE_YUV    node_yuv;

    while(m_thread_work)
    {
        ret = Process(0, &node_yuv);
        if( ret )
        {
            //ur work start

            //ur work end
           
            printf("free %p size=%d\n", node_yuv.buf, node_yuv.size);
            free(node_yuv.buf);
        }
        else
        {
            //wait signal when queue empty
            pthread_mutex_lock(&m_taskqueue_work_lock);
            pthread_cond_wait(&m_taskqueue_work_cond, &m_taskqueue_work_lock);
            pthread_mutex_unlock(&m_taskqueue_work_lock);
        }
    }
}

3.
using std::ifstream for reading
using std::ofstream for writing

4. ini source clip
std::ifstream   inifile;
inifile.open(m_filepath, std::ifstream::in);

std::ofstream   inifile;
inifile.open(m_filepath, std::ofstream::out | std::ofstream::trunc);

source download:
https://www.mediafire.com/file/pry0z0x8pdsnm29/taskqueueini.tar.gz

Arm MCR command explain

MCR p15,0,<Rd>,<CRn>,<CRm>,<Opcode_2>
<CRm>和<Opcode_2>兩者組合決定對協處理器寄存器進行所需要的操作,如果沒有指定則<CRm>為C0,<Opcode_2>為0, 否則導致不可預知的結果.

Build web site and get free server Firebase

1.
Download  web server Nginx
http://nginx.org

this local server is for html response

2.
Register Firebase remote server
https://firebase.google.com

Firebase can create chat and webrtc server free
Peer to peer authenticate through the Firebase remote server.

3.
Go to Firebase control panel
https://console.firebase.google.com

Uart to LinBus on Android

Ref.
1. https://rtime.felk.cvut.cz/can/lin-bus/
    for Uart to linbus

2. https://github.com/linux-can/can-utils
    for slcan_attach modify

3. https://github.com/karelzak/util-linux
    for ldattach

4. https://github.com/shemminger/iproute2
    for ip link set up in C code
  
///// Linux Kernel /////
1. Copy sllin.c to kernel_imx/drivers/net/can

2. gedit kernel_imx/include/uapi/linux/tty.h
//add
#define N_SLLIN            25

Client HID of Bluez for Bluetooth Qualification

Download client HID sample code
http://anselm.hoffmeister.be/computer/hidclient/hidclient-20120728.tar.bz2

HID report descriptor sample
http://www.instructables.com/id/USB-Wii-Classic-Controller/step13/Bonus-Keyboard-and-Mouse

Register record to SDP sample
http://blog.csdn.net/huipengzhao/article/details/18268201

2013年9月21日 星期六

Eclipse debug Android framework and service

To prepare Eclipse:
http://fatalfeel.blogspot.tw/2013/09/eclipse-setting-for-ubuntu-imx6-android.html

//////////////////////////////////////////////
////////Debug surfaceflinger////////
//////////////////////////////////////////////
1.
gedit ~/OK8MM-android-source/frameworks/native/services/surfaceflinger/Android.mk
//add
LOCAL_CFLAGS += -O0 -g
LOCAL_CPPFLAGS += -O0 -g
LOCAL_STRIP_MODULE := false

2013年9月20日 星期五

Python debug with Eclipse ide

ref. https://kodi.wiki/view/HOW-TO:Debug_Python_Scripts_with_Eclipse

1.
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk

2. (if you have another version hava do this)
update-alternatives --config java
update-alternatives --config javac
update-alternatives --config javadoc

java -version
javac -version
javadoc -J-version

Build Eclipse debug environment for Android on Ubuntu

//////////////Install OpenJdk 7.0
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-7-jdk

update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-6-oracle/jre/bin/java 1100
update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1101
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-6-oracle/bin/javac 1100
update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-7-openjdk-amd64/bin/javac 1101
update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/java-6-oracle/bin/javadoc 1100
update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/java-7-openjdk-amd64/bin/javadoc 1101

update-alternatives --config java
update-alternatives --config javac
update-alternatives --config javadoc
or
update-alternatives --set java /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
update-alternatives --set javac /usr/lib/jvm/java-7-openjdk-amd64/bin/javac
update-alternatives --set javadoc /usr/lib/jvm/java-7-openjdk-amd64/bin/javadoc

//check version
java -version
javac -version
javadoc -J-version

Using arm gdb to find crash line of source file

1.
Make sure in default config
#CONFIG_ARM_UNWIND is not set
CONFIG_DEBUG_INFO=y
CONFIG_FRAME_POINTER=y
CONFIG_FRAME_POINTER depend on follows
CONFIG_CC_OPTIMIZE_FOR_SIZE=n
CONFIG_HAVE_FUNCTION_TRACER=y
CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
CONFIG_HAVE_DYNAMIC_FTRACE=y
CONFIG_TRACING_SUPPORT=y
CONFIG_FTRACE=y
CONFIG_FUNCTION_TRACER=y
CONFIG_DYNAMIC_FTRACE=y

2.check structure~myandroid/kernel_imx/arch/arm/include/uapi/asm/ptrace.h
struct pt_regs
{
  long uregs[18];
};

#define ARM_pc uregs[15]
#define ARM_lr uregs[14]

Start another process independent in linux

Android startup app from init.rc

1. facerecognition.sh
#!/system/bin/sh /system/bin/am start -n com.luxand.facerecognition/com.luxand.facerecognition.MainActivity

2. topeet_6dq.mk
gedit /mnt/ssd/iTOP-iMX6_android4.4.2/device/fsl/imx6/topeet_6dq.mk
#add
PRODUCT_COPY_FILES += \
device/fsl/matrix_io/etc/facerecognition.sh:system/etc/facerecognition.sh

Git2 lib for Win32 and Linux

///////////Win32/////////////
1. git2 source
https://github.com/libgit2/libgit2
Revision: eb5f03461fbcaa3fef8e63d1b0f7c682708fadd2 / Date: 2014/7/11 下午 06:22:48
installed

2. download cmake
http://www.cmake.org/cmake/resources/software.html
installed

3. install zlib - Complete package, except sources
http://gnuwin32.sourceforge.net/packages/zlib.htm
installed

2013年9月19日 星期四

Selinux from user-space to kernel

//build in debug mode
modify $home/myandroid/system/core/init/property_service.h
int property_get(const char *name, char *value)
{
    /*size_t value_len = __builtin_object_size(value, 0);
    if (value_len != PROP_VALUE_MAX)
        __property_get_size_error();*/

    return __property_get(name, value);
}

$home/myandroid/external/libselinux/src/avc.c
int avc_has_perm_noaudit(...)
{
...
...

Android App communication through binder to user-space (IPC)

Ref.
http://wangkuiwu.github.io/2014/09/03/Binder-ServiceManager-Daemon/

[The example is a system app send message through binder to mediaserver audio]
Target:
1.
external/sepolicy/system_app.te

type system_app, domain;
app_domain(system_app)
net_domain(system_app)
### begin issue: ###
binder_use(system_app)
binder_call(system_app, binderservicedomain)
binder_call(system_app, appdomain)
### end issue: ###
binder_service(system_app)

Install libgtk2 and libwxgtk3 in Ubuntu

1. install gtk
download libglib2.0-dev deb
https://ftp.nsysu.edu.tw/Ubuntu/ubuntu/pool/main/g/glib2.0

gdebi ./libglib2.0-dev_2.40.0-2_amd64.deb

2013年9月18日 星期三

Eclipse debug Android jni c/c++ of system app on Ubuntu

To prepare Eclipse:
https://fatalfeel.blogspot.tw/2013/09/build-eclipse-debug-environment-for.html
//////////////////////////////////////////////
Debug LinbusConfig App
//////////////////////////////////////////////
1.
~myandroid/frameworks/base/cmds/app_process/Android.mk
LOCAL_PATH:= $(call my-dir)
.
.
LOCAL_MODULE:= app_process
.
.
LOCAL_CFLAGS                := -O1 -g
LOCAL_CPPFLAGS             := -O1 -g
LOCAL_STRIP_MODULE    := false
include $(BUILD_EXECUTABLE)

Eclipse debug Android jni c/c++ of App on NDK R13

Include NDK R13 Method
////////////////eclipse setting//////////////////
http://www.eclipse.org/downloads/packages/release/Kepler/SR2
Eclipse Standard 4.3.2 -> linux 64bits
install eclipse-standard-kepler-SR2-linux-gtk-x86_64.tar.gz
extract to /opt/eclipse
chmod 755 -R /opt/eclipse

gedit /opt/eclipse.ini
-XX:PermSize=64m
-XX:MaxPermSize=256m
-Xms128m
-Xmx4096m

Solve Ubuntu 12.04/14.04 can not login to desktop

Reason why is lightdm or ubuntu-desktop damage

1. install gdm
after startup press ctrl+alt+F1 and login
apt-get -f install gdm
dpkg-reconfigure gdm  -> select gdm
reboot

2.
After startup
gdm simple mode login
open terminal
(If terminal all black or all white then setting forground color
Ternimal -> 編輯 -> 設定組合偏好設定 -> 顏色 -> 文字顏色 -> 白色)

Cross platform Secs/Gem open source

////////////////////////////////////////////////
///////////Project Download
////////////////////////////////////////////////
http://www.mediafire.com/file/khpjkq4fgssh3yp/GemHsms2018.zip

1.This project can build on VC++ on Win32 and Eclipse CDT on Linux.
2.Need preinstall ACE Wrappers and Xerces
3.Memory leak fixed
4.File secs.xsd grammar fixed

2013年9月16日 星期一

Openal 3D sound for tinyalsa android sound

Openal tinyalsa for android 6.0 fit for all android sound stream
It's for android low level sound stream. Processing After android Audioflinger.

1.
tinyalsa put in ~myandroid/external/tinyalsa

2.
OpenalConfig put in ~myandroid/packages/apps

3.
add this line in system_app.te
allow system_app default_prop:property_service set;

add this line in mediaserver.te
allow mediaserver default_prop:property_service set;

make sure remove this line in all *.te
neverallow { ... -system_app } default_prop:property_service set;

download:
http://www.mediafire.com/file/w8hh29ck0apnep2/tinyalsa_openal.tar.gz

Building 3d game Doom1 on Ubuntu 16.04

1.
apt-get install freedoom

2.
wget https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.0.18.tar.gz
#mirror site https://github.com/libsdl-org/SDL/tags
tar -xvf ./release-2.0.18.tar.gz
cd SDL-release-2.0.18
./configure --prefix=/usr
make -j8 && make install

3.
rm -f /usr/lib/x86_64-linux-gnu/libSDL2-*
cp -fP /usr/lib/libSDL2* /usr/lib/x86_64-linux-gnu

HelloWorld cross compile on Mingw64

#install mingw64
apt install gcc-mingw-w64

#install wine
ubuntu 18.04
apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main'
ubuntu 16.04
apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main'

apt update
apt install --install-recommends winehq-stable

2013年9月15日 星期日

KdeSvn (Gui Svn) in ubuntu 12.04/14.04

KdeSvn was written by C++ good and fast~~~

Download kdesvn-master.zip
https://github.com/KDE/kdesvn

apt-get install cmake
apt-get install kdelibs5-dev kdelibs5-plugins
apt-get install libapr1-dev libaprutil1-dev
apt-get install libsvn-dev
apt-get install oxygen-icon-theme

2013年9月14日 星期六

Android camera yuv to rgb rgba with arm neon

///
///n21 to rgb
///
static uint8x8_t const loaduv(unsigned char const* uv)
{
   return vld1_u8(uv);
}

static void store_pixel_block(unsigned char* dst, uint8x8x3_t& pblock, uint8x8_t const& r, uint8x8_t const& g, uint8x8_t const& b)
{
   pblock.val[0] = r;
   pblock.val[1] = g;
   pblock.val[2] = b;
   vst3_u8(dst, pblock);
}