ELF 原理及实验
0 概述长时间不接触容易忘记 ELF 文件的各个字段含义, 本篇做一个 ELF 文件的实践. 实验平台: x86_64 1 ELF file headers1.1 实验文件代码12345678910111213141516171819202122extern int *host_value_ptr;extern int host_add(int a, int b);static int local_offset(int x){ return x + 3;}static int del_offset(int x){ return x - 100;}int target_func(int x){ return host_add(local_offset(x), *host_value_ptr) + 7;}int unchanged_func(int x){ return x * 2;} 1.2 file header 解析给出 .o 文件,...
android_studio.md
1 记录由于 linux 上安装的软件越来越多, 为了防止后期遗忘, 甚至忘记安装步骤, 于是开启此系列. 包括软件使用过程中的问题我也会放在此处. 2 步骤官网下载. https://developer.android.com/studio?hl=zh-cn 然后拿到一个 android studio 的文件, 放到自己的工作目录. 其余的更多内容会被安装在. /home/<user>/Android/Sdk 3 卸载12345678# 本地的工作目录rm -rf /path/to/android-studiorm -rf ~/.config/Google/AndroidStudio*rm -rf ~/.local/share/google/android-studiorm -rf ~/.cache/Google/AndroidStudio*rm -rf ~/Android/Sdkrm -rf ~/.androidrm -rf ~/.gradle
wine
0 简介用来在 linux 运行 windows 程序. 1 安装步骤1234sudo dpkg --add-architecture i386sudo apt updatesudo apt install wine winetrickssudo ln -s /usr/share/doc/wine/examples/wine.desktop /usr/share/applications/ 2 使用2.1 安装/卸载软件12wine <app>wine uninstaller 3 卸载1234567891011wineserver -k# 推荐手动卸载一下wine uninstallersudo apt remove --purge wine wine32 wine64sudo apt updatesudo apt-get autocleansudo apt-get cleansudo apt autoremoverm -rf ~/.winerm -rf ~/.local/share/applications/wine*rm -rf...
waydroid
1 记录由于 linux 上安装的软件越来越多, 为了防止后期遗忘, 甚至忘记安装步骤, 于是开启此系列. 包括软件使用过程中的问题我也会放在此处. 2 步骤123curl -s https://repo.waydro.id | sudo bashsudo apt install curl ca-certificates -ysudo apt install waydroid -y 开启服务. 12sudo systemctl enable --now waydroid-containersudo systemctl status waydroid-container 网络好的可以直接安装. 1sudo waydroid init -s GAPPS...
Linux篇-iic实例
I2C1 用户态工具查看 i2c 设备 123456789101112$ i2cdetect Usage: i2cdetect -l | -F I2CBUS | [-ya] [-q|-r] I2CBUS [FIRST LAST]Detect I2C chips -l List installed buses -F BUS# List functionalities on this bus -y Disable interactive mode -a Force scanning of non-regular addresses -q Use smbus quick write commands for probing (default) -r Use smbus read byte commands for probing FIRST and LAST limit probing range 查看 I2C 接口. 123$ i2cdetect -li2c-2 i2c rk3x-i2c I2C...
Linux篇-gpio实例
GPIO 实例本节适配硬件才能观察 GPIO 的情况, 因此需要开发板. 1 基本模板首先改变原本的设备树. 12345678910111213141516171819 // LEDleds { compatible = "gpio-leds"; // status = "okay"; // we will test our driver status = "disabled"; heart_led { label = "run"; gpios = <&gpio1 RK_PB3 GPIO_ACTIVE_LOW>; linux,default-trigger = "heartbeat"; default-state = "off"; };}; my_managed_device { compatible =...
Linux篇-platform实例
platform实例1 基本模板1.1 传统方法在设备树出现之前, platform_device 也是需要手动去书写的. device 代码. 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566#include <linux/module.h>#include <linux/platform_device.h>#define DEV0_BASE_ADDR 0x10000000#define DEV1_BASE_ADDR 0x20000000#define RES_SIZE 0x100/* device 0 */static struct resource dev0_res[] = { [0] = { .start = DEV0_BASE_ADDR, .end = DEV0_BASE_ADDR...
Linux篇-设备树实例
设备树实例1 基本模板这里的设备树由 qemu 平台自动生成, 我们进行导出 加上 -machine virt,dumpdtb=qemu-riscv.dtb 导出.再转变成 dts: dtc -I dtb -O dts -o qemu-riscv.dts...
Linux篇-chrdev
字符设备驱动Notice: 这只是一个模板, 方便后续取用. kernel version: 6.18.5 1...
kspp for openRuyi
KSPP for openRuyi0 概述KSPP 全称 Kernel Self Protection Project, 是一个旨在提升Linux内核本身抵御漏洞利用能力的安全项目. 本篇旨在对比官方推荐的 config 文件与 openRuyi 下的 patch, config, spec 文件来勘察 riscv 配置的合理性. KSPP 项目说明了安全性加固内核的配置应该是什么样子的. Sometimes people ask the Kernel Self Protection Project what a secure set of build CONFIGs and runtime settings are. This is a brain-dump of the various options for a particularly paranoid system. 作者还表述到, 我们也可以通过 kernel-hardening-checker 项目来获取推荐配置. Another place to find recommended kernel...