顯示具有 work 標籤的文章。 顯示所有文章
顯示具有 work 標籤的文章。 顯示所有文章

2024年9月17日 星期二

putty configuration

 connection-> Data

Auto-login username  (user111)


connection-> SSH -> Auth -> Credentials

private key file for authentication:

  (xxxx.ppk)



connection-> SSH -> bugs

Ignore SSH-2 maximum packet size (ON)

2022年5月5日 星期四

dracut linux開機

 https://dracut.wiki.kernel.org/index.php/Main_Page


https://man7.org/linux/man-pages/man8/dracut.8.html



https://linuxconfig.org/how-to-build-an-initramfs-using-dracut-on-linux



linux開機dracut#

https://www.itread01.com/p/1390355.html



http://linux.51yip.com/search/dracut

2021年12月21日 星期二

swiss file knife sfk.exe

 http://stahlworks.com/dev/swiss-file-knife.html


資訊科技小舖: 小工具的集合Swiss File Knife (cola-zero.blogspot.com)

小工具的集合Swiss File Knife

Swiss File Knife提供類似Linux與Unix系統的Shell功能,可以進行檔案管理、檔案切割與組合、進位轉換、執行檔轉成原始碼、檔案MD5計算與比較、FTP server、封包監控、將多個Swiss File Knife指令組成Script執行


2021年10月11日 星期一

centos 更換主機版無法開機

 https://wiki.centos.org/zh-tw/TipsAndTricks/CreateNewInitrd


建立一個新的起始用 RAM 磁碟映像


以 CentOS 的安裝碟開機(例如首張 CD 或 DVD)。

在 boot: 提示符輸入 linux rescue。


以讀寫模式掛載所有檔案系統。




mount --bind /proc /mnt/sysimage/proc

mount --bind /dev /mnt/sysimage/dev

mount --bind /sys /mnt/sysimage/sys

chroot /mnt/sysimage

在採用多路徑主目錄('/')的 CentOS7 下,請先執行以下指令,然後才 chroot 進入 '/mnt/sysimage':


mount --bind /run /mnt/sysimage/run

systemctl start multipathd.service








https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/performing_an_advanced_rhel_installation/updating-drivers-during-installation_installing-rhel-as-an-experienced-user#performing-an-assisted-driver-update_updating-drivers-during-installation



http://cjcheema.com/2019/06/how-to-recover-or-rebuild-initramfs-in-centos-7-linux/


How to recover or rebuild initramfs in CentOS 7 Linux


https://access.redhat.com/discussions/3722151



https://bugs.centos.org/view.php?id=16898



http://elrepoproject.blogspot.com/2019/08/rhel-80-and-support-for-removed-adapters.html



2021年10月6日 星期三

2/8/10/16進制

 


hexadecimal 16

decimal 10

octal 8

binary 2


4bit 2補數


0    0000

1    0001

2    0010

3    0011

4    0100

5    0101

6    0110

7    0111

8    1000   -8

9    1001   -7

10 a 1010   -6

11 b 1011   -5

12 c 1100   -4

13 d 1101   -3

14 e 1110   -2

15 f 1111   -1



16bit 2補數

0x7fff = 32767

0x8000 = 32768, -32768



32bit 2補數

0x7fffffff = 2147483647

0x80000000 = 2147483648,  -2147483648



1k = 1024 = 0x400

4k = 4096 = 0x1000

8k = 8192 = 0x2000 


8khz sampling rate, period 125us, 0.125ms


2021年1月7日 星期四

git repo 管理

 git repo 管理





有一個使用情形是用 repo管理

 

已經出一版 1.0 sdk了。


如果是有patch的話想只出1.01有修改的檔案

如  project a 的 ddd.c  和 project b的 eee.c

 

是不是有對應的指令可以做到


repo forall -c 'git diff --src-prefix=old/$REPO_PATH/ --dst-prefix=new/$REPO_PATH/ v1.0 v1.0.1' > all.patch


