<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7422594244561083816</id><updated>2025-05-13T04:54:54.578-07:00</updated><category term="Linux - kernel"/><category term="The Art of Readable Code"/><category term="JavaScript - extjs"/><category term="心情"/><category term="C"/><category term="JavaScript"/><category term="tools - devel"/><category term="Embedded"/><category term="OpenEmbedded"/><category term="Design Patterns with C"/><category term="tools - admin"/><category term="Linux - MTD"/><category term="cmake"/><category term="tools - net"/><category term="ubuntu"/><category term="- Table Of Content"/><category term="IPv6"/><category term="Embedded - qcm"/><category term="Linux - kernel - DT"/><category term="RFC"/><category term="理財"/><category term="C - Lib - cgic"/><category term="LTE/5G"/><category term="Lua ＆ Luci"/><category term="SCons"/><category term="tools - vm"/><category term="C - Lib - glibc"/><category term="ELF之學習心得"/><category term="GCC - C Preprocessor"/><category term="HTML5"/><category term="OpenEmbedded - Yocto Project Reference Manual"/><category term="Socket"/><category term="tools - devel - MQTT"/><category term="tools - net - netfilter"/><category term="x11 - tools - net"/><category term="領導與管理"/><category term="Bash"/><category term="C - Lib - protobuf"/><category term="Database - SQLite"/><category term="Linux - kernel - DS"/><category term="Linux - misc"/><category term="Socket - NETLINK"/><category term="autotool"/><category term="linux - kernel - network"/><category term="tools - JavaScript"/><category term="tools - mail"/><category term="tools - utils"/><category term="tools - web"/><category term="美食 - 台中"/><category term="美食 - 新竹"/><category term="6 sigma"/><category term="AWS IoT"/><category term="Apple - System"/><category term="C - Lib - sqlite"/><category term="Design Patterns with C-plus-plus"/><category term="GCC - Attributes"/><category term="HW - network"/><category term="MS - Office"/><category term="MS - Visual Studio"/><category term="MS - win7"/><category term="NS2"/><category term="Node.js"/><category term="OPENSSL"/><category term="TCL"/><category term="Ubuntu - Admin"/><category term="Ubuntu - Net"/><category term="X11 - tools - devel"/><category term="autotool - autoconf"/><category term="com - hardware"/><category term="cygwin"/><category term="eMMC"/><category term="lex ＆ yacc"/><category term="tools - devel - gdb"/><category term="tools - editor"/><category term="tools - make"/><category term="tools - misc"/><category term="tools - text"/><category term="tools - wine"/><category term="tools - xml"/><category term="x11 - tools - admin"/><category term="x11 - tools - finance"/><category term="投資"/><category term="開箱文"/><category term="韓式料理"/><title type='text'>Nano雞排</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>297</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-7660444165280377639</id><published>2024-07-14T04:30:00.000-07:00</published><updated>2024-07-25T05:38:10.790-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="eMMC"/><title type='text'>Notes for JEDEC Standard No. 84-B51A - CH1~CH5</title><summary type="text">eMMC是一種管理型記憶體（managed memory ），專為儲存代碼和資料而設計，具有低功耗的特點，非常適合行動裝置使用。

eMMC 通訊匯流排： eMMC 使用一個包含11個訊號的匯流排進行通信，包括Clock、Data Strobe（資料同步訊號）、1位元Command、8位元Data Bus。

Clock： 支援的時脈頻率範圍為0到200MHz。
Data Bus： eMMC支援三種不同的資料匯流排寬度模式：1位（預設）、4位和8位。這些模式允許根據需要調整資料傳輸速度和並行性。

eMMC 的優勢：
低功耗： eMMC 設計具有低功耗特性，適合在電池供電的行動裝置中使用。
間接記憶體存取： eMMC 透過一個獨立的控制器來實現間接記憶體存取。這意味著設備可以在不依賴主機軟體的情況下處理後台記憶體管理任務。這種特性簡化了主機系統上的快閃記憶體管理層。




