今天要把 MAC address 由字串轉成 16 進制數字時,才發現很麻煩。因為它是 6 個 bytes,太長了。尋找解決的過程經歷了一些故事,所以來記錄一下。
其實之前有碰到 memory address 的部份,由使用者輸進來的是字串,但運算時常常需要把它轉成 16 進制數字。在我手上的程式一般是使用 simple_strtoul 這個函式,但是它的傳回值是 unsigned long ,只有 4 個 bytes,所以長度不夠。
2014年1月28日 星期二
2014年1月23日 星期四
用軟體產生 flash image。
一般來說,要得到 flash 的 image 檔,應該是把你要的資料先用軟體的方式寫進去。全部寫完之後,再把 flash 拿到燒錄機去,用燒錄機讀出來。
但是這過程中,如果板子上沒有 socket 那就要解焊,解焊當然也是有風險。而且像我自己不會弄就要求助於人。然後我們公司燒錄機都在硬體部門,就要去借用,還可能要排隊。
因此,如果能用軟體就產生這樣的 image 會比較方便。
但是這過程中,如果板子上沒有 socket 那就要解焊,解焊當然也是有風險。而且像我自己不會弄就要求助於人。然後我們公司燒錄機都在硬體部門,就要去借用,還可能要排隊。
因此,如果能用軟體就產生這樣的 image 會比較方便。
2013年12月26日 星期四
Trace fdisk source in busybox 心得
When you use "fdisk /dev/sda", fdisk will set disk_device(this is an global) to "/dev/sda".
Then into the main loop.
If you enter "n" it will call new_partition().
The key point of new_partition() is add_partition(index, type);
The size is set in the read_int() of add_partition()
Then into the main loop.
If you enter "n" it will call new_partition().
The key point of new_partition() is add_partition(index, type);
The size is set in the read_int() of add_partition()
2013年6月20日 星期四
Cavium Octeom u-boot 設定檔
常常在找一些設定值寫在什麼檔裡面,留下來備忘一下:
bootcode environment variables:
bootloader/u-boot/include/configs/octeon_dwc2000.h
bootcode environment variables:
bootloader/u-boot/include/configs/octeon_dwc2000.h
dts設定檔:
bootloader/u-boot/board/octeon/dwc2000/dwc2000.dts
bootcode init:(本來應該不算設定檔,但有同事在這加了 env 變數)
bootloader/u-boot/arch/mips/lib/board_octeon.c
後來發現,實際上所有的 environment variables 都應該 define 在 bootloader/u-boot/include/configs/octeon_dwc2000.h 中,也許有些本來是沒有 define,像是 CONFIG_BOOTCOMMAND(bootcmd)預設是沒有 define 的,要自己加上去。不應該加在 bootloader/u-boot/arch/mips/lib/board_octeon.c 裡面。
後來發現,實際上所有的 environment variables 都應該 define 在 bootloader/u-boot/include/configs/octeon_dwc2000.h 中,也許有些本來是沒有 define,像是 CONFIG_BOOTCOMMAND(bootcmd)預設是沒有 define 的,要自己加上去。不應該加在 bootloader/u-boot/arch/mips/lib/board_octeon.c 裡面。
訂閱:
文章 (Atom)