翻舊帳

2017年11月30日 星期四

小樂

好吃.



這家在新店家樂福旁邊的小店, 我們之前經過多次, 只覺得人聲鼎沸, 卻懶得排隊.
直到某天時機恰巧, 剛進去就坐到了最後一個空桌, 從此一試成主顧.

2017年11月28日 星期二

µPD720201 init fail on Linux

開機過程中, 掛載driver時出現 stall on CPU 2 的訊息.
/proc/bus/pci/devices 裡面看得到µPD720201的編號, 卻沒有辦法正確init.

原因很簡單, µPD720201需要外部的ROM存放FW, 如果ROM沒有上或是裡面沒有燒FW, 就會出現這個狀況.

2017年10月13日 星期五

free(): invalid next size (fast)

我參考Linux man page的code:
#define _GNU_SOURCE
#include
#include

int
main(void)
{
FILE *fp;
char *line = NULL;
size_t len = 0;
ssize_t read;

fp = fopen("/etc/motd", "r");
if (fp == NULL)
exit(EXIT_FAILURE);

while ((read = getline(&line, &len, fp)) != -1) {
printf("Retrieved line of length %zu :\n", read);
printf("%s", line);
}

free(line);
exit(EXIT_SUCCESS);
}

針對getline()產生的line buffer, 在最後將它free, 卻得到free(): invalid next size (fast).

最後我改用另一種寫法, 先malloc一塊夠大的buffer給line pointer, 然後, 然後就沒有error了.
len = 512;
line = malloc(len);
while( (ret = getline(&line, (size_t *)&len, fp)) != -1 ) {
if(line[0] == '#') continue; //comment
}
if(line != NULL) free(line);

2017年9月1日 星期五

編譯 toolchain, 出現 texi 相關的文件 error

output/toolchain/gcc-4.3.5/gcc/doc/cppopts.texi:757: @itemx must follow @item
make[2]: *** [doc/cpp.info] Error 1

編譯 buildroot 時, 遇到的問題.
這個問題是因為 textinfo 版本太新所造成的.
解法在此: https://git.busybox.net/buildroot/commit/?id=62322acb2ce186d544ab21fe253ccc8561a68a48
Related Posts Plugin for WordPress, Blogger...