This command generates a single patch for the change from v1.0 to v1.0.1 tags.




將有修改後的檔案 tar起來。


single tar file::  files the change from v1.0 to v1.0.1 tags.



List file different to `filelist`

$ repo forall -c 'git diff HEAD v1.0.1 v1.0 --name-only | sed -e "s|^|$REPO_PATH/|"' > filelist


Create tarball according to `filelist`

$ tar jcvf test.tar.bz2 `cat filelist`





https://stackoverflow.com/questions/33030289/is-there-a-tool-to-create-repo-manifest-file-with-sha-based-on-current-work-dire




The repo manifest command creates manifest files with fixed SHA-1s based on the current workspace.


repo manifest -r -o my-manifest.xml







只用git管理的情形

http://stackoverflow.com/questions/12841360/git-archive-from-changed-files-on-bare-repos

 


git archive --format=tar --prefix='/' master `git diff V1.02 master --name-only` | gzip -9 > ~/tars/update-v1.02-`git describe master --tags`.tar.gz



https://www.jianshu.com/p/58e5d4f9f9a9


https://source.android.com/setup/develop/repo



大丈夫日記 

http://ryan0210.blogspot.com/2013/10/coding-repo-git.html


泰勞筆記

https://thai-lin.blogspot.com/2017/05/repo-git.html




repo sync -j threadcount



 -j threadcount :在線程之間拆分同步,以加快完成速度。確保不要通過為其他任務保留一些CPU來壓倒計算機。要查看可用CPU的數量,請首先運行: nproc --all

 



git push origin master 


1.

直接 push:

$ git push orgin default:master


2.


進到 code review的push 指令

git push origin default:refs/for/master


PS. 其實 repo upload 指令,就是把 topic branch push 到 refs/for/project-branch,

       就會直接進到 code-review 頁面上



tig


m main view

d diff view

r branch view the branches, remotes and tags in the repository.

t tree view

b blame view Displays the file content annotated or blamed by commits.


all view

j k up/down

J K next/previous

上鍵 下鍵 next/previous

page up/down : page up down

q 關閉 畫面


in main view

D 切換 date display modes

A 切換 author display modes

X 切換 commit sha

enter  查看 commit 的詳細 diff 變更 

q 關閉 diff 畫面。


還有 tig 指令後面接 branch 名稱可以直接查看分支,接著在分支 commit 上按大寫 C 可以 cherry-pick 回目前的 branch,而 tig 後面接檔名的話可以直接查看跟這個檔案有關的 commit,更多的基本功能介紹可以看 git? tig! 這篇文章。



https://devhints.io/tig

http://blog.kidwm.net/388

http://jonas.nitro.dk/tig/manual.html


2020年9月2日 星期三

embedded linux

 96年 11月出版

旗標出版

embedded linux 開發實務徹底研究

christopher hallinan


piggy.s


.section .piggydata, #alloc

.globl input_data

input_data:

    .incbin "arch/arm/boot/compressed/piggy.gz"

.globl input_data_end

intpu_data_end:


http://news.eeworld.com.cn/mcu/article_2016062227204.html


kernel build no.

.versino   ex: #11

scripts/mkversion

makefile



--setup macro

include/linux/init.h


linux 2.6


linker sciprt

do_initcalls(void)

__initcall_start

__initcall_end


print_symbol()


make ARCH=arm CROSS_COMPILE=xscale-be- zImage


2018年11月14日 星期三

linux netcat

參考
https://blog.gtwang.org/linux/linux-utility-netcat-examples/


檔案接收者
nc -l 5000 > branch-rtl819x-sdk-v3.4.11.tar

nc 172.21.69.1 5000 < branch-rtl819x-sdk-v3.4.11.tar


nc -l 50000 > my_svn_new_checkout.sh

nc 172.21.69.4 5000 < my_svn_new_checkout.sh


