原创 一些GCC的宏

1. — Built-in Function: int __builtin_constant_p (exp)     You can use the built-in function __builtin_constant_p to de

原创 一些wince的小知識

struct kdata: saved at 0xffffc800, which stored the current kernel information 點贊 收藏 分享 文章舉報

原创 如何讓sudo不需要輸入密碼就執行

sudo visudo 編輯文件,如下所示:   # /etc/sudoers # # This file MUST be edited with the 'visudo' command as root. # # See the man

原创 My Kernel patch

https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/log/?qt=author&q=Peter+Chen

原创 兩種禁止USB autosuspend的方法

在有些情況下,由於低功耗情況下,USB硬件的bug或者提高USB resume的速度,我們需要禁止USB的 autosuspend,下面是兩種方法。 1: 在bootloader的bootargs里加上“usbcore.autosuspe

原创 udev建立設備節點的規則

1. 設備要在下面任一一組目錄下 /sys/subsystem/devices /sys/bus/devices, /sys/class/, /sys/block   2. 上面這些目錄下面的設備目錄裏要有uevent子項, 當用戶程序

原创 爲什麼USB Audio會產生jitter或數據丟失

1.  Host太繁忙,導致Host USB的數據包未來得及在指定時間(比如1ms)送到USB buffer處。 2. Device端的USB(PHY)和audio clock(I2S, LRCLK)的clock無法精確同步,比如full

原创 Linux Linker 的順序

今天發現initramfs的產生比driver的加載早,感覺有點奇怪,仔細看了一下。 1. init/initramfs.c rootfs_initcall(populate_rootfs); 2. include/linux/ini

原创 LDO和DC-DC器件的區別

DCDC的意思是直流變(到)直流(不同直流電源值的轉換),只要符合這個定義都可以叫DCDC轉換器,包括LDO。但是一般的說法是把直流變(到)直流由開關方式實現的器件叫DCDC。      LDO 是低壓降

原创 Linux下timer延時的使用

因筆者工作在嵌入式平臺上(非x386),下面給出的結論僅在arm平臺上測試過。 1. 在原子上下文,延遲應該少於100微秒。 使用udelay 2. 在非原子上下文延遲的使用 0-100us: 使用udelay 100us以上: 使用u

原创 淺談USB的安全性

最近看到一些有關BadUSB的報道,說的是usb device的firmware被重新燒寫,新的firmware能把U盤,同時當成HID或者Ethernet device, 然後其中的惡意代碼,可以通過HID設備輸入一些命令從而hack

原创 在沒有打印以及ICE無法連接的情況下,如何知道kernel hang的位置

前提是reset板子不會照成memory被reset 方法一(已測試): 1. 打開你的System.map文件,找到symbol: __log_buf 比如:806d6f88 b __log_buf 這裏的地址0x806d6f88是虛擬

原创 How to submit a patch to upsream

//git format patch git format-patch --subject-prefix="U-Boot][PATCH Vx" --stat -p -n -git format-patch

原创 一個關於USB Interface的例子

今天幫ML裏的哥們試一個configfs的問題, 又重新認識了一下USB interface。原來,一個function可以有多個interface的, 以前一直認爲只有一個。看下面的cat /sys/kernel/debug/usb/d

原创 oprofile的使用方法

1. opcontrol --init 2. opcontrol --no-vmlinux 3. opcontrol --start 4. ./your_app 5. opcontrol --dump 6. opcontrol --sto