2023-02-17

[팁] ssh접속시 다 보내기.

#접속만 하고싶다. sshpass -p 'P@ssw0rd' ssh -o StrictHostKeyChecking=no root@1.2.3.4 #파일복사 하고싶다. sshpass -p 'P@ssw0rd' scp -o StrictHostKeyChecking=no * root@remotsvr.local:/usr/local/fw/ [원문] https://zetawiki.com/wiki/%EB%A6%AC%EB%88%85%EC%8A%A4_sshpass_%EC%82%AC%EC%9A%A9%EB%B2%95 

2023-02-14

[개발노트] embedded linux vscode remote gdb

vscode로 편집만 하던 리눅스 app을 원격 디버깅 해보기.

sudo apt install build-essential gdb gdb-multiarch

vscode 로 폴더 열기.

.vscode 폴더에 3개의 파일 만들기.

launch.json

{
"version": "0.2.0",
"configurations": [
{
"name": "GDB-Debug",
"type": "cppdbg",
"request": "launch",
"program": "${config:BINARY}",
"args": [],
"stopAtEntry": true,
"cwd": "${workspaceFolder}",
"environment": [],
"console": "integratedTerminal",
"MIMode": "gdb",
"targetArchitecture": "arm",
"preLaunchTask": "deploy",
"setupCommands": [
{
"description": "Pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true,
}
],
"miDebuggerPath": "/usr/bin/gdb-multiarch",
"miDebuggerServerAddress": "${config:TARGET_IP}:${config:DEBUG_PORT}",
}
]
}

settings.json

{
"TARGET_IP":"192.168.25.53",
"DEBUG_PORT":"6666",
"BINARY":"s1app3",

"SDK_DIR":"/home/happycpu/work/wrlinux/sdk/environment-setup-cortexa7t2hf-neon-vfpv4-wrs-linux-gnueabi",
}

tasks.json

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "cross-compile",
"type": "shell",
"command": "sh",
"args": [
"cross-compile.sh",
"${config:SDK_DIR}",
],
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "deploy",
"isBackground": true,
"type": "shell",
"command": "sh",
"args": [
"deploy.sh",
"${config:TARGET_IP}",
"${config:DEBUG_PORT}",
"${config:BINARY}"
],
"problemMatcher": {
"base": "$gcc",
"background": {
"activeOnStart": true,
"beginsPattern": "${config:BINARY}",
"endsPattern": "Listening on port [0-9]{4}"
}
},
"dependsOn": [
"cross-compile"
],
},
]
}


스크립트파일2개 추가.

cross-compile.sh

#!/bin/bash
SDK_DIR="$1"

. ${SDK_DIR}
cmake .
make clean; make -j$(nproc)

*yocto 의 sdk를 source 하여주는 행위와 cmake파일 생성하고 make까지 함.


deploy.sh

#!/bin/bash
DEST_IP="$1"
DEBUG_PORT="$2"
BINARY="$3"
DEST_DIR="/root"

# kill gdbserver on tx8m and delete old binary
ssh root@${DEST_IP} "sh -c '/usr/bin/killall -q gdbserver; rm -rf ${DEST_DIR}/${BINARY} exit 0'"

# send binary to target
scp ${BINARY} root@${DEST_IP}:${DEST_DIR}/${BINARY}

# start gdbserver on target
ssh -t root@${DEST_IP} "sh -c 'cd ${DEST_DIR}; gdbserver localhost:${DEBUG_PORT} ${BINARY}'"

*DEST_DIR은 타겟보드의 실행파일 위치.


[원문]https://karo-electronics.github.io/docs/software-documentation/vscode/index.html#





2023-02-03

[yocto embedded linux dotnet azure-iot-sdk-charp] 절차

[머신작업]
yocto에는 meta-dotnet-core를 추가해준다.
$ build/conf/bblayers.conf 에 추가함.
나의 욕토는 hardknott이므로, 추가해준다. 
meta-dotnet-core/conf/layer.conf 
LAYERSERIES_COMPAT_dotnet-core = "honister dunfell kirkstone hardknott"
던펠까지만 있었으면, 상위버전이므로 안될수도있었는데, kirkstone까지 되는것이므로 그 아랫버전은 될것이라 생각하고 했더니 되더라.
이미지에 dotnet-core 추가. 추가 위치는 나의 이미지 어펜드들 모아놓은곳에 추가함.
빌드하면 이미지가 약 100메가정도 늘어남.
추가로, master는 dotnet7.0이 기본이므로, pc의 개발환경과 azure sample소스등이 dotnet60으로 된것을 고려하여 타겟의 버전도 6.0으로 찍어준다.


build command for linux-arm

dotnet publish -r linux-arm -p:PublishSingleFile=true --self-contained false -c Release



2023-02-02

[쉘] 바이너리 파일에서 추출하여 버전빼기


grep -a "\$Revision.*\$" /usr/local/network_adapter.bin 를 실행하면 아래와 같이 추출해준다.
$Id: ESP32 $ $Date: Feb  1 2023 22:28:54 $ $Revision: 0.0.5.std $

이걸 이용해서 추가해서 0.0.5.std 만 추출하고싶다.
grep -a "\$Revision.*\$" /usr/local/network_adapter.bin | cut -d "$" -f6 | cut -d " " -f2
0.0.5.std


2023-01-31

[dotnet] yocto에 추가.

layers 밑에


build 폴더에서.
vi conf/bblayers.conf
BBLAYERS 에 meta-dotnet-core 경로 추가.

images폴더의 wrlinux-image-test.bbappend 에
IMAGE_INSTALL_append += "dotnet-core" 추가.

bitbake wrlinux-image-test

결과는 dotnet 포함됨.

그다음은 몰라~

2023-01-27

[dbus] dbus-send

dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Reboot" boolean:true

[팁] mac으로 호스트네임 만들기

# myhost=CNTX-$(cat /sys/class/net/eth0/address | cut -b 10,11,13,14,16,17)
# hostname ${myhost^^}

[팁] 대문자화

#!/bin/bash  str="ApPlE"  uppercase=${str^^}  lowercase=${str,,}  echo "Uppercase: ${uppercase}"  echo "Lowercase: ${lowercase}"

2023-01-26

[개발노트] mac 주소 읽기

#!/bin/bash
dev=$(ip route show default | awk '/default/ {print $5}')
ip=$(ip -4 -o addr show $dev | awk '{print $4}')
mac=$(cat /sys/class/net/$dev1/address)
echo $dev $ip $mac

2023-01-17

커널수정 절차.

build $ devtool modify linux-stm32mp
build $ cd workspace/source/linux-stm32mp 내용수정.
빌드, 이미지생성등 다양한테스트 완료되면.
linux-stm32mp$ git add .
linux-stm32mp$ git commit -m "패치파일명이됨잘써라"
build $ devtool update-recipe linux-stm32mp
커널레시피 폴더에 패치파일생성됨을 확인.
build $ devtool reset linux-stm32mp
* 파일을 추가할때는 파일을 레시피에 추가하는 방법으로 해야지 직접 커널폴더에 생성해서위의 행위를 하면, 패치파일에 파일을 녹여넣어버림. (좀 지저분함)
끝.


암호화 + base64 하고 쉘스크립트.

 #!/bin/bash # IV와 UserKey를 설정합니다 (아스키 문자열을 그대로 사용). IV="0123456789abcdef"  UserKey="0123456789abcdef" # IV와 UserKey를 16...