在兩台主機之間複製檔案
假設現在有兩台主機,分別為 A 主機與 B 主機,若要將一個檔案從 A 主機複製到 B 主機,可以先在 B 主機(檔案接收者)上執行:

nc -l 5000 > my.jpg
然後在 A 主機(檔案傳送者)上執行:

nc hostB.com 5000 < my.jpg
這樣就可以把 my.jpg 這個檔案從 A 主機複製到 B 主機上了。 雖然這個方式跟 scp 指令比起來可能不是最方便的,但是它的特點是不需要登入的動作(也就是說不需要任何帳號與密碼),假設你碰到兩台主機無法互相登入的時候,就可以使用這樣的方式處理。


接收端
ubuntu  18.04

nc -l 50000 > my_svn_new_checkout.sh



傳送端
debian 9.6

nc 172.21.69.4 50000 -q 1 < my_svn_new_checkout.sh



傳送端
ubuntu  18.04

nc 172.21.15.145 50000 -q 1 < my_svn_new_checkout.sh


     -N      shutdown(2) the network socket after EOF on the input.  Some servers
             require this to finish their work.




centos 7 防火牆 注意
sudo firewall-cmd --zone=public --add-port=50000-55500/tcp --permanent

sudo firewall-cmd --reload

sudo firewall-cmd --zone=public --list-ports
19999/tcp 5001/tcp 5201/tcp 50000-55500/tcp


centos firewall reference
https://unix.stackexchange.com/questions/409878/centos-7-open-a-port
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-firewalld-on-centos-7
https://mangolassi.it/topic/8380/centos-7-open-firewall-ports-range-on-firewalld

https://www.thegeekdiary.com/how-to-test-port-connectivity-using-nc-utility-in-centos-rhel/



netcat 參考
https://www.linuxtechi.com/nc-ncat-command-examples-linux-systems/
https://www.arthurtoday.com/2015/10/ubuntu-replace-telnet-with-nc-command.html
https://www.tecmint.com/check-remote-port-in-linux/
https://ithelp.ithome.com.tw/articles/10136033

firewall and netcat
https://fabianlee.org/2016/09/26/ubuntu-pre-validate-network-acl-and-firewall-connectivity-with-netcat/
https://itekblog.com/test-firewall-with-netcat/
https://www.digitalocean.com/community/tutorials/how-to-use-netcat-to-establish-and-test-tcp-and-udp-connections-on-a-vps


debian firewall
https://wiki.debian.org/DebianFirewall


netcat for window 下載
https://eternallybored.org/misc/netcat/

linux 系統監控工具

glances (python)

htop
top
nmon
iostat

glances
https://www.maketecheasier.com/glances-monitor-system-ubuntu/


hegemon
https://www.tecmint.com/install-rust-programming-language-in-linux/
https://www.tecmint.com/hegemon-system-monitoring-tool-for-linux/


https://opensource.com/life/16/2/open-source-tools-system-monitoring
top
atop
htop
glances


netdata
monitorix
collectd


lshw
lscpu
lspci
lsusb


sudo dmidecode



harddisk

sudo smartctl -a /dev/sda

blkid

破壞性寫入測試
badblocks -wsv /dev/xxxdisk

fdisk/gdisk/parted


nload is a console application which monitors network traffic and bandwidth




hddtemp - Utility to monitor hard drive temperature

dmidecode is a tool for dumping a computer's DMI (some say SMBIOS ) table contents in a human-readable format.


lm_sensors (Linux monitoring sensors) is a free and open-source application that provides tools and drivers for monitoring temperatures, voltage, and fans.


smartmontools smartctl - Control and Monitor Utility for SMART Disks
smartctl controls the Self-Monitoring, Analysis and Reporting Technology (SMART) system built into many ATA-3 and later ATA, IDE and SCSI-3 hard drives.


