| ? linux內核移植 一,硬件環境: 友善之臂 tiny6410 開發板 開發主機Linux系統:fedora 10 編譯器:arm-linux-gcc-4.5.1 二,內核實現的功能: ??? nandflash驅動(必須的,不然內核起不來),音頻驅動(ALSA),視頻驅動(USB攝像頭),網卡驅動,LCD驅動,一線觸摸驅動,USB驅動,SD卡驅動。 三, 移植步驟: 1, 從管方網站下載linux-2.6.38源碼。 2,解壓到相關目錄,進入內核根目錄 3,把目錄下linux-2.6.38/arch/arm/configs下的s3c6400_defconfig拷貝到內核根目錄下,改名為.config.作為參考配置文件使用。 4, 進入內核根目錄,修改Makefile文件,把體系項改成arm,編譯器修改成arm-linux-gcc. 5,? 用命令make menucofnig,進入配置界面,這里先什么都不用做,然后關閉就行了。如下圖: 6,make zImage編譯 7,如果沒有出錯,會在arch/arm/boot下面聲明zImage文件,也就是目標文件。 8,將這個文件燒到開發板,不好意思,什么都不能做,沒跑幾步就死了。但整個配置,編譯流程就是這個樣子的。 9,分析原因,為什么不能跑。 ?????? 想要使內核能完成最最基本的功能,即引導文件系統,我們還缺少兩樣東西,其一,目前的內核都不支撐MLC的NANDFLASH芯片,而我們的開發板用的正是這個芯片,所以這個芯片驅動要自己完成。其二,要配置內核,讓其支撐相應的文件系統。 四,MLC NANDFLASH驅動移植,在這里,我直接把友善的驅動考過來。 1, 把drivers/mtd/nand/s3c_nand.c和arch/arm/plat-samsung/include/plat/regs-nand.h兩個文件可以從友善的源碼中拷貝過來,這是他們自己寫的,當然drivers/mtd/nand/s3c_nand_mlc.fo也要拷貝過來,這是友善沒有開源的一個驅動之一,所以不用研究了,拷過來就是了。 修改drivers/mtd/nand/nand_base.c文件 修改方法如下,“-”就是要去掉的內容,“+”就是要增加的內容,@@后面的是行號, 嫌麻煩的的直接將drivers/mtd/nand/nand_base.c拷過來覆蓋掉 static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip) { -????int page, chipnr, res = 0; +????int page, res = 0; ???? struct nand_chip *chip = mtd->priv; ???? u16 bad; @@ -351,6 +351,8 @@ ???? page = (int)(ofs >> chip->page_shift) & chip->pagemask; +#if 0 +????/* Moved to nand_block_checkbad() for chip specify support */ ???? if (getchip) { ???????? chipnr = (int)(ofs >> chip->chip_shift); @@ -359,6 +361,7 @@ ???????? /* Select the NAND device */ ???????? chip->select_chip(mtd, chipnr); ???? } +#endif ???? if (chip->options & NAND_BUSWIDTH_16) { ???????? chip->cmdfunc(mtd, NAND_CMD_READOOB, chip->badblockpos & 0xFE, @@ -378,8 +381,10 @@ ???? else ???????? res = hweight8(bad) < chip->badblockbits; +#if 0 ???? if (getchip) ???????? nand_release_device(mtd); +#endif ???? return res; } @@ -477,9 +482,26 @@ ????????????????????int allowbbt) { ???? struct nand_chip *chip = mtd->priv; +????int chipnr, res = 0; + +????/* Chip specify block_bad() support */ +????if (!chip->bbt) { +????????if (getchip) { +????????????chipnr = (int)(ofs >> chip->chip_shift); -????if (!chip->bbt) -????????return chip->block_bad(mtd, ofs, getchip); +????????????nand_get_device(chip, mtd, FL_READING); + +????????????/* Select the NAND device */ +????????????chip->select_chip(mtd, chipnr); +????????} + +????????res = chip->block_bad(mtd, ofs, getchip); + +????????if (getchip) +????????????nand_release_device(mtd); + +????????return res; +????} ???? /* Return info from the table */ ???? return nand_isbad_bbt(mtd, ofs, allowbbt); @@ -3002,23 +3024,15 @@ ???????????????? id_data[0] == NAND_MFR_SAMSUNG && ???????????????? (chip->cellinfo & NAND_CI_CELLTYPE_MSK) && ???????????????? id_data[5] != 0x00) { +????????????int __oobsz[] = { 0, 128, 218, 400 }; ???????????? /* Calc pagesize */ ???????????? mtd->writesize = 2048 << (extid & 0x03); ???????????? extid >>= 2; ???????????? /* Calc oobsize */ -????????????switch (extid & 0x03) { -????????????case 1: -????????????????mtd->oobsize = 128; -????????????????break; -????????????case 2: -????????????????mtd->oobsize = 218; -????????????????break; -????????????case 3: -????????????????mtd->oobsize = 400; -????????????????break; -????????????default: +????????????if (extid & 0x10) { ???????????????? mtd->oobsize = 436; -????????????????break; +????????????} else { +????????????????mtd->oobsize = __oobsz[(extid & 0x03)]; ???????????? } ???????????? extid >>= 2; ???????????? /* Calc blocksize */ @@ -3099,16 +3113,21 @@ ???? /* Calculate the address shift from the page size */ ???? chip->page_shift = ffs(mtd->writesize) - 1; + ???? /* Convert chipsize to number of pages per chip -1. */ -????chip->pagemask = (chip->chipsize >> chip->page_shift) - 1; +????if (!chip->pagemask) { +????????chip->pagemask = (chip->chipsize >> chip->page_shift) - 1; +????} ???? chip->bbt_erase_shift = chip->phys_erase_shift = ???????? ffs(mtd->erasesize) - 1; -????if (chip->chipsize & 0xffffffff) -????????chip->chip_shift = ffs((unsigned)chip->chipsize) - 1; -????else { -????????chip->chip_shift = ffs((unsigned)(chip->chipsize >> 32)); -????????chip->chip_shift += 32 - 1; +????if (!chip->chip_shift) { +????????if (chip->chipsize & 0xffffffff) +????????????chip->chip_shift = ffs((unsigned)chip->chipsize) - 1; +????????else { +????????????chip->chip_shift = ffs((unsigned)(chip->chipsize >> 32)); +????????????chip->chip_shift += 32 - 1; +????????} ???? } ???? /* Set the bad block position */ @@ -3126,8 +3145,11 @@ ??????*/ ???? if ((chip->cellinfo & NAND_CI_CELLTYPE_MSK) && ???????????? (*maf_id == NAND_MFR_SAMSUNG || -???????????? *maf_id == NAND_MFR_HYNIX)) -????????chip->options |= NAND_BBT_SCANLASTPAGE; +???????????? *maf_id == NAND_MFR_HYNIX)) { +????????if (mtd->writesize < 4096) { +????????????chip->options |= NAND_BBT_SCANLASTPAGE; +????????} +????} ???? else if ((!(chip->cellinfo & NAND_CI_CELLTYPE_MSK) && ???????????????? (*maf_id == NAND_MFR_SAMSUNG || ??????????????????*maf_id == NAND_MFR_HYNIX || 2,然后修改drivers/mtd/nand/Kconfig和drivers/mtd/nand/Makefile文件 在drivers/mtd/nand/Kconfig??238行增加 config MTD_NAND_S3C ????tristate "NAND Flash support for S3C SoC" ????depends on (ARCH_S3C64XX || ARCH_S5P64XX || ARCH_S5PC1XX) && MTD_NAND ????help ??????This enables the NAND flash controller on the S3C. ??????No board specfic support is done by this driver, each board ??????must advertise a platform_device for the driver to attach. config MTD_NAND_S3C_DEBUG ????bool "S3C NAND driver debug" ????depends on MTD_NAND_S3C ????help ??????Enable debugging of the S3C NAND driver configMTD_NAND_S3C_HWECC ????bool "S3C NAND Hardware ECC" ????depends on MTD_NAND_S3C ????????help ??????Enable the use of the S3C's internal ECC generator when ??????using NAND. Early versions of the chip have had problems with ??????incorrect ECC generation, and if using these, the default of ??????software ECC is preferable. ??????If you lay down a device with the hardware ECC, then you will ??????currently not be able to switch to software, as there is no ??????implementation for ECC method used by the S3C drivers/mtd/nand/Makefile中20行增加 obj-$(CONFIG_MTD_NAND_S3C)????????????+= s3c_nand.o 末尾再增加 S3C_NAND_MLC_SRC = $(shell ls drivers/mtd/nand/s3c_nand_mlc.c 2>/dev/null) ifeq ($(S3C_NAND_MLC_SRC),) obj-$(CONFIG_MTD_NAND_S3C)????????????+= s3c_nand_mlc.fo else obj-$(CONFIG_MTD_NAND_S3C)????????????+= s3c_nand_mlc.o endif 3,然后make menuconfig ?? Device Drivers--->? ???????????? <*> Memory Technology Device (MTD) support??---> ???????????????????????????? [*]?? MTD partitioning support ??????????????????????????????[*]???? Command line partition table parsing? ???????????????????????????? <*>?? Direct char device access to MTD devices? ????????????????????????????<*>?? Caching block device access to MTD devices ????????????????????????????<*>?? NAND Device Support??---> ??????????????????????????????????????????????????????< >?? NAND Flash support for Samsung S3C SoCs??去掉不要選 ??????????????????????????????????????????????????????<*>?? NAND Flash support for S3C SoC?? ??????????????????????????????????????????????????????????????????[*]???? S3C NAND Hardware ECC 4,好了,make zImage就可以了,啟動信息里可以看到NAND成功。如下: S3C NAND Driver, (c) 2008 Samsung Electronics MLC nand initialized, 2011 ported by FriendlyARM S3C NAND Driver is using hardware ECC. NAND device: Manufacturer ID: 0xec, Chip ID: 0xd5 (Samsung NAND 2GiB 3,3V 8-bit) 五,現在NANDFLASH驅動可以支持了,但啟動后你會發現,內核還是引導不了文件系統,這是因為,你沒有讓內核支持文件系統。那么,怎么讓內核支持文件系統呢?那要看你用的是什么文件系統,如果用NFS的話就配置讓它支撐NFS,我用的是UBI文件系統,所以我這里就配置讓它支持UBI。 1, 進入內核根目錄,make menuconfig 看到沒,進去,改選的都選上。 ?????? 配置內核是一件很有學問的事情,需要長期慢慢摸索,在這里我花了不少時間,最后還算是搞定了。 ?????? 進去后看到下面內容: ? ? 進去, 該選的都選上。 2,make zImage搞定,如果不出意外,可以引導文件系統了。 六,LCD屏驅動 vi arch/arm/plat-samsung/include/plat/map-base.h? 第39行增加 #define S3C_VA_LCD???? S3C_ADDR(0x01100000)????/* LCD */ 從友善的源碼中將arch/arm/mach-s3c64xx/include/mach/regs-lcd.h拷貝過來。 從友善的源碼中將drivers/video/samsung整個文件夾拷貝過來。 vi drivers/video/Kconfig 第2068行增加 source "drivers/video/samsung/Kconfig" vi drivers/video/Makefile 120行增加 obj-$(CONFIG_FB_S3C_EXT)??????+= samsung/ vi arch/arm/mach-s3c64xx/mach-mini6410.c 48行增加 #include <linux/delay.h> 136行mini6410_lcd_power_set函數里的內容改成 ????????if (power) { ????????????????gpio_direction_output(S3C64XX_GPF(13), 1);????????? //GPF13是USBpower用的,與lcd無關 ??????????????? gpio_direction_output(S3C64XX_GPF(15), 1);????????? //GPF15是是真正的一線控制線連PWM1 ????????????????/* fire nRESET on power up */ ????????????????gpio_direction_output(S3C64XX_GPN(5), 0);????????? //GPN5好像與lcd也無關,先copy吧 ????????????????msleep(10); ????????????????gpio_direction_output(S3C64XX_GPN(5), 1); ????????????????msleep(1); ????????} else { ????????????????gpio_direction_output(S3C64XX_GPF(15), 0); ????????????????gpio_direction_output(S3C64XX_GPF(13), 0); ????????} 190行增加 ?? { ????????????????/* LCD support */ ????????????????.virtual????= (unsigned long)S3C_VA_LCD, ????????????????.pfn????????= __phys_to_pfn(S3C_PA_FB), ????????????????.length???? = SZ_16K, ????????????????.type?????? = MT_DEVICE, ????????}, 437行增加 ????gpio_request(S3C64XX_GPN(5), "LCD power"); ????gpio_request(S3C64XX_GPF(13), "LCD power"); 去掉gpio_request(S3C64XX_GPE(0), "LCD power"); make menuconfig ??Power management options??--->? ????[ ] Power Management support?? 一定要去掉,不然會有 drivers/video/samsung/s3cfb_fimd4x.c:1440:2: error: implicit declaration of function 's3c6410_pm_do_save'的錯誤,郁悶了半天 <*> Support for frame buffer devices??--->??? ???? < >?? Samsung S3C framebuffer support?????????????????????????????? ????????<*>?? S3C Framebuffer Support (eXtended)?????????????????????????? ????????????????Select LCD Type (4.3 inch 480x272 TFT LCD)??--->???????? ????????<*>?? Advanced options for S3C Framebuffer?????????????????????? ????????????????Select BPP(Bits Per Pixel) (16 BPP)??--->?????????????? ????????(4)?? Number of Framebuffers???????????????????????????????? ????????[ ]?????? Enable Virtual Screen (NEW)????????????????????????????? ????????[*]?????? Enable Double Buffering?????????????????? ??[ ] Backlight & LCD device support??---> ??Console display driver support??---> ????<*> Framebuffer Console support????這個也一定要選,不然會有 drivers/built-in.o:(.data+0x174): undefined reference to `soft_cursor'的錯誤,其中解決這些錯誤花了我不少時間。 ??[*] Bootup logo??--->???????????????????????????????????????????????? ??????[ ]?? Standard black and white Linux logo???????????????????????? ??????[ ]?? Standard 16-color Linux logo???????????????????????????????? ??????[*]?? Standard 224-color Linux logo? 其他的默認就行 這時lcd的驅動其實已經移植好了,引導信息也正常,如 S3C_LCD clock got enabled :: 133.000 Mhz LCD TYPE :: N43 will be initialized Window[0] - FB1: map_video_memory: clear ff600000:0007f800 ????????????FB1: map_video_memory: dma=5d780000 cpu=ff600000 size=0007f800 Window[0] - FB2: map_video_memory: clear ff63fc00:0003fc00 ????????????FB2: map_video_memory: dma=5d7bfc00 cpu=ff63fc00 size=0003fc00 Console: switching to colour frame buffer device 60x34 fb0: s3cfb frame buffer device Window[1] - FB1: map_video_memory: clear ff680000:0007f800 ????????????FB1: map_video_memory: dma=5cc00000 cpu=ff680000 size=0007f800 Window[1] - FB2: map_video_memory: clear ff6bfc00:0003fc00 ????????????FB2: map_video_memory: dma=5cc3fc00 cpu=ff6bfc00 size=0003fc00 fb1: s3cfb frame buffer device Window[2] - FB1: map_video_memory: clear ff700000:0003fc00 ????????????FB1: map_video_memory: dma=5d740000 cpu=ff700000 size=0003fc00 fb2: s3cfb frame buffer device Window[3] - FB1: map_video_memory: clear ff740000:0003fc00 ????????????FB1: map_video_memory: dma=5cc80000 cpu=ff740000 size=0003fc00 fb3: s3cfb frame buffer device 啟動內核,lcd屏上出現了小天鵝。 七,一線觸摸的驅動 arch/arm/mach-s3c64xx/dev-ts-mini6410.c arch/arm/mach-s3c64xx/include/mach/ts.h arch/arm/plat-samsung/include/plat/regs-adc.h drivers/input/touchscreen/mini6410_1wire_host.c drivers/input/touchscreen/mini6410-ts.c drivers/input/touchscreen/ts-if.c 到相應目錄 vi arch/arm/mach-s3c64xx/Makefile 末尾增加 obj-$(CONFIG_TOUCHSCREEN_MINI6410)??+= dev-ts-mini6410.o vi drivers/input/touchscreen/Makefile 末尾加入 obj-$(CONFIG_TOUCHSCREEN_MINI6410)????+= mini6410-ts.o obj-$(CONFIG_TOUCHSCREEN_1WIRE)????????+= mini6410_1wire_host.o obj-$(CONFIG_FB_S3C_EXT_TFT800480)????+= ts-if.o obj-$(CONFIG_FB_S3C_EXT_TFT480272)????+= ts-if.o obj-$(CONFIG_FB_S3C_EXT_X240320)????+= ts-if.o vi drivers/input/touchscreen/Kconfig 190行左右加入 config TOUCHSCREEN_MINI6410 ????????tristate "S3C touchscreen driver for Mini6410" ????????depends on ARCH_S3C2410 || ARCH_S3C64XX || ARCH_S5P64XX || ARCH_S5PC1XX ????????default y ????????help ??????????Say Y here to enable the driver for the touchscreen on the ??????????FriendlyARM Mini6410 development board. ??????????If unsure, say N. ??????????To compile this driver as a module, choose M here: the ??????????module will be called mini6410-ts. config TOUCHSCREEN_1WIRE ????????tristate "Mini6410 1-Wire host and Touch Screen Driver" ????????depends on MACH_MINI6410 ????????help ??????????Say Y here to enable the 1-Wire host and Touch Screen driver for ??????????FriendlyARM Mini6410 development board. ??????????If unsure, say N. ??????????To compile this driver as a module, choose M here: the ??????????module will be called mini6410_1wire_host. vi arch/arm/mach-s3c64xx/mach-mini6410.c 44行 將#include <plat/ts.h> ?? 改成#include <mach/ts.h> 320行將 static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = { ????????.delay??????????????????= 10000, ????????.presc??????????????????= 49, ????????.oversampling_shift???? = 2, }; 改成 static struct s3c_ts_mach_info s3c_ts_platform __initdata = { ????????.delay??????????????????= 0xFFFF, ????????.presc??????????????????= 0xFF, ????????.oversampling_shift???? = 2, ????????.resol_bit??????????????= 12, ????????.s3c_adc_con????= ADC_TYPE_2, }; 436行將 s3c24xx_ts_set_platdata(&s3c_ts_platform); 改成 s3c_ts_set_platdata(&s3c_ts_platform); vi arch/arm/plat-samsung/Makefile 60行 注釋掉obj-$(CONFIG_SAMSUNG_DEV_TS)?? += dev-ts.o 不然會有multiple definition of `s3c_device_ts'的錯誤很奇怪,友善的源碼CONFIG_SAMSUNG_DEV_TS=n,而我的源碼出來后CONFIG_SAMSUNG_DEV_TS=y,還改不掉。。 vi drivers/input/touchscreen/mini6410-ts.c 增加頭文件#include<linux/sched.h>??奇怪的是友善的mini6410-ts.c 里沒這個頭文件也能找到需要的東西。。。? ?? Input device support??--->? ????????[*]?? Touchscreens??--->?? ??????????????<*>?? S3C touchscreen driver for Mini6410??????????? ????????????????<*>?? Mini6410 1-Wire host and Touch Screen Driver? lcd好用了,燒入文件系統后可以觸摸。 不好意思,其實這里連校準都不行,更別談觸摸,但驅動確實是移植好了。問題出在兩個方面,第一,重新配置內核,選上信號量,如圖: 當然,沒有這一步,內核照樣跑,但友善的QT圖形界面進不去。 第二,修改文件系統相關配置,當然,這里是文件系統,不是內核的問題。是/etc下一個.conf文件,改成一線觸摸就行了。 八,USB驅動移植 1、vi arch/arm/mach-s3c64xx/mach-mini6410.c 124行增加 /* Initializes OTG Phy. to output 48M clock */ void s3c_otg_phy_config(int enable) { ????????u32 val; ????????if (enable) { ????????????????__raw_writel(0x0, S3C_PHYPWR);??/* Power up */ ????????????????val = __raw_readl(S3C_PHYCLK); ????????????????val &= ~S3C_PHYCLK_CLKSEL_MASK; ????????????????__raw_writel(val, S3C_PHYCLK); ????????????????__raw_writel(0x1, S3C_RSTCON); ????????????????udelay(5); ????????????????__raw_writel(0x0, S3C_RSTCON);??/* Finish the reset */ ????????????????udelay(5); ????????} else { ????????????????__raw_writel(0x19, S3C_PHYPWR); /* Power down */ ????????} } 2、vi drivers/usb/host/ohci-s3c2410.c(不是ohci-s3c6410.c) 修改方法 @@ -25,10 +25,14 @@ #define valid_port(idx) ((idx) == 1 || (idx) == 2) +#ifdef CONFIG_MACH_MINI6410 +extern void s3c_otg_phy_config(int enable); +#endif + /* clock device associated with the hcd */ static struct clk *clk; -static struct clk *usb_clk; +static struct clk *otg_clk, *usb_clk; /* forward definitions */ @@ -47,6 +51,11 @@ ???? dev_dbg(&dev->dev, "s3c2410_start_hc:\n"); +????clk_enable(otg_clk); +#ifdef CONFIG_MACH_MINI6410 +????s3c_otg_phy_config(1); +#endif + ???? clk_enable(usb_clk); ???? mdelay(2);????????????/* let the bus clock stabilise */ @@ -79,6 +88,7 @@ ???? clk_disable(clk); ???? clk_disable(usb_clk); +????clk_disable(otg_clk); } /* ohci_s3c2410_hub_status_data @@ -375,6 +385,13 @@ ???????? goto err_clk; ???? } +????otg_clk = clk_get(&dev->dev, "otg"); +????if (IS_ERR(otg_clk)) { +????????dev_err(&dev->dev, "cannot get otg clock\n"); +????????retval = -ENOENT; +????????goto err_otg; +????} + ???? s3c2410_start_hc(dev, hcd); ???? hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); @@ -395,6 +412,10 @@ ??err_ioremap: ???? s3c2410_stop_hc(dev); ???? iounmap(hcd->regs); + +????clk_put(otg_clk); + + err_otg: ???? clk_put(usb_clk); ??err_clk: 3、make menuconfig Device Drivers??--->? ????SCSI device support??---> ???????? <*> SCSI device support ???????? <*> SCSI disk support ???????? <*> SCSI generic support ????USB support ???????? <*>?? Support for Host-side USB ???????? [*]???? USB device filesystem (DEPRECATED) ????????<*>?? USB Monitor? ????????<*>?? OHCI HCD support? ????????<*>?? USB Mass Storage support? File systems??--->? ????DOS/FAT/NT Filesystems??---> ?????????? <*> MSDOS fs support???????????????????????????????????????????????? ????????????<*> VFAT (Windows-95) fs support??????????????????????????????????? ??????????(936) Default codepage for FAT???????????????????????????????????????? ???????? (cp936) Default iocharset for FAT? 啟動之后插入u盤顯示 [root@FriendlyARM /]# usb 1-1.2: new full speed USB device using s3c2410-ohci and address 3 usb 1-1.2: New USB device found, idVendor=1043, idProduct=8012 usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 usb 1-1.2: Product: USB Flash Drive usb 1-1.2: Manufacturer: Generic uba: uba4 掛載 mount /dev/uba4 /mnt后即能看到u盤里的數據了 九、usb攝像頭的支持 ??? 關于攝像頭的驅動驅動配置比較簡單,只是關于驅動接口有兩種版本,分別 是V4L和V4L2,從2.6以后以后有了V4L2,我的linux2.6.38已經看不到關于v4l支持了, 在linux2.6.30.4的版本中我們還能看到? 中有Video For linux API 1的支持,但38的版本卻看不到了,所以 像gspcav1-20071224.tar.gz這樣的v4l接口的驅動就加不進去了, 而很多V4l接口的usb測試程序也就用不了了,網上很少有V4l2的測試程序,所以友善也就沒有開源的他的USB攝像頭程序了(個人理解,不知是否正確) 既然這樣我們就學友善的,按V4l2的來配置吧 我的攝像頭芯片是sunplus凌陽的SPCA2000C的,支持UVC,支持UVC的就可以不用管是什么芯片了,選上一個就行 Device Drivers??--->?? ?????????? <*> Multimedia support??---> ????????????????????????<*>?? Video For Linux?? ????????????????????????[*]?? Video capture adapters??--->??? ?????????????????????????????????? [*]?? V4L USB devices??--->?? ???????????????????????????????????????????????? <*>?? USB Video Class (UVC)????選上這個就行了 make zImage后啟動,插上usb攝像頭,顯示 [root@FriendlyARM /]# usb 1-1.1: new full speed USB device using s3c2410-ohci and address 4 usb 1-1.1: New USB device found, idVendor=04fc, idProduct=2003 usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 usb 1-1.1: Product: Sunplus Camera usb 1-1.1: Manufacturer: Sunplus Camera usb 1-1.1: SerialNumber: CN0316-MM00-OV03-VH-R61.01.00 uvcvideo: Found UVC 1.00 device Sunplus Camera (04fc:2003) input: Sunplus Camera as /devices/platform/s3c2410-ohci/usb1/1-1/1-1.1/1-1.1:1.0/input/input 在/dev/多了個video0, 測試的話用mjpg-streamer就能夠測試了具體看友善光盤A中的?? 開發文檔和教程??中的 專題04 通過Web遠程瀏覽并控制Mini6410上的攝像頭 此外,我還有個中星微的芯片是ZC0301的攝像頭,它的配置是 Device Drivers??--->?? ?????????? <*> Multimedia support??---> ????????????????????????<*>?? Video For Linux?? ????????????????????????[*]?? Video capture adapters??--->? ?????????????????????????????????? <*>?? GSPCA based webcams??--->? ???????????????????????????????????????????????????? <*>?? ZC3XX USB Camera Driver make zImage插上后顯示 [root@FriendlyARM /]# usb 1-1.1: USB disconnect, address 4 usb 1-1.1: new full speed USB device using s3c2410-ohci and address 5 usb 1-1.1: New USB device found, idVendor=0ac8, idProduct=301b usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 usb 1-1.1: Product: PC Camera usb 1-1.1: Manufacturer: Vimicro Corp. gspca: probing 0ac8:301b zc3xx: probe 2wr ov vga 0x0000 zc3xx: probe sensor -> 0011 zc3xx: Find Sensor HV7131R input: zc3xx as /devices/platform/s3c2410-ohci/usb1/1-1/1-1.1/input/input2 gspca: video0 created 十,音頻驅動移植 長話短說了,講原理,不講移植步驟了。 在linux里面,關于音頻已經做的很成熟了。里面有三個框架,我現在只記得兩種,因為我只用到了兩種,不好意思。OSS和ALSA, 其中,OSS是以前用的linux音頻驅動框架,后來用于商業領域,不開源了,如果你用,就要人民幣。后來出現了ALSA,這個比OSS更好用。全稱是高級的LINUX聲卡體系結構。我們要移植的就是基于ALSA框架移植。TINY6410板子用的聲卡芯片是WM9714,希望沒記錯。這個驅動,用內核里的wm9713.c,這個是驅動的核心文件。首先是要添進對這個文件的編譯的,當然光編譯還不行,要這么簡單,就沒人做linux內核研究這么痛苦的事了。 長話短說,按照總線劃分,ALSA是一種平臺設備,也就是platform設備。驅動,設備都掛在這條總線上,然后添加聲卡初始化代碼,和物理地址和虛擬地址的映射代碼。創建該驅動的設備,注冊的總線上。就行了。驅動也要注冊上去。 ALSA驅動成功移植,相應的設備節點也生成了,但發現友善的板子的播放器用的是audio0這樣的設備文件,這可是OSS框架的設備節點哎,困惑。研究了半天才發現,為了向前兼容,ALSA模擬了OSS框架,但要重新配置內核,加上ALSA對OSS模擬的支持。這樣就OK了。 十一,SD卡驅動移植 ?? ?也長話短說,和上面的一樣,寫代碼,給它創建設備,地址映射,注冊的總線上。 十二,網卡驅動移植 ??? 這個內核本來是有網卡驅動的,燒入文件系統,網絡一切正常,但當我用NFS文件系統的時候,網絡怎么都起不來,檢查了很長時間發現內核啟動的時候沒有MAC地址,于是感覺網卡驅動有問題,于是又移植了網卡驅動。網卡驅動也是platform設備,移植和上面大同小異。這里就不做詳細介紹了。 |