Categories
linux

设置静态IP

一般通过命令nmtui设置

Categories
linux

香橙派 OPI.GPIO

一般GPIO初始化是执行

GPIO.setmode(mode) #来进行引脚定义初始化

GPIO.BOARD = 10
GPIO.BCM = 11
GPIO.SUNXI = 12 
GPIO.CUSTOM = 13  

其实只是一你骄傲的映射关系 没有真正执行任何代码

但是OPI.GPIO 对不同的香橙派版本 引脚定义不充分

CM4为例子

GPIO.setmode(GPIO.BOARD) #会少了很多引脚的映射

C:\Users\15699\AppData\Local\Programs\Python\Python312\Lib\site-packages\OPi\pin_mappings.py

 BOARD: {
        3: 12,
        5: 11,
        7: 6,
        8: 198,
        10: 199,
        11: 1,
        12: 7,
        13: 0,
        15: 3,
        16: 19,
        18: 18,
        19: 15,
        21: 16,
        22: 2,
        23: 14,
        24: 13,
        26: 10
    },

这时候要不更改这个库文件 按照GPIO.readall 补充所有引脚映射

要不执行 自定义引脚映射初始化

GPIO.setmode({
        3: 140,
        5: 141,
        7: 147,
        8: 25,
        10: 24,
        11: 118,
        12: 119,
        13: 128,
        15: 130,
        16: 131,
        18: 129,
        19: 138,
        21: 136,
        22: 132,
        23: 139,
        24: 134,
        26: 135,
        27: 32,
        28: 33,
        29: 133,
        31: 124,
        32: 144,
        33: 127,
        35: 120,
        36: 125,
        37: 123,
        38: 122,
        40: 121
    })

GPIO.getmode 
# 返回CUSTOM 自定义引脚映射
Categories
android

aosp 设置系统自启动脚本

安卓系统启动后会执行

/vendor/etc/init/hw/init.rk3588.rc

这个文件来源于

device/rockchip/rk3588/init.rk3588.rc

在on boot后添加执行脚本

on boot
    chmod 0666 /dev/mem
    chown root system /dev/mem

    chmod 0666 /dev/i2c-5
    chown root system /dev/i2c-5

以上是启动后 增加几个文件的读写权限

这几个文件跟GPIO控制有关系

Categories
android

orangepi5 android system compile log

第一需要使用ubuntu系统18以上 (最好18)x86 架构 不能是arm架构哈

准备好500G的系统硬盘 16g内存

文件系统确认是区分大小写的 (case sensitive 创建同名大小写差异的文件做测试)

文件系统可以构建硬链接 (ln 命令测试)

当缺少文件 都是因为解压时大小写冲突导致丢失文件和文件为硬链接当前文件系统不支持丢失文件

没有 mkbootfs 需要安装安卓打包工具 build-tools

google address

git clone https://android.googlesource.com/kernel/prebuilts/build-tools

gitee address

 git clone https://gitee.com/mirrors_android_googlesource/build-tools.git

然后path 添加上里面的bin目录

没有python2 添加上prebuild 路径下的python2 可执行目录

export PATH=/mnt/d/Android_12/prebuilts/python/linux-x86/2.7.5/bin:/mnt/d/build-tools/linux-x86/bin:$PATH

安装镜像工具

apt install mkbootimg 

安装其他依赖包

  apt install libssl-dev
  apt install openssl
  apt insatll libc++1
  apt install libelf-dev

kernal vdso 编译错误时

kernel-5.10\arch\arm64\kernel\vdso\gen_vdso_offsets.sh

LC_ALL=C
sed -n -e 's/^00*/0/' -e \
's/^\([0-9a-fA-F]*\) . VDSO_\([a-zA-Z0-9_]*\)$/\#define vdso_offset_\2\t0x\1/p'

更改为

LC_ALL=C
sed -n -e 's/^00*/0/' -e \
's/^\([0-9a-fA-F]*\) . VDSO_\([a-zA-Z0-9_]*\)$/\#define vdso_offset_\2 0x\1/p'

并且修改该文件为可执行的 删除目录下的编译产物vdso.so

提示找不到libcrypto-host.so