nullmailer is an relay-only forwarding MTA (Mail Transfer Agent).

ranger - visual file manager

GNU Midnight Commander is a visual file manager,

netcat is a simple unix utility which reads and writes data across network connections, using TCP or UDP protocol.

2018年11月7日 星期三

lzma linux image tool

 ./lzma e vmlinux_img vmlinux_img.gz


LZMA 4.06 Copyright (c) 1999-2004 Igor Pavlov  2004-09-05

Usage:  LZMA <e|d> inputFile outputFile [<switches>...]
  e: encode file
  d: decode file
  b: Benchmark
<Switches>
  -a{N}:  set compression mode - [0, 2], default: 2 (max)
  -d{N}:  set dictionary - [0,28], default: 23 (8MB)
  -fb{N}: set number of fast bytes - [5, 255], default: 128
  -lc{N}: set number of literal context bits - [0, 8], default: 3
  -lp{N}: set number of literal pos bits - [0, 4], default: 0
  -pb{N}: set number of pos bits - [0, 4], default: 2
  -mf{MF_ID}: set Match Finder: [bt2, bt3, bt4, bt4b, pat2r, pat2,
              pat2h, pat3h, pat4h, hc3, hc4], default: bt4
  -eos:   write End Of Stream marker
  -si:    Read data from stdin
  -so:    Write data to stdout


2018年11月1日 星期四

linux連到ssh server想要中斷連線

~.

We can use tilde-period (~.) to close an unresponsive session.

https://pleiades.ucsc.edu/hyades/SSH_Escape_Sequences

When a pseudo-terminal has been requested by the OpenSSH SSH client, ssh supports a number of functions through the use of an escape character. The escape character must always follow a newline to be interpreted as special. The default escape character is ~(tilde); but it can be can be changed in configuration files using the EscapeChar configuration directive or on the command line by the -e option.


 ~?
Supported escape sequences:
 ~.   - terminate connection (and any multiplexed sessions)
 ~B   - send a BREAK to the remote system
 ~C   - open a command line
 ~R   - request rekey
 ~V/v - decrease/increase verbosity (LogLevel)
 ~^Z  - suspend ssh
 ~#   - list forwarded connections
 ~&   - background ssh (when waiting for connections to terminate)
 ~?   - this message
 ~~   - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)

2018年8月23日 星期四

crypto aes openssl cbc gcm

kazoo it

 Edgerouter X.



ER-X Forwarding Speed
https://kazoo.ga/er-x-forwarding-speed/

Re-visit Forwarding Speed in ER-X

https://kazoo.ga/revisit-forwarding-speed-in-er-x/


Edgerouter X - IPsec Benchmarked
https://kazoo.ga/edgerouter-x-ipsec-benchmarked/


Let's focus on the 1460-byte packet size. In download direction, 377 Mbit/s is very good throughput in my opinion. It surpasses the quoted number from MediaTek and close to the 500 Mbit/s upper bound quoted by Authentec. In upload direction, relatively speaking it's a little disappointing. 128 Mbit/s is only about one third of the download throughput.





CBC
Cipher Block Chaining
Encryption parallelizable: No
Decryption parallelizable: Yes
Random read access: Yes

download is Decryption for crypto engine
upload is Encryption for crypto engine



The Crypto Engine in Edgerouter X
https://kazoo.ga/the-crypto-engine-in-edgerouter-x/




https://kazoo.ga/quick-benchmark-cbc-vs-gcm/

In my previous post, we touched OpenVPN 2.4 and its new inclusion of GCM ciphers. SFX2000 over SNBforums reminded me to check performance in current OpenSSL. Let me share my quick and dirty benchmarks.
64-bit Sandy Bridge @2.7GHz single-thread
AES-128-CBC with AES-NI



The Cortex-A9 is my RT-AC56U where I run OpenVPN server. It doesn't have any crypto acceleration in HW. CBC is faster than GCM by 145% to 185%. I thought I had to swallow my words and should not switch to GCM ciphers. Looking closer, I might get away with it.
My Conclusion..





