ubuntu编译AOSP

系统环境: ubuntu 20.04 LTS

安装必要工具:

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip openjdk-8-jdk libtinfo-dev libncurses-dev libncurses5 libssl-dev

修改BaseTools路径:

cd bootable/bootloader/edk2
rm -rf Conf/BuildEnv.sh
unset EDK_TOOLS_PATH
./edksetup.sh BaseTools
cd -

开始编译吧:

source build/envsetup.sh
lunch xxx
make -j40

等等……

需要LLVM?

sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" 

如何新建自签名SSL证书

  1. 准备工作:
mkdir ca
cd ca
mkdir demoCA
mkdir demoCA/newcerts
touch demoCA/index.txt
echo "01" > demoCA/serial

2. 生成CA证书

openssl genrsa -des3 -out ca.key 2048

3. 生成CA公钥

openssl req -new -x509 -days 7305 -key ca.key -out ca.crt

4. 生成域名证书私钥

openssl genrsa -des3 -out *.njduck.com.pem 1024

5. 将域名私钥解密生成key

openssl rsa -in *.njduck.com.pem -out *.njduck.com.key

6. 生成证书请求

openssl req -new -key *.njduck.com.pem -out *.njduck.com.csr

7. 证书签名

openssl ca -policy policy_anything -days 1460 -cert ca.crt -keyfile ca.key\
    -in *.njduck.com.csr -out *.njduck.com.crt

CA证书生成后可以直接从第4步开始给其他域名生成证书

Excel小技巧

=IF(EXACT(WEEKDAY(A10,2),"1"),"一",IF(EXACT(WEEKDAY(A10,2),"2"),"二",IF(EXACT(WEEKDAY(A10,2),"3"),"三",IF(EXACT(WEEKDAY(A10,2),"4"),"四",IF(EXACT(WEEKDAY(A10,2),"5"),"五",IF(EXACT(WEEKDAY(A10,2),"6"),"六",IF(EXACT(WEEKDAY(A10,2),"7"),"日","")))))))

配置HBase单机版

  • 配置JAVA_HOME

编辑conf/hbase-env.sh,指定包含/bin/java的路径为JAVA_HOME

export JAVA_HOME=/usr
  • 编辑HBase主配置文件

conf/hbase-site.xml

<configuration>
  <property>
    <name>hbase.rootdir</name>
    <value>file:///home/ubuntu/hbase/hbase</value>
  </property>
  <property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/home/ubuntu/hbase/zookeeper</value>
  </property>
  <property>
    <name>hbase.unsafe.stream.capability.enforce</name>
    <value>false</value>
    <description>
      Controls whether HBase will check for stream capabilities (hflush/hsync).

      Disable this if you intend to run on LocalFileSystem, denoted by a rootdir
      with the 'file://' scheme, but be mindful of the NOTE below.

      WARNING: Setting this to false blinds you to potential data loss and
      inconsistent system state in the event of process and/or node failures. If
      HBase is complaining of an inability to use hsync or hflush it's most
      likely not a false positive.
    </description>
  </property>
</configuration>
  • 启动HBase

执行bin/start-hbase.sh

启用ssh的公钥连接,禁用密码连接

系统

ubuntu 16.04 64bit

步骤
  1. 服务器的~/目录新建文件夹.ssh,权限0700
  2. 上传公钥到服务器的~/.ssh/目录,重命名为authorized_keys,权限为0644
  3. 编辑/etc/ssh/sshd_config
  4. PubkeyAuthentication yes
    PasswordAuthentication no
  5. 重启服务器
  6. reboot
  7. 愉快的玩耍吧~
  8. ssh -i [PrivateKey] [root@]server

[LUA]做配置文件的一个简单例子

准备lua

新建一个config.lua文件,内容如下

--my config
MyConfigValue = 1234

准备C++

新建一个main.cpp文件,内容如下

#include<stdio.h>

extern "C"
{    
#include "lua.h"    
#include "lauxlib.h"    
#include "lualib.h"    
}    
   
void
ReadVariable(lua_State *L,int *myConfigValue)
{
    lua_getglobal(L,"MyConfigValue");
    
    if (!lua_isnumber(L,-1)) {
        luaL_error(L,"`MyConfigValue' should be a number\n");
    }
    
    *myConfigValue = (int)lua_tonumber(L,-1);
    printf("MyConfigValue is %d\n",*myConfigValue);
}
int main(int argc, char* argv[])    
{    
    if (argc != 2) {
        printf("param error!\n");    
        return 0;    
    }    
    
    char *filename = argv[1];    
    
    lua_State *L = luaL_newstate();    
    luaL_openlibs(L);  //新版本库添加的方法    
    if (luaL_loadfile(L,filename) || lua_pcall(L,0,0,0)) {
        luaL_error(L,"loadfile error! %s \n",lua_tostring(L,-1));    
    }    
    
    int myConfigValue=1;
    ReadVariable(L,&myConfigValue);
    return 0;  
}  

编译执行吧

$g++ main.cpp -llua -ldl
$./a.out config.lua