cp prebuilts/build-tools/linux-x86/lib64/*.so  /usr/lib

libncurses.so.5 not found (因为官方已经把libncurses-dev 取代 libncurses5-dev 所以需要重新安装一次)

sudo apt install libncurses5

官方要求安装依赖包

sudo apt-get update
sudo apt-get install -y git gnupg flex bison gperf build-essential 
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip
sudo apt-get install -y u-boot-tools

关闭安卓首页google 查询框

//关闭安卓首页google 搜索栏
packages/apps/Launcher3/res/layout/search_container_workspace.xml

packages/apps/Launcher3/src/com/android/launcher3/config/FeatureFlags.java.java

public static final boolean QSB_ON_FIRST_SCREEN = false;

//更改kernel 开机画面
\kernel-5.10\drivers\video\logo

更改该目录下的ppm文件 ppm文件可由bmp转换而来

//更改kernel 开机画面
\kernel-5.10\drivers\video\logo

更改该目录下的ppm文件 ppm文件可由bmp转换而来

//安卓开机动画会读取以后几个文件 frameworks\base\cmds\bootanimation\BootAnimation.cpp


static const char OEM_BOOTANIMATION_FILE[] = "/odm/media/bootanimation.zip";
static const char PRODUCT_BOOTANIMATION_DARK_FILE[] = "/product/media/bootanimation-dark.zip";
static const char PRODUCT_BOOTANIMATION_FILE[] = "/product/media/bootanimation.zip";
static const char SYSTEM_BOOTANIMATION_FILE[] = "/system/media/bootanimation.zip";
static const char APEX_BOOTANIMATION_FILE[] = "/apex/com.android.bootanimation/etc/bootanimation.zip";
static const char PRODUCT_ENCRYPTED_BOOTANIMATION_FILE[] = "/product/media/bootanimation-encrypted.zip";
static const char SYSTEM_ENCRYPTED_BOOTANIMATION_FILE[] = "/system/media/bootanimation-encrypted.zip";
static const char OEM_SHUTDOWNANIMATION_FILE[] = "/odm/media/shutdownanimation.zip";
static const char PRODUCT_SHUTDOWNANIMATION_FILE[] = "/product/media/shutdownanimation.zip";
static const char SYSTEM_SHUTDOWNANIMATION_FILE[] = "/system/media/shutdownanimation.zip";

static constexpr const char* PRODUCT_USERSPACE_REBOOT_ANIMATION_FILE = "/product/media/userspace-reboot.zip";
static constexpr const char* OEM_USERSPACE_REBOOT_ANIMATION_FILE = "/oem/media/userspace-reboot.zip";
static constexpr const char* SYSTEM_USERSPACE_REBOOT_ANIMATION_FILE = "/system/media/userspace-reboot.zip";

适配orangepi 5寸触摸屏

替换kernel-5.10/drivers/gpu/drm/panel/panel-innolux-afj101-ba2131.c

替换那个Android LOGO,直接替换frameworks/base/core/res/assets/images下面的图片
将开机的动画复制到device/rockchip/common/bootshutdown/bootanimation.zip。
这个MK其实是文件复制命令 把该文件复制到安卓系统目录供安卓调用

更新 香橙派5 用的是 bootanimation.ts

替换源码中的ts文件

路径

device/rockchip/common/bootvideo/bootvideo.mk

device/rockchip/common/bootvideo/bootanimation.ts

ffmpeg转TS文件

ffmpeg -i input.mp4 -c:v copy -c:a copy -bsf:v h264_mp4toannexb output.ts
ffmpeg -framerate 1 - start_number 0 -i %d.png -c:v libx264 -pix_fmt yuv420p output.mp4

替换默认壁纸
device\rockchip\rk3588\overlay\frameworks\base\core\res\res\drawable-nodpi\

device\rockchip\rk3588\overlay\frameworks\base\core\res\res\drawable-sw600dp-nodpi\

device\rockchip\rk3588\overlay\frameworks\base\core\res\res\drawable-sw720dp-nodpi\

用ROP主页图片当开机画面

切换默认中文输入法

mkdir device/rockchip/rk3588/rk3588s_s/preinstall_del

//该文件夹 存放预装单可手动删除的APK
//复制sogouInput.apk 到该目录


创建两个默认配置
修改
frameworks/base/packages/SettingsProvider/res/values/defaults.xml

 <string name="def_input_method" translatable="false">com.sohu.inputmethod.sogou/.SogouIME</string>

    <string name="enabled_input_method" translatable="false">com.sohu.inputmethod.sogou/.SogouIME:com.android.inputmethod.latin/.LatinIME</string>


修改
frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java

增加读取两个setting

            loadStringSetting(stmt, Settings.Secure.DEFAULT_INPUT_METHOD,
                        R.string.def_input_method);

            loadStringSetting(stmt, Settings.Secure.ENABLED_INPUT_METHODS,
                        R.string.enabled_input_method);


设置locale列表第一位
修改
build/target/product/languages_default.mk

//把zh_CN 放在第一位
PRODUCT_LOCALES := \
        zh_CN \

添加android properties 修改时区默认语言
修改device/rockchip/rk3588/device.mk
PRODUCT_PROPERTY_OVERRIDES += \
                persist.sys.timezone=Asia/Shanghai \
                persist.sys.language=zh \
                persist.sys.country=CN \
                ro.product.locale=zh-CN \
                ro.product.locale.language=zh \
                ro.product.locale.region=CN \
                ro.allow.mock.location=1

防止每次编译安卓都清除历史

./build.sh
214 注释 make installclean

编译前准备

export BOARD=orangepi5
export DUAL_LCD=true
export IMAGE_TYPE=cn
source build/envsetup.sh
lunch rk3588s_s-userdebug

lunch rk3588s_s-user

PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=12
TARGET_PRODUCT=rk3588s_s
TARGET_BUILD_VARIANT=user
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv8-a
TARGET_2ND_CPU_VARIANT=generic
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.15.0-94-generic-x86_64-Ubuntu-20.04.6-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=SQ3A.220705.003.A1
OUT_DIR=out

默认输出目录为out

全量编译

-A表示Android

-U表示uboot

-K表示Kernel

-u表示update.img

./build.sh -AUKu