http://cryptowiki.net/index.php?title=Output_feedback_with_a_nonlinear_function_(OFBNLF)

http://cryptowiki.net/index.php?title=Block_chaining_(BC)


http://cryptowiki.net/index.php?title=Symmetric_encryption_schemes

2018年1月11日 星期四

ipsec vpn notes strongswan

IPSec VPN Host to Host on Ubuntu 14.04 with strongSwan
by gyp on June 5, 2015 in Computers, internet with 25 Comments


https://www.gypthecat.com/ipsec-vpn-host-to-host-on-ubuntu-14-04-with-strongswan



IPsec Transport Mode with strongswan on Debian 8 Jessie
Posted by Christoph Haas on 10 03 2016. 1 Kommentar zu IPsec Transport Mode with strongswan on Debian 8 Jessie

Today I am going to write a small tutorial on how inter-server communication can be secured via IPsec in transport mode. This tutorial was written for Debian 8 Jessie but it should work similar with other linux distributions aswell.


https://blog.sprinternet.at/2016/03/ipsec-transport-mode-with-strongswan-on-debian-jessie/


strongswan

auto=add (manually or by remote peer)

auto=start (automatically immediately start connect to the remote host configured in right)

2017年12月1日 星期五

debian 9 build code notes embedded linux openwrt





sudo dpkg-reconfigure dash
選擇 No 把 dash 關掉再試試看


samba vim lib32z1 make build-essential gcc git libssl-dev lrzsz
libncurses5-dbg libncurses5-dev libncursesw5-dbg libncursesw5-dev
bison flex iperf3 tmux ctags openssh-server openssh-sftp-server



aptitude install libc6-i386 libc6-dev-i386

aptitude install zlib1g-i386


dash / bash
http://www.jianshu.com/p/762d4cccee7e

https://www.ubuntu-tw.org/modules/newbb/viewtopic.php?post_id=23963

---------------------------
openssh server

/etc/ssh/sshd_config


UseDNS no


# Ciphers and keying
#RekeyLimit default none
Ciphers aes128-cbc
MACs hmac-md5-96,hmac-sha1-96

----------
linux crc32 計算

cksfv

apt-get install cksfv

example

cksfv fpga_test_newmpm.bin


; Generated by cksfv v1.3.14 on 2017-12-18 at 15:46.58
; Project web site: http://www.iki.fi/shd/foss/cksfv/
;
;        22516  15:50.29 2017-02-07 fpga_test_newmpm.bin
fpga_test_newmpm.bin 9E9268D9


2017年11月1日 星期三

網路 packet drop, jitter, delay 模擬器



NIST Net network emulator
https://www-x.antd.nist.gov/nistnet/



https://wiki.linuxfoundation.org/networking/netem
netem

netem provides Network Emulation functionality for testing protocols by emulating the properties of wide area networks. The current version emulates variable delay, loss, duplication and re-ordering.

2017年10月27日 星期五

tar 檔解開後 換位置 make build 不過

1.打make時出現的error


make[5]: *** No rule to make target 'xxx old file ', needed by 'xxx.o'.

[ ! -d "iptables-1.4.4" ] || make -C iptables-1.4.4 || exit $?
make[3]: Entering directory '/root/work/8197f_build/rtl819x_orig2/users/iptables-1.4.4'
make  all-recursive
make[4]: Entering directory '/root/work/8197f_build/rtl819x_orig2/users/iptables-1.4.4'
Making all in extensions
make[5]: Entering directory '/root/work/8197f_build/rtl819x_orig2/users/iptables-1.4.4/extensions'
  GEN      matches4.man
-e + ./libipt_addrtype.man
-e + ./libipt_ah.man
-e + ./libxt_cluster.man
-e + ./libxt_comment.man