在 eMMC</summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/7660444165280377639/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2024/07/notes-for-jedec-standard-no-84-b51a.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/7660444165280377639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/7660444165280377639'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2024/07/notes-for-jedec-standard-no-84-b51a.html' title='Notes for JEDEC Standard No. 84-B51A - CH1~CH5'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMsMN1hOOdGBktcSjHHj2u_nEjX-XckfxdZBX9USBoyrFN2b7ZTwsadVQjYfZ0Xm2L15Z-aPP_ozCDO0IKiq-kHG3ULxfMy996BTq4LGTxnFiiXNeoY2zN1wZvG52ZD-uDn-lFSA4d6ow1jfSzY8GzpnD1NyItCjn8z50getxI9LukhwF7w-4xBNhlp2A/s72-c/emmc-arch.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-4496299324076101538</id><published>2024-07-05T20:26:00.000-07:00</published><updated>2024-07-24T20:47:36.064-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Embedded"/><title type='text'>Configuration of a minimal systemd setup in QEMU</title><summary type="text">本文記錄如何在 QEMU 環境中設定最小的 systemd init。基本上需要建立兩個必要的目標：sysinit.target 和 basic.target，以及用於登入的 getty@.service。


SRCROOT=/opt/armv7vet2hf/sysroots/
DSTROOT=initrd
SRCLIB=$SRCROOT/lib
DSTLIB=$DSTROOT/lib
SRCSYSDLIB=$SRCROOT/lib/systemd
DSTSYSDLIB=$DSTROOT/lib/systemd
SRCUSRLIB=$SRCROOT/usr/lib
DSTUSRLIB=$DSTROOT/usr/lib

rm -rf $DSTROOT
mkdir -p $DSTROOT/bin $DSTROOT/usr/lib $DSTROOT/lib/systemd/system $</summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/4496299324076101538/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2024/07/configuration-of-minimal-systemd-setup.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/4496299324076101538'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/4496299324076101538'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2024/07/configuration-of-minimal-systemd-setup.html' title='Configuration of a minimal systemd setup in QEMU'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLkR6YFkG7j85Qf2YUReWTqeKKnz5PG2OOpvzH18rIzZqmZ4BZqMXoSJfT7n1h8foMRD7zYuKhp9ePUHeMzkz-fam3Cvv5GsHdgU9tZhxsqfRW2fDxZ4mCg1iMxXipliqFoaB1XEm1Mf8931M-aCSPy1N_4Fq5IR3ql7j0VSYjPgPHpyuLetNrlAuIoG4/s72-c/mini-systemd.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-4110532790209359209</id><published>2024-05-05T06:22:00.000-07:00</published><updated>2024-05-12T07:25:55.962-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Design Patterns with C"/><title type='text'>A pattern for state machine III - SM framework</title><summary type="text">科技始終來自人性。最近剛好看到別人寫的SM有點糟糕，於是想起自己之前寫的，感覺也是不夠直覺，於是改寫了一下。主要概念還是根據SM的定義。


An abstract state machine is a software component that defines a finite set of states:
One state is defined as the initial state. When a machine starts to execute, it automatically enters this state.
Each state can define actions that occur when a machine enters or exits that state. 
Each state can define events that trigger a</summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/4110532790209359209/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2024/05/a-pattern-for-state-machine-iii-sm.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/4110532790209359209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/4110532790209359209'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2024/05/a-pattern-for-state-machine-iii-sm.html' title='A pattern for state machine III - SM framework'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuh09qSLYiVYRnyO1ya3iHHj49l7pl4WNTTsqdLfXz3xFtxiDmrNzuQoZ8gWi1DP0cu_JjNs0dwoM1RzCr0FNOUB5CHJmvxufaXdv8-GA9FhRtIkOPErOYXXSCbhOtUeJ711hRlzsOUABo6IG4snT0En0xUJUHc1qDhGvVg6lPvBeOe6cI_qjZ7N0mRcI/s72-c/sm.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-5190174329724257476</id><published>2023-09-24T02:30:00.000-07:00</published><updated>2023-09-24T02:39:53.761-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux - kernel"/><title type='text'>Linux Kernel（25.1）- Gadget Configfs</title><summary type="text">這篇是gadget_configfs.txt的心得, 透過Dummy HCD的模擬, 就可以不用真的去連USH host才能驗證Gadget了.
 
