發表文章

MAC OS X 10.10 minicom USB to serial 安裝

1. 下載 minicom 2.7 https://alioth.debian.org/projects/minicom/ 2.解開後 ./configure (我的安裝時說automake需要安裝Xcode,就安裝先囉) make sudo make install 3. 上usb-to-serial cable網站我的chip是PL2303 -> 系統偏好設定>安全性與隱私>允許安裝 查詢我的設備是tty.usbserial ls -1 /dev/tty .* /dev/tty.usbserial  4.執行minicom -s 設定> Serial port setup -> A - Serial Device: /dev/tty.usbserial -> F - Hardware Flow Control: NO 選: save setup as dfl  -> 發現錯誤 sudo mkdir /usr/local/etc -> sudo chmod 777 /usr/local/etc nailed it!!!

Linux VLAN 筆記

圖片
Linux VLAN 筆記  kernel 開啟802.1q功能後,便可以透過簡單指令,設定VLAN.  brctl delif br0 ath0 brctl delif br0 eth0 vconfig add ath0 555 vconfig add eth0 555 ifconfig ath0.555 up brctl addbr br555 brctl addif br555 ath0.555 brctl addif br555 eth0.555 ifconfig ath0.555 up ifconfig eth0.555 up ifconfig br555 10.0.0.11 up Wireless AP mode運作正常,抓無線封包有看到帶了VLAN ID 555. 不幸的是,我的Wireless STA,不能成功ping到我的AP,只好下去看程式,這邊有幾個部份要看.  1. Linux kernel 802.1q  2.Wireless driver.(我手邊的是Atheros proprietary LSDK driver,所以這部份內容都不會放上來)  3.hostapd跟wpa_supplicant.    Linux的net_dev是用一個list串起來,每個net_dev都有會呼叫ev_queue_xmit ->dev_hard_start_xmit ,去傳送封包至下一步。  vlan.c::vlan_proto_init()時會invoke,dev_add_pack(&vlan_packet_type);  static struct packet_type vlan_packet_type __read_mostly = {         .type = cpu_to_be16(ETH_P_8021Q),         .func = vlan_skb_r...

自己動手做OS之Raspberry Pi MMU initialization.

圖片
寫了一個簡單的bare metal啟動MMU的程式, 把實際位址0x20000000~0x210000000 對應到虛擬位址0xa0000000~0xa1000000 ARM MMU的部份在ARMv6之前跟之後的版本不同, 請看Technical Reference Manual。 Raspberry Pi MMU initialization example. hackpad note:https://lbd.hackpad.com/MMU-initialization-Jl8YoJ3iUdf source code:https://github.com/tzuCarlos/RaspberryPi/tree/master/labMMU 為什麼需要MMU? TODO:.... 頁表(page table)是由頁表項(page table entry, PTE)組成的 。 每一個PTE包含一段虛擬位址(page)映射到一段實體位址的資訊,而page的大小依ARM core版本不同,有不同的支持1K(tiny page), 4K(small page), 64k(large page), 1MB, 16MB。 page的大小決定了映射的粒度(granularity):  如果我們把page切1MB,那64MB的記憶體就需要64MB/1MB的PTE,每個PTE是32bits(4bytes),64x4=256bytes頁表項空間。4G就是4096x6=16384=16K 切1K,4K,64K需要用二級查表,1MB,64MB用一級查差,二級差表用途是縮小PTE,以減少佔用記憶體空間,但降底了尋址的效率。 16M的page叫super section, 1M的叫section。 L1表還有個名稱叫page directory entry(PDE)。 ARM 的位址轉換涉及底下三種位址[1]: 虛擬位址 (Virtual Address,VA): CPU 送出的位址。 修改後的虛擬位址 (Modified Virtual Address,MVA): 快取和 MMU 看到的是 MVA。 物理位址 (Physical Address,PA): 內存看到的是 PA。 ...