-e + ./libxt_TRACE.man
  GEN      initext4.c
  CC       initext4.o
make[5]: *** No rule to make target '/ssd/home_ssd/jwsyu/8197f_apteam_sdk/rtl819x-SDK-v3.4.11C-full-package/rtl819x_orig2/linux-3.10/include/uapi/linux/posix_types.h', needed by 'libxt_tcpmss.o'.  Stop.
make[5]: Leaving directory '/root/work/8197f_build/rtl819x_orig2/users/iptables-1.4.4/extensions'
Makefile:1126: recipe for target 'all-recursive' failed
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory '/root/work/8197f_build/rtl819x_orig2/users/iptables-1.4.4'
Makefile:434: recipe for target 'all' failed
make[3]: *** [all] Error 2
make[3]: Leaving directory '/root/work/8197f_build/rtl819x_orig2/users/iptables-1.4.4'
Makefile:1643: recipe for target 'iptables-1.4.4' failed
make[2]: *** [iptables-1.4.4] Error 2
make[2]: Leaving directory '/root/work/8197f_build/rtl819x_orig2/users'
Makefile:472: recipe for target 'app' failed
make[1]: *** [app] Error 2
make[1]: Leaving directory '/root/work/8197f_build/rtl819x_orig2/users'
Makefile:165: recipe for target 'bins' failed
make: *** [bins] Error 2



2.到出錯的目錄用 grep 找出 有舊位置字串的檔案
  grep oldaddress
 發現是在  xxxxx.o.d

3.在出錯的目錄 將 .o.d砍掉
cd /root/work/8197f_build/rtl819x_orig2/users/iptables-1.4.4/extensions

find . -name "*.o.d"   | xargs rm -f

2017年7月27日 星期四

su 檔案 gcc gnu


在build code時除了有 .o檔案外 還有 .su檔案 (stack used)

https://gcc.gnu.org/onlinedocs/gnat_ugn/Static-Stack-Usage-Analysis.html

6.6.2 Static Stack Usage Analysis

A unit compiled with -fstack-usage will generate an extra file that specifies the maximum amount of stack used, on a per-function basis. The file has the same basename as the target object file with a .su extension. Each line of this file is made up of three fields:
  • * The name of the function.
  • * A number of bytes.
  • * One or more qualifiers: static, dynamic, bounded.
The second field corresponds to the size of the known part of the function frame.
The qualifier static means that the function frame size is purely static. It usually means that all local variables have a static size. In this case, the second field is a reliable measure of the function stack utilization.
The qualifier dynamic means that the function frame size is not static. It happens mainly when some local variables have a dynamic size. When this qualifier appears alone, the second field is not a reliable measure of the function stack analysis. When it is qualified with bounded, it means that the second field is a reliable maximum of the function stack utilization.

A unit compiled with -Wstack-usage will issue a warning for each subprogram whose stack usage might be larger than the specified amount of bytes. The wording is in keeping with the qualifier documented above.


2017年1月4日 星期三

win7 不要連上 fb. ptt


將 fb/ptt.cc對應到 127.0.0.1

C:\Windows\System32\drivers\etc\hosts

127.0.0.1 fb.com
127.0.0.1 www.facebook.com
127.0.0.1 ptt.cc

2016年3月30日 星期三

linux command/tool

cksum

comm

csplit

cut

md5sum

nl

nohup

od

sum

tee

tree

edquota

quota on

cmp

diff

diffstat

badblocks

eject

whereis

sync

contrab

unmask

dialgo --timebox "time" 8 30

2016年3月29日 星期二

tmux

tmux -2 a

tmux -2 ls


c-b = control + b

c-b " split the current pane into two top/bottom

c-b % split to left/right

c-b t show clock

c-b l last window

c-b n next window

c-b up/down/left/right move up down left right pane

c-b c-o rotate the pans in the current window backwards

c-b c create a new window

c-b d detach