首先把Dummy HCD與USB Gadget functions configurable through configf選成built-in了, 方便後面驗證, 下面就直接用例子說明

/ # lsusb 查看目前USB裝置, ID &amp;lt;Vendor ID&amp;gt;:&amp;lt;Device ID&amp;gt;
Bus 001 Device 001: ID 1d6b:0002 可以看到目前只有一組, 1B6D是Linux Foundation, 0002是2.0 root hub

/ # mount -t configfs none /sys/kernel/config/ 要把configfs掛起來才能開始設定gadget
/ # mount</summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/5190174329724257476/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2023/09/linux-kernel251-gadget-configfs.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/5190174329724257476'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/5190174329724257476'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2023/09/linux-kernel251-gadget-configfs.html' title='Linux Kernel（25.1）- Gadget Configfs'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-4784733284091354112</id><published>2023-09-16T01:54:00.001-07:00</published><updated>2023-09-22T23:56:02.296-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux - kernel"/><title type='text'>Linux Kernel（11.2）- mdev.conf</title><summary type="text">busybox實作了mdev來處理動態更新/dev, 這篇文章主要是mdev.txt心得記錄.

以下幾個範例是在init script做init的範例,

Here&#39;s a typical code snippet from the init script:
[0] mount -t proc proc /proc
[1] mount -t sysfs sysfs /sys
[2] echo /sbin/mdev &amp;gt; /proc/sys/kernel/hotplug
[3] mdev -s

Alternatively, without procfs the above becomes:
[1] mount -t sysfs sysfs /sys
[2] sysctl -w kernel.hotplug=/sbin/mdev
[3] mdev -s

基本上不論如何都要先</summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/4784733284091354112/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2023/09/linux-kernel112-mdevconf.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/4784733284091354112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/4784733284091354112'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2023/09/linux-kernel112-mdevconf.html' title='Linux Kernel（11.2）- mdev.conf'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-4941009994732167172</id><published>2023-09-15T17:55:00.011-07:00</published><updated>2023-09-17T06:37:51.258-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux - kernel"/><title type='text'>Linux Kernel（24.1）- fdisk Multimedia Card</title><summary type="text">這章節透過fdisk來了解底層的kernel相關的訊息, 為了方便學習, 這裡會使用qemu來模擬掛載eMMC. 
首先會透過qemu-img create創建一個1GByte的eMMC, 並透過qemu掛載起來,

