windows10 WSL setup
win10 安装 wsl2
必须运行 Windows 10 版本 2004 及更高版本(内部版本 19041 及更高版本)或 Windows 11。
→ 我的电脑win10已经更新到最新,应该没问题。
必须运行 Windows 10 版本 2004 及更高版本(内部版本 19041 及更高版本)或 Windows 11。
→ 我的电脑win10已经更新到最新,应该没问题。
编译环境:黑芝麻 Linux23 Docker 开发环境,已经默认配置了交叉编译环境。
wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz
tar -xzvf openssl-1.1.1k.tar.gz
cd openssl-1.1.1k
准备目标文件安装目录:
mkdir _INSTALL
查看帮助手册:
root@028337952dd7:/home/misc/openssl-1.1.1k# ./Configure
Usage: Configure [no-<cipher> ...] [enable-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-egd] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--config=FILE] os/compiler[:flags]
pick os/compiler from:
BS2000-OSD BSD-generic32 BSD-generic64 BSD-ia64 BSD-sparc64 BSD-sparcv8
BSD-x86 BSD-x86-elf BSD-x86_64 Cygwin Cygwin-i386 Cygwin-i486 Cygwin-i586
Cygwin-i686 Cygwin-x86 Cygwin-x86_64 DJGPP MPE/iX-gcc UEFI UWIN VC-CE VC-WIN32
VC-WIN32-ARM VC-WIN32-ONECORE VC-WIN64-ARM VC-WIN64A VC-WIN64A-ONECORE
VC-WIN64A-masm VC-WIN64I aix-cc aix-gcc aix64-cc aix64-gcc android-arm
android-arm64 android-armeabi android-mips android-mips64 android-x86
android-x86_64 android64 android64-aarch64 android64-mips64 android64-x86_64
bsdi-elf-gcc cc darwin-i386-cc darwin-ppc-cc darwin64-arm64-cc darwin64-ppc-cc
darwin64-x86_64-cc gcc haiku-x86 haiku-x86_64 hpux-ia64-cc hpux-ia64-gcc
hpux-parisc-cc hpux-parisc-gcc hpux-parisc1_1-cc hpux-parisc1_1-gcc
hpux64-ia64-cc hpux64-ia64-gcc hpux64-parisc2-cc hpux64-parisc2-gcc hurd-x86
ios-cross ios-xcrun ios64-cross ios64-xcrun iossimulator-xcrun iphoneos-cross
irix-mips3-cc irix-mips3-gcc irix64-mips4-cc irix64-mips4-gcc linux-aarch64
linux-alpha-gcc linux-aout linux-arm64ilp32 linux-armv4 linux-c64xplus
linux-elf linux-generic32 linux-generic64 linux-ia64 linux-mips32 linux-mips64
linux-ppc linux-ppc64 linux-ppc64le linux-sparcv8 linux-sparcv9 linux-x32
linux-x86 linux-x86-clang linux-x86_64 linux-x86_64-clang linux32-s390x
linux64-mips64 linux64-s390x linux64-sparcv9 mingw mingw64 nextstep
nextstep3.3 sco5-cc sco5-gcc solaris-sparcv7-cc solaris-sparcv7-gcc
solaris-sparcv8-cc solaris-sparcv8-gcc solaris-sparcv9-cc solaris-sparcv9-gcc
solaris-x86-gcc solaris64-sparcv9-cc solaris64-sparcv9-gcc solaris64-x86_64-cc
solaris64-x86_64-gcc tru64-alpha-cc tru64-alpha-gcc uClinux-dist
uClinux-dist64 unixware-2.0 unixware-2.1 unixware-7 unixware-7-gcc vms-alpha
vms-alpha-p32 vms-alpha-p64 vms-ia64 vms-ia64-p32 vms-ia64-p64 vos-gcc
vxworks-mips vxworks-ppc405 vxworks-ppc60x vxworks-ppc750 vxworks-ppc750-debug
vxworks-ppc860 vxworks-ppcgen vxworks-simlinux
NOTE: If in doubt, on Unix-ish systems use './config'.
上面提示如果编译 Unix-ish x86 平台目标文件,直接使用 ./config
HELLO@WORLD:~# i2cdetect
Error: No i2c-bus specified!
Usage: i2cdetect [-y] [-a] [-q|-r] I2CBUS [FIRST LAST]
i2cdetect -F I2CBUS
i2cdetect -l
I2CBUS is an integer or an I2C bus name
If provided, FIRST and LAST limit the probing range.
# I2CBUS: 0 1 2 ...
# Notice: -r 参数很重要,不带 -r 参数有些设备探测不到
i2cdetect -y -r <I2CBUS>
i2cget / i2cset
HELLO@WORLD:~# i2cget
Usage: i2cget [-f] [-y] I2CBUS CHIP-ADDRESS [DATA-ADDRESS [MODE]]
I2CBUS is an integer or an I2C bus name
ADDRESS is an integer (0x03 - 0x77)
MODE is one of:
b (read byte data, default)
w (read word data)
c (write byte/read byte)
Append p for SMBus PEC
# SLAVE_ADDRESS: 使用i2cdetect 出来的结果
i2cget -y -f <I2CBUS> <SLAVE_ADDRESS> <REG>
HELLO@WORLD:~# i2cset
Usage: i2cset [-f] [-y] [-m MASK] [-r] I2CBUS CHIP-ADDRESS DATA-ADDRESS [VALUE] ... [MODE]
I2CBUS is an integer or an I2C bus name
ADDRESS is an integer (0x03 - 0x77)
MODE is one of:
c (byte, no value)
b (byte data, default)
w (word data)
i (I2C block data)
s (SMBus block data)
Append p for SMBus PEC
i2cset -y -f <I2CBUS> <SLAVE_ADDRESS> <REG> <VALUE>
i2ctransfer
root@J3Pilot-B:~# i2ctransfer
Usage: i2ctransfer [-f] [-y] [-v] [-V] I2CBUS DESC [DATA] [DESC [DATA]]...
I2CBUS is an integer or an I2C bus name
DESC describes the transfer in the form: {r|w}LENGTH[@address]
1) read/write-flag 2) LENGTH (range 0-65535) 3) I2C address (use last one if omitted)
DATA are LENGTH bytes for a write message. They can be shortened by a suffix:
= (keep value constant until LENGTH)
+ (increase value by 1 until LENGTH)
- (decrease value by 1 until LENGTH)
p (use pseudo random generator until LENGTH with value as seed)
Example (bus 0, read 8 byte at offset 0x64 from EEPROM at 0x50):
# i2ctransfer 0 w1@0x50 0x64 r8
Example (same EEPROM, at offset 0x42 write 0xff 0xfe ... 0xf0):
# i2ctransfer 0 w17@0x50 0x42 0xff-
# W3 写三个参数 16bit 寄存器 (2 Bytes)+ value(1 Byte)
# i2c bus 0
# slave address 0x36
i2ctransfer -y -f 0 w3@0x33 0x3B 0x9D 0x01
# w2 (16bit寄存器)写两个参数 0x4F 0x0C 寄存器(0x4F0C)到 0x36 slave address
# i2c bus 总线 0
# 读取 i2c 总线 0 的 slave address 为 0x36 的设备的寄存器 0x4F0C, 读一个 char
# 0x36 是 ovx3c 的 slave address (7bit i2c address)
i2ctransfer -y -f 0 w2@0x36 0x4F 0x0C r1
HELLO@WORLD:~# i2cdump
Error: No i2c-bus specified!
Usage: i2cdump [-f] [-y] [-r first-last] I2CBUS ADDRESS [MODE [BANK [BANKREG]]]
I2CBUS is an integer or an I2C bus name
ADDRESS is an integer (0x03 - 0x77)
MODE is one of:
b (byte, default)
w (word)
W (word on even register addresses)
s (SMBus block)
i (I2C block)
c (consecutive byte)
Append p for SMBus PEC
i2cdump -f -y <I2CBUS> <SLAVE_ADDRESS>
测试之前可以使用 free -m
查看内存使用情况。
» free
total used free shared buff/cache available
Mem: 16193884 1268028 13921020 6528 1004836 14587148
Swap: 4194304 0 4194304
» free -m
total used free shared buff/cache available
Mem: 15814 1231 13598 6 984 14252
根据 available 至设置 DDR 压测内存大小。
stressapptest - stress test application for simulating high load situations
tar xvf e2fsprogs-1.42.8.tar.gz
cd e2fsprogs-1.42.8
mkdir build
cd build/
../configure
make
sudo make install
问题:
ubuntu20.04 编译报错 undefined reference to 'makedev'
解决方法:
vim <path-to-e2fsprogs-1.42.8>/lib/blkid/devname.c
添加头文件 #include <sys/sysmacros.h
sudo apt install python2.7
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
sudo python2.7 get-pip.py
pip2 install simplejson
win10 vscode + remote-ssh + virtualbox (ubuntu 20.04)
ssh-keygen.exe -t rsa
然后一路回车安装 ssh server: sudo apt install openssh-server
//localhost:1313/
glibc-2.35 更新需要同步用新版本的交叉编译器,这里直接在 Linaro 官网
下载
了最新的 gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf
export PATH="/code/gcc-linaro-7.5.0-2019.12-x86_64_armlinux-gnueabihf/bin":$PATH
export CROSS_COMPILE=arm-linux-gnueabihf-
mkdir build_out; cd build_out
../configure --prefix=/code/glibc-2.35/build_out \
--host=arm-linux-gnueabihf
make
make install
依赖 zlib 源码编译出来的目标文件,请先参考如何交叉编译 zlib 完成之后再来编译。
export PATH="<path-to-gcc-linaro-5.3-2016.02-x86_64_arm-linuxgnueabihf>/bin":$PATH
export CROSS_COMPILE=arm-linux-gnueabihf
mkdir build_out
./configure --prefix=/code/libxml2-2.9.10/build_out \
--disable-static \
--with-python=no \
--host=arm-linux-gnueabihf \
--with-zlib=/code/zlib-1.2.12/build_out
make
make install
需要在代码的根路径新建一个 config.sit
,内容参考如下:
--enable-shared
生成动态链接库
export PATH="<path-to-gcc-linaro-5.3-2016.02-x86_64_arm-linuxgnueabihf>/bin":$PATH
export CROSS_COMPILE=arm-linux-gnueabihf
export CONFIG_SITE=./config.site
# config.site 文件内容如下:
cat config.site
ac_cv_file__dev_ptmx=no
ac_cv_file__dev_ptc=no
./configure --prefix=/code/Python-2.7.16/build_out \
--host=arm-linux-gnueabihf \
--build=x86_64 \
--disable-ipv6 \
--enable-shared
make
make install