因為項目的需要,本來只是做測量平台,後來因為導師要求,要加上攝像頭來監控,於是查了一上午的文檔,不想自己寫驅動,也沒有必要寫驅動,所以,就找萬能驅動最後找到gscape,在現在的內核上本來就由支持,所以,不需要自己下載源碼包了,在編譯內核的時候自己選擇上就可以了,如果在編譯選項裡面沒有,那麼你就要修改kconfig和makefile文件添加上就可以了,現在再說抓圖軟件,就是涉及到圖像的v4l系列的變成,我網上查了下,發現vgrabbj-0.9.6是個不錯了抓圖軟件,在交叉編譯的時候遇到不少麻煩,現在將遇到的問題集中下,以防下次再次出現:
問題一:
- arm-none-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wall -c vgrabbj.c
- vgrabbj.c: In function 'read_image':
- vgrabbj.c:287: warning: pointer targets in return differ in signedness
- vgrabbj.c: In function 'conv_image':
- vgrabbj.c:302: warning: pointer targets in assignment differ in signedness
- vgrabbj.c:333: warning: pointer targets in assignment differ in signedness
- vgrabbj.c:336: warning: pointer targets in return differ in signedness
- vgrabbj.c: In function 'main':
- vgrabbj.c:359: warning: pointer targets in assignment differ in signedness
- vgrabbj.c:360: warning: pointer targets in assignment differ in signedness
- vgrabbj.c:363: warning: pointer targets in assignment differ in signedness
- vgrabbj.c:366: warning: pointer targets in assignment differ in signedness
- arm-none-linux-gnueabi-gcc -DHAVE_CONFIG_H -I. -I. -I. -g -O2 -Wall -c v_config.c
- In file included from v_config.h:28,
- from v_config.c:26:
- v_options.h:26: error: static declaration of 'l_opt' follows non-static declaration
- vgrabbj.h:307: error: previous declaration of 'l_opt' was here
- v_config.c: In function 'init_defaults':
- v_config.c:186: error: lvalue required as unary '&' operand
- v_config.c:187: error: lvalue required as unary '&' operand
- v_config.c:188: error: lvalue required as unary '&' operand
- v_config.c:190: error: lvalue required as unary '&' operand
- v_config.c:194: error: lvalue required as unary '&' operand
- v_config.c:200: error: lvalue required as unary '&' operand
- v_config.c:201: error: lvalue required as unary '&' operand
- v_config.c:242: error: lvalue required as unary '&' operand
- v_config.c:244: error: lvalue required as unary '&' operand
- v_config.c:246: error: lvalue required as unary '&' operand
- v_config.c:248: error: lvalue required as unary '&' operand
- v_config.c:250: error: lvalue required as unary '&' operand
- v_config.c: In function 'decode_options':
- v_config.c:490: error: lvalue required as left operand of assignment
- make: *** [v_config.o] Error 1
開始找原因了,百谷了下,問這樣的問題的人多,但是,回答的沒多少,沒辦法,只能去國外網站上查啊,發現有個對應的補丁文件,如是下載下來,看能否問題有好轉,
下載下來,打上補丁:patch -p1 < vgrabbj_0.9.6-3.1.diff
再次編譯,出現問題二:
問題二:
- WARNING: `automake-1.4' is needed, and you do not seem to have it handy on your
- system. You might have modified some files without having the
- proper tools for further handling them. Check the `README' file,
- it often tells you about the needed prerequirements for installing
- this package. You may also peek at any GNU archive site, in case
- some other package would contain this missing `automake-1.4' program.
- make: *** [Makefile.in] Error 1
很明顯的提示:automake-1.4,我查看我的版本是1-11,看來太新了也不行,果斷卸載重裝1.4,然後編譯,順利通過。
運行是的問題:
交叉編譯過後,就下載在ARM板上運行,提示錯誤很多,修改了配置文件,等原因,還是有問題,回到源代碼,對比信息,發現是設置圖像屬性是出問題,即IOCTL函數出問題,也找了一天,研究代碼,最後確定問題在內核,重新編譯內核,在USB選項下也要選擇對應的選項,最後成功了,運行時錯誤信息記錄在實驗室電腦上,沒在寢室電腦上,就不記錄了,歡迎和大家交流。