[brook@:~/Projects/qemu]$ qemu-img create -f qcow2 emmc_image.qcow2 1G
Formatting &#39;emmc_image.qcow2&#39;, fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zli6
[brook@:~/Projects/qemu]$ qemu-img info emmc_image.qcow2
image: emmc_image.qcow2
file format: qcow2
virtual size: 1 GiB (</summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/4941009994732167172/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2023/09/linux-kernel241-fdisk-multimedia-card.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/4941009994732167172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/4941009994732167172'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2023/09/linux-kernel241-fdisk-multimedia-card.html' title='Linux Kernel（24.1）- fdisk Multimedia Card'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-2727616818939514213</id><published>2023-08-06T05:24:00.002-07:00</published><updated>2023-08-19T00:40:50.708-07:00</updated><title type='text'>Linux Kernel（22.1）- My Socket Domain and Protocol</title><summary type="text">本章主要參考Add a new protocol to Linux Kernel寫一個自創新的socket protocol family小範例, 主要要填寫“struct proto” (/include/net/sock.h) 與“struct net_proto_family” (/include/linux/net.h)相關的operation,再分別用proto_register(struct proto *)與sock_register(struct net_proto_famil*)去跟系統註冊, 並將struct proto_ops分配給socket, 讓對應的system call都能找到對應的operation去執行


首先要先呼叫“proto_register()”跟系統註冊protocol handler. 


struct my_sock {
  /* </summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/2727616818939514213/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2023/08/linux-kernel221-my-socket-domain-and.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/2727616818939514213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/2727616818939514213'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2023/08/linux-kernel221-my-socket-domain-and.html' title='Linux Kernel（22.1）- My Socket Domain and Protocol'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-8136338939872750199</id><published>2023-08-04T23:44:00.001-07:00</published><updated>2023-08-06T00:20:14.486-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux - kernel"/><title type='text'>Linux Kernel（21.1）- ID Allocation</title><summary type="text">如同ID Allocation的Overview提到的, kernel提供了對應的一些API, 用以產生與維護identifiers (IDs), 舉凡file descriptor, process IDs, device instance number等等. IDR主要多了ID與pointer的對用能力, 而IDA就是單純的分配ID, 本章透過簡單的程式碼讓大家能瞭解與使用IDA.

首先, 該範例是個簡易的kernel module, 透過DEFINE_IDA(my_ida)宣告一個my_ida變數, 這是我們, 並透過read file operation去取得一個新的ID(ida_simple_get), 在write file operation中透過寫入特定ID移除該ID(ida_simple_remove), 最後在移除kernel module時, 使用</summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/8136338939872750199/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2023/08/linux-kernel211-id-allocation.html#comment-form' title='2 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/8136338939872750199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/8136338939872750199'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2023/08/linux-kernel211-id-allocation.html' title='Linux Kernel（21.1）- ID Allocation'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-4392592363825190084</id><published>2023-01-01T00:00:00.012-08:00</published><updated>2023-09-24T02:41:18.206-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="- Table Of Content"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux - kernel"/><title type='text'>Table Of Content for tag &quot;Linux - kernel&quot;</title><summary type="text">Linux Kernel（1）- Linux Module簡介
Linux Modules（1.1）module parameters

Linux Kernel（2）- register char device
Linux Kernel（2.1）- MAJRO NUMBER RESERVED FOR DYNAMIC ASSIGNMENT

Linux Kernel（3）- procfs
Linux Kernel（3.1）- procfs之vector方式寫入
Linux Kernel（3.2）- procfs之symlink與mkdir

Linux Kernel（4）- seq_file
Linux Kernel（4.1）- seq_file之範例(fp/proc/devices.c)
Linux Kernel（4.2）- seq_file之single page

Linux </summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/4392592363825190084/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2014/06/table-of-content-for-tag-linux-kernel.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/4392592363825190084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/4392592363825190084'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2014/06/table-of-content-for-tag-linux-kernel.html' title='Table Of Content for tag &quot;Linux - kernel&quot;'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-2889373210273249701</id><published>2022-12-31T16:00:00.002-08:00</published><updated>2023-01-02T17:43:01.606-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux - kernel"/><title type='text'>Linux Kernel（19.1）- /sys/class/gpio usage</title><summary type="text">要能使用/sys/class/gpio就要先開啟相關kernel config如下, 如提示所說, 該ABI已經棄用, 改由character device /dev/gpiochipN取代,
不過這裡還是會簡單交代一下相關資訊, 作為紀錄.

  │ CONFIG_GPIO_SYSFS:                                                                             │
  │                                                                                                │
  │ Say Y here to add the legacy sysfs interface for GPIOs.</summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/2889373210273249701/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2022/12/linux-kernel191-sysclassgpio-usage.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/2889373210273249701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/2889373210273249701'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2022/12/linux-kernel191-sysclassgpio-usage.html' title='Linux Kernel（19.1）- /sys/class/gpio usage'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-5397973729823401418</id><published>2022-08-14T01:18:00.001-07:00</published><updated>2022-09-05T05:17:15.826-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="OPENSSL"/><title type='text'>RFC 1319 - MD2 Message-Digest Algorithm</title><summary type="text">Message Digest 演算法是以隨意長度的message作為input, 並產生128-bit的&quot;fingerprint&quot;或&quot;message &quot;digest&quot;.
雖然RFC後面有附上實作, 但是網路上這篇比較容易閱讀, 有助於理解MD2的演算法, 

/**
 * @file md2.c
 * @author .ukasz Grudnik (https://github.com/lukaszgrudnik)
 * @brief MD2 algorithm based on RFC documentation https://datatracker.ietf.org/doc/html/rfc1319
 * @version 0.1
 * @date 2022-06-26
 *
 * @copyright Copyright (c) 2022
 *
 */

#include &amp;lt</summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/5397973729823401418/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2022/08/rfc-1319-md2-message-digest-algorithm.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/5397973729823401418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/5397973729823401418'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2022/08/rfc-1319-md2-message-digest-algorithm.html' title='RFC 1319 - MD2 Message-Digest Algorithm'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-4101451626494398730</id><published>2022-07-10T00:36:00.003-07:00</published><updated>2022-07-10T00:36:42.014-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cmake"/><title type='text'>CMake - Step 4: Installing and Testing - Testing </title><summary type="text">這章節要來解釋如何在CMAKE中加入auto test功能, 主要是透過enable_testing()啟動testing功能, 並透過add_test()間接呼叫ctest執行測試, 以及set_tests_properties(PROPERTIES PASS_REGULAR_EXPRESSION)來驗證執行結果


# Require a minimum version of cmake.
# cmake_minimum_required(VERSION &amp;lt;min&gt;&amp;gt;[...&amp;lt;policy_max&amp;gt;] [FATAL_ERROR])
cmake_minimum_required(VERSION 3.10)

# Set the name of the project.
# project(&amp;lt;PROJECT-NAME&amp;lt; [&amp;lt;</summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/4101451626494398730/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2022/07/cmake-step-4-installing-and-testing_10.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/4101451626494398730'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/4101451626494398730'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2022/07/cmake-step-4-installing-and-testing_10.html' title='CMake - Step 4: Installing and Testing - Testing '/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-2936419135429783723</id><published>2022-07-02T17:30:00.001-07:00</published><updated>2022-07-09T20:47:29.375-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cmake"/><title type='text'>CMake - Step 4: Installing and Testing - Installing </title><summary type="text">
install() 用來產生installation rules, 這個章節主要談兩個install指令,install(TARGETS)與install(FILES).cmake的install選像是在3.15之後才支援, 之前的版本請直接用&quot;make install [DESTDIR=&amp;lt;destdir&amp;gt;]
          
[brook@:~/Projects/cmake/04]$ tree
.
`-- src
    |-- CMakeLists.txt
    |-- Config.h.in
    |-- hello.c
    `-- mymath01
        |-- CMakeLists.txt
        |-- mymath01.c
        `-- mymath01.h

2 directories, 6 files
[brook@</summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/2936419135429783723/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2022/07/cmake-step-4-installing-and-testing.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/2936419135429783723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/2936419135429783723'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2022/07/cmake-step-4-installing-and-testing.html' title='CMake - Step 4: Installing and Testing - Installing '/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-3079793675305105853</id><published>2022-06-26T11:30:00.000-07:00</published><updated>2022-06-27T04:57:13.816-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cmake"/><title type='text'>CMake - Step 3: Adding Usage Requirements for a Library</title><summary type="text">這個章節想表達, CMAKE可以透過以下這幾個API, 對include或link有更多的控制

  target_compile_definitions()
  target_compile_options()
  target_include_directories()
  target_link_libraries()

不過這章只提到target_include_directories(), 其INTERFACE/PUBLIC屬性可以讓consumer能找到該header file, 所以之前Step 2的list(APPEND EXTRA_INCLUDES &quot;${PROJECT_SOURCE_DIR}/MathFunctions&quot;)就可以移除了

[brook@:~/Projects/cmake/03]$ tree src
src
|-- CMakeLists.txt
|-- </summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/3079793675305105853/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2022/06/cmake-step-3-adding-usage-requirements.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/3079793675305105853'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/3079793675305105853'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2022/06/cmake-step-3-adding-usage-requirements.html' title='CMake - Step 3: Adding Usage Requirements for a Library'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-5760385556883569376</id><published>2022-06-25T09:30:00.000-07:00</published><updated>2022-06-27T04:54:53.108-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cmake"/><title type='text'>CMake - Step 2: Adding A Library As An Option</title><summary type="text">很多時候我們會在專案中決定使用哪個library, 這裡會舉個範例, 使用自訂的library或是使用系統的library,首先要在最上層的CMakeLists.txt中用option()定義我們的變數USE_MYMATH, on代表用自訂的library, 否則用系統的library, 所以相對應的target_link_libraries()與target_include_directories()也要根據USE_MYMATH稍微做一下調整, 所以我們用EXTRA_LIBS與EXTRA_INCLUDES分別去儲存對應的header file位置與相關的library資訊

# Require a minimum version of cmake.
# cmake_minimum_required(VERSION &amp;lt;min&gt;&amp;gt;[...&amp;lt;policy_max&amp;gt;] </summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/5760385556883569376/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2022/06/cmake-step-2-adding-library-as-option.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/5760385556883569376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/5760385556883569376'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2022/06/cmake-step-2-adding-library-as-option.html' title='CMake - Step 2: Adding A Library As An Option'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-6390074875749304381</id><published>2022-06-19T07:00:00.003-07:00</published><updated>2022-06-26T06:54:45.738-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cmake"/><title type='text'>CMake - Step 2: Adding a Library</title><summary type="text">這篇主要要談如何建立一個library, 首先我們再src底下創建目錄mymath01用來放置我們的library, 裡面的soucre code包含mymath01.c與mymath01.h, 所以src/CMakeList.txt需要用add_subdirectory(mymath01)告訴CMake要編譯src/mymath01, 而src/mymath01/CMakeList.txt需要描述如何編譯Library, 主要是用add_library()告訴CMake這個library要用哪些source code編譯.

[brook@:~/Projects/cmake/02]$ tree
.
`-- src
    |-- CMakeLists.txt
    `-- mymath01
        |-- CMakeLists.txt
        |-- mymath01</summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/6390074875749304381/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2022/06/cmake-step-2-adding-library.html#comment-form' title='2 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/6390074875749304381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/6390074875749304381'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2022/06/cmake-step-2-adding-library.html' title='CMake - Step 2: Adding a Library'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-1903920658476189558</id><published>2022-06-11T20:01:00.004-07:00</published><updated>2022-06-27T04:49:52.640-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="- Table Of Content"/><category scheme="http://www.blogger.com/atom/ns#" term="cmake"/><title type='text'>Table Of Content for &quot;CMake Tutorial&quot;</title><summary type="text">
Step 1: A Basic Starting Point
Step 2: Adding a Library
 - Step 2: Adding A Library As An Option
Step 3: Adding Usage Requirements for a Library
Step 4: Installing and Testing
Step 5: Adding System Introspection
Step 6: Adding a Custom Command and Generated File
Step 7: Packaging an Installer
Step 8: Adding Support for a Testing Dashboard
Step 9: Selecting Static or Shared Libraries
Step 10: </summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/1903920658476189558/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2022/06/table-of-content-for-cmake-tutorial.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/1903920658476189558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/1903920658476189558'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2022/06/table-of-content-for-cmake-tutorial.html' title='Table Of Content for &quot;CMake Tutorial&quot;'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-3100494768821721524</id><published>2022-06-03T18:54:00.047-07:00</published><updated>2022-06-18T04:57:49.618-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cmake"/><title type='text'>CMake - Step 1: A Basic Starting Point</title><summary type="text">本文是CMake Tutorial的心得,
CMake是一個用於build, test與package的cross-platform tool, 基本上是透過撰寫CMakeLists來描述如何build, test與package專案,接著會產生makefile, 再透過makefile產生最終的target(executable, library, or both)

讓我們從最簡單的CMakeLists.txt開始,基本上CMakeLists.txt的指令是不分大小寫的

# Require a minimum version of cmake.
# cmake_minimum_required(VERSION &amp;lt;min&gt;&amp;gt;[...&amp;lt;policy_max&amp;gt;] [FATAL_ERROR])
cmake_minimum_required(VERSION 3.10)</summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/3100494768821721524/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2022/06/cmake-step-1-basic-starting-point.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/3100494768821721524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/3100494768821721524'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2022/06/cmake-step-1-basic-starting-point.html' title='CMake - Step 1: A Basic Starting Point'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-833311991634918642</id><published>2022-05-07T09:00:00.003-07:00</published><updated>2022-06-14T07:01:29.741-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux - kernel"/><title type='text'>Linux Kernel（2.1）- MAJRO NUMBER RESERVED FOR DYNAMIC ASSIGNMENT</title><summary type="text">
Documentation/admin-guide/devices.txt 文檔中描述了各個major number的用途, 而這文章的重點是dynamic的範圍從234~254與384~511

 234-254 char	RESERVED FOR DYNAMIC ASSIGNMENT
		Character devices that request a dynamic allocation of major number will
		take numbers starting from 254 and downward.

 384-511 char	RESERVED FOR DYNAMIC ASSIGNMENT
		Character devices that request a dynamic allocation of major
		number will take </summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/833311991634918642/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2022/05/linux-kernel21-majro-number-reserved.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/833311991634918642'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/833311991634918642'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2022/05/linux-kernel21-majro-number-reserved.html' title='Linux Kernel（2.1）- MAJRO NUMBER RESERVED FOR DYNAMIC ASSIGNMENT'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-2883890595783438117</id><published>2022-04-02T09:00:00.021-07:00</published><updated>2022-06-13T03:31:10.402-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Embedded"/><title type='text'>run Cortex-A57 with kernel 5.4 on qemu</title><summary type="text">這篇文章只是拿來記錄compile Kernel for Cortex-A57, 用於研究PCIe Driver, 其餘的rootfs與busybox請參考附錄

[brook@:~/Projects/qemu/linux-virt]$ sudo apt-get install gcc-aarch64-linux-gnu #for ARM64
[brook@:~/Projects/qemu/linux-virt]$ export ARCH=arm64
[brook@:~/Projects/qemu/linux-virt]$ export CROSS_COMPILE=aarch64-linux-gnu-
[brook@:~/Projects/qemu/linux-virt]$ cp arch/arm64/configs/defconfig .config
[brook@:~/</summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/2883890595783438117/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2022/04/run-cortex-a57-with-kernel-54-on-qemu.html#comment-form' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/2883890595783438117'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/2883890595783438117'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2022/04/run-cortex-a57-with-kernel-54-on-qemu.html' title='run Cortex-A57 with kernel 5.4 on qemu'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-8852789498174968056</id><published>2022-03-26T19:12:00.004-07:00</published><updated>2022-04-23T19:34:10.237-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="tools - devel - gdb"/><title type='text'>GDB - jump - 17.2 Continuing at a Different Address</title><summary type="text">jump顧名思義就是跳到某一行開始執行, 而且是會立刻執行直到遇到breakpoint. 因為jump並不會對stack, memory, 或register有任何改變(除了PC/program counter), 也因此jump的範圍需要在同一個function內部, 避免crash.

你也可以用set $pc=&amp;lt;execute_address&amp;gt; + &quot;continue&quot;, &quot;next&quot;, &quot;step&quot;替代

Type &quot;apropos word&quot; to search for commands related to &quot;word&quot;...
Reading symbols from a.out...done.
(gdb) set listsize unlimited
(gdb) list
1       #include &amp;lt;stdio.h&amp;gt;
2
3       </summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/8852789498174968056/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2022/03/gdb-jump-172-continuing-at-different.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/8852789498174968056'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/8852789498174968056'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2022/03/gdb-jump-172-continuing-at-different.html' title='GDB - jump - 17.2 Continuing at a Different Address'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-3285493497529911188</id><published>2022-02-27T04:42:00.002-08:00</published><updated>2022-04-17T06:32:40.568-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C - Lib - cgic"/><title type='text'>lighttpd &amp; CGI note</title><summary type="text">CGIC提供了簡單的API, 存取那一些CGIC已經幫你parse好的資料,比如: cgiRequestMethod, cgiRemoteAddr, cgiScriptName, 以及POST/GET資料等等, header的資料可以透過environ讀取
可以透過cgiFormEntries(char ***result)抓key, 再透過cgiFormString(char *name, char *result, int max)取得資料, 


#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;cgic.h&amp;gt;
extern char **environ;

int cgiMain() {
  char **array, **arrayStep, val[64];
  fprintf(cgiOut, &amp;quot;cgiRequestMethod:%s</summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/3285493497529911188/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2022/02/lighttpd-cgi-note.html#comment-form' title='1 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/3285493497529911188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/3285493497529911188'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2022/02/lighttpd-cgi-note.html' title='lighttpd &amp; CGI note'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-2760767686696333652</id><published>2022-01-01T04:10:00.002-08:00</published><updated>2022-05-21T19:59:40.006-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Design Patterns with C"/><title type='text'>A pattern for command table</title><summary type="text">我們常常會需要比對字串/指令後, 執行對應的function, 常見的就是用for loop把command table比對過一次, 但是如果command table大, 效率就不好, 可以用qsort()+bsearch()做binary search以提升效率.


#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;string.h&amp;gt;

typedef void (*cmd_fp)(char *cmd);

/*
 * command function
 */
void hello(char *cmd)
{
    printf(&amp;quot;%s(#%d)\n&amp;quot;, __FUNCTION__, __LINE__);
}

/*
 * command function
 */
void world(char *cmd)
{
    printf</summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/2760767686696333652/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2022/01/a-pattern-for-command-table.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/2760767686696333652'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/2760767686696333652'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2022/01/a-pattern-for-command-table.html' title='A pattern for command table'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-7809657538468828618</id><published>2021-01-10T05:59:00.003-08:00</published><updated>2021-01-10T05:59:32.656-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux - kernel"/><title type='text'>Linux Kernel（21）- Pulse-Width Modulation</title><summary type="text">Duty cycle，所謂的Duty Cycle指的是一段時間內on的百分比(The term duty cycle describes the proportion of &#39;on&#39; time to the regular interval or &#39;period&#39; of time)，如下圖



Polarity，這裡的Polarity指的是high active或是low active，

 * @PWM_POLARITY_NORMAL: a high signal for the duration of the duty-
 * cycle, followed by a low signal for the remainder of the pulse
 * period
 * @PWM_POLARITY_INVERSED: a low signal for the duration</summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/7809657538468828618/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2021/01/linux-kernel21-pulse-width-modulation.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/7809657538468828618'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/7809657538468828618'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2021/01/linux-kernel21-pulse-width-modulation.html' title='Linux Kernel（21）- Pulse-Width Modulation'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIiwKgVa_rEhSWrGntRwCIeWIoY3BGskb1cknaUPzTSn2GPwA0mOV4Owy9mymjMh6AjILFA_iwRsG8XAigCyjcWJufyXR6ROSpO6jibskUb-DLe2QZrLkCAXMT8k9SyK4y_q3HiFr3YWA/s72-c/Duty_Cycle_Examples.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7422594244561083816.post-4685704933385094961</id><published>2020-11-28T23:24:00.001-08:00</published><updated>2020-12-05T02:11:50.491-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="LTE/5G"/><title type='text'>LTE-U and LAA</title><summary type="text">LTE-Unliceded（LTE-U/3GPP Rel-10/11/12）最早是由Qualcomm提出的LTE標準，旨在允許Operator透過ISM(Industrial Scientific Medical Band/5GHz)頻帶取得更大的頻寬。control channel需要走LTE，而data走5GHz 頻段，所以要搭配CA(Carrier Aggregation)以及SDL(Supplemental Downlink)完成該功能，該5G頻段為LTE Band 46。


LAA(Licensed Assisted Access)是LTE-U的進化版，並提入3GPP Rel-13，隨後還有3GPP Rel-14的eLAA(enhanced-LAA)以及3GPP Rel-14的feLAA(Further Enhanced LAA)。


LTE-U 與 LAA 主要的差異在於</summary><link rel='replies' type='application/atom+xml' href='http://nano-chicken.blogspot.com/feeds/4685704933385094961/comments/default' title='張貼留言'/><link rel='replies' type='text/html' href='http://nano-chicken.blogspot.com/2020/11/lte-u-and-laa.html#comment-form' title='0 個意見'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/4685704933385094961'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7422594244561083816/posts/default/4685704933385094961'/><link rel='alternate' type='text/html' href='http://nano-chicken.blogspot.com/2020/11/lte-u-and-laa.html' title='LTE-U and LAA'/><author><name>c.s.</name><uri>http://www.blogger.com/profile/03475558407716533756</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqUTdeIBBMaPNAfxt9OBjcN8Ebi3m5K8F1Y6dccDUiq5FAmP1jm9Y1vtbP-tk8gW8PIJYItLyBY5OiqGnYJvEGEghrBIaOWpTAhertttEsSHaIJyqA6sd910UElAyxegk/s113/12525143_1197540430260299_7519008264114967925_o.jpg'/></author><thr:total>0</thr:total></entry></feed>