Including driver firmware on Linux kernel image

本文探讨了在嵌入式系统开发过程中遇到的固件加载问题,特别是当设备依赖于根文件系统中的固件才能工作时的先有鸡还是先有蛋的困境。文章提供了两种解决方案:一是创建包含所需固件的初始RAM磁盘;二是将驱动程序内置到内核中,并介绍了如何在Linux内核配置中启用相关选项。

 

http://acassis.wordpress.com/2010/03/17/including-driver-firmware-on-linux-kernel-image/

 

Driver’s binary firmware is a dedicated issue to Linux. In fact even open source drivers usually load its firmware to internal chip and it drives some puritan GNU people to become crazy.

Unfortunately you don’t have much option because these firmware are necessary to get your device working.

When developing an embedded system you could face a “Chicken and Egg” dilemma related to firmware loading. For example, you could need to mount a root file system through NFS over wireless, but your wireless interface needs a firmware which is in the rootfs (at /lib/firmware).

Hopefully you have some approaches to solve this dilemma:
1) Create an initrd (initramfs) with needed firmware inside;
2) Include your driver built-in into the kernel.

To include the needed firmware into the kernel just select this option:

Device Drivers  --->
    Generic Driver Options  --->
    -*- Userspace firmware loading support
    [*]   Include in-kernel firmware blobs in kernel binary

Also you could specify an external firmware path at:

(/home/user/newfirmware.bin)    External firmware blobs to build
 
 

# Audio subset mainly include functions: # - asls tools # - libmad to play mp3 BR2_PACKAGE_ALSA_UTILS=y BR2_PACKAGE_ALSA_UTILS_ALSACONF=y BR2_PACKAGE_ALSA_UTILS_AMIXER=y BR2_PACKAGE_ALSA_UTILS_APLAY=y BR2_PACKAGE_ALSA_PLUGINS=y BR2_PACKAGE_LIBMAD=y BR2_PACKAGE_ALSA_UCM_CONF=y BR2_PACKAGE_ROCKCHIP_ALSA_CONFIG=y # Support ADPCM format audio with gstreamer BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_ADPCMDEC=y BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_ADPCMENC=y BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_FAAD=y BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_MPG123=y BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_SOUPHTTPSRC=y BR2_PACKAGE_CA_CERTIFICATES=y BR2_PACKAGE_LIBSOUP_SSL=y # linux custom kernel at least 4.4.x BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_4=y BR2_LINUX_KERNEL_CUSTOM_LOCAL=y BR2_LINUX_KERNEL_CUSTOM_LOCAL_LOCATION="$(TOPDIR)/../kernel" BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="board/rockchip/common/base/busybox.fragment" # base subset is the basic subset of all rootfs, ramdisk. # - auto resize ext2 fs BR2_TARGET_ROOTFS_EXT2_SIZE="AUTO" # - use glibc as the basic libc BR2_TOOLCHAIN_BUILDROOT_GLIBC=y # - we use buildroot toolcharn here, may change to custom toolchain in the feature BR2_TOOLCHAIN_BUILDROOT_CXX=y # - the basic fs-overlay, will copy to rootfs after all package built # - the post build script will be excuted after all fs-overlay copyed BR2_ROOTFS_POST_BUILD_SCRIPT="../device/rockchip/common/post-build.sh" BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" # - specify this is rockchip package BR2_PACKAGE_ROCKCHIP=y # - we need to support various rootfs, cpio for ramdisk, ext2/4 for large system, squashfs for small system BR2_TARGET_ROOTFS_CPIO=y BR2_TARGET_ROOTFS_CPIO_GZIP=y BR2_TARGET_ROOTFS_EXT2=y BR2_TARGET_ROOTFS_EXT2_4=y BR2_TARGET_ROOTFS_SQUASHFS=y # - script for rockchip linux demo and debug BR2_PACKAGE_RKSCRIPT=y # extra base subset is the basic subset of all rootfs, ramdisk. # - we have to use eudev, because wayland need udev support BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y # - vensor storage tool is used to r/w SN, wifi/bt/lan mac BR2_PACKAGE_VENDOR_STORAGE=y # - usb device package used to init and config udc like adb and usb mass storage BR2_PACKAGE_USBDEVICE=y # - usbmount used to mount usb disk to /media/ when it plug in BR2_PACKAGE_USBMOUNT=y # - input event daemon used to handle key event, ie. power on/off system BR2_PACKAGE_INPUT_EVENT_DAEMON=y # - upower used to monitor the power state of system BR2_PACKAGE_UPOWER=y # - pm utils used to suspend/resume system BR2_PACKAGE_PM_UTILS=y # - we need to use fsck and resize2fs to check and extend ext2/4 file system when the first time system boot up BR2_PACKAGE_E2FSPROGS=y BR2_PACKAGE_E2FSPROGS_FSCK=y BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y # - we need to use dostool, mkfs.fat to format fat file system when the first time system boot up BR2_PACKAGE_DOSFSTOOLS=y BR2_PACKAGE_DOSFSTOOLS_MKFS_FAT=y # - we need adb as the basic tool BR2_PACKAGE_ANDROID_TOOLS=y # - update tool is a command used to write factory reset or ota update command to /misc, then reboot system # - after that, uboot will read command from /misc and boot up recovery image BR2_PACKAGE_UPDATE=y # benchmark subset collect benchmark tools # - glmark2 used to benchmark gpu opengl es BR2_PACKAGE_GLMARK2=y # - whetstone is used to benchmark cpu's floatint point performance BR2_PACKAGE_WHETSTONE=y # - dhrystone is a benchmark used to benchmark cpu's integer performance BR2_PACKAGE_DHRYSTONE=y # - lmbench is used to benchmark memory bandwidth BR2_PACKAGE_LMBENCH=y # - unixbench can benchmark cpu, ram, disk etc BR2_PACKAGE_UNIXBENCH=y # - iperf is a benchmark tool used to measure bandwidth on IP networks BR2_PACKAGE_IPERF=y BR2_PACKAGE_RKWIFIBT=y BR2_PACKAGE_BLUEZ_ALSA=y BR2_PACKAGE_BLUEZ_ALSA_HCITOP=y BR2_PACKAGE_BLUEZ5_UTILS=y BR2_PACKAGE_BLUEZ5_UTILS_OBEX=y BR2_PACKAGE_BLUEZ5_UTILS_CLIENT=y BR2_PACKAGE_BLUEZ5_UTILS_GATTTOOL=y BR2_PACKAGE_BLUEZ5_UTILS_EXPERIMENTAL=y BR2_PACKAGE_BLUEZ5_PLUGINS_SIXAXIS=y # libv4l and its utils for v4l2 devices BR2_PACKAGE_LIBV4L=y BR2_PACKAGE_LIBV4L_UTILS=y BR2_PACKAGE_CAMERA_ENGINE=y # Elements used to communicate with camera applications BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_APP=y # Convert audio to different formats BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_AUDIORATE=y # Creates audio test signals of given frequency and volume BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_AUDIOTESTSRC=y # various encoding-related elements BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_ENCODING=y # Adjusts video frames BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_VIDEORATE=y # ogg stream manipulation (info about ogg: http://xiph.org) BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_OGG=y # Theora plugin library BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_THEORA=y # Vorbis plugin library BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_VORBIS=y # JPeg plugin library BR2_PACKAGE_GST1_PLUGINS_GOOD_JPEG=y # PNG plugin library BR2_PACKAGE_GST1_PLUGINS_GOOD_PNG=y # adds an alpha channel to video - constant or via chroma-keyin BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_ALPHA=y # APEv1/2 tag reader BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_APETAG=y # parses au streams BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_AUPARSE=y # Demux ID3v1 and ID3v2 tags from a file BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_ID3DEMUX=y # Reads/Writes buffers from/to sequentially named files BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_MULTIFILE=y # Real-time protocol plugins BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_RTP=y # RTP session management plugin librar BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_RTPMANAGER=y # transfer data via RTSP BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_RTSP=y # resizes a video by adding borders or cropping BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_VIDEOBOX=y # Crops video into a user-defined region BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_VIDEOCROP=y # Video filters plugin BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_VIDEOFILTER=y # Video mixer BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_VIDEOMIXER=y # Take image snapshots and record movies from camera BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_CAMERABIN2=y # MPEG TS demuxer BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_MPEGTSDEMUX=y # MPEG TS muxer BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_MPEGTSMUX=y # MPEG-PS muxer BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_MPEGPSMUX=y # V4L2 plugin of gstreamer BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_V4L2=y # debug subset is all the debug tools we used # - evtest used to debug input event like touch panel, key, mouse, etc BR2_PACKAGE_EVTEST=y # - lrzsz used to transfer file between device and secure crt BR2_PACKAGE_LRZSZ=y # - procrank used to monitor the memory used by each process, thread, application BR2_PACKAGE_PROCRANK_LINUX=y # - install the libdrm test programs BR2_PACKAGE_LIBDRM_INSTALL_TESTS=y # - io tool used to read/write register and memory BR2_PACKAGE_IO=y # - i2c tool used to detec, dump, set and get i2c devices BR2_PACKAGE_I2C_TOOLS=y # - strace used to track what system calls a program makes BR2_PACKAGE_STRACE=y # - iputils is a set of network debug tools like ping, tracepath, arping, tftpd, rarpd, clockdiff, rdisc BR2_PACKAGE_IPUTILS=y # - debug tools for wireless devices using the mac80211 kernel stack BR2_PACKAGE_IW=y # - a collection of tools to configure wireless lan cards, including iwconfig, iwlist, iwspy, iwpriv, ifrename BR2_PACKAGE_WIRELESS_TOOLS=y # - debugutils, e.g: show fps BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_DEBUGUTILS=y # - coreutil, All of the basic file/text/shell utilities # Things like: # - chmod, cp, dd, dir, ls, etc... # - sort, tr, head, tail, wc, etc... # - whoami, who, etc... BR2_PACKAGE_COREUTILS=y # - perf tool provided by kernel BR2_PACKAGE_LINUX_TOOLS_PERF=y # function test for Rockchip stress test BR2_PACKAGE_ROCKCHIP_TEST=y # - add stress-ng BR2_PACKAGE_STRESS_NG=y # Provides things like kill, ps, uptime, free, top, etc for next generation BR2_PACKAGE_PROCPS_NG=y # Provides things like mpi_dec_test, mpi_enc_test..... BR2_PACKAGE_ROCKCHIP_MPP_TESTS=y BR2_PACKAGE_FIO=y BR2_PACKAGE_GDB=y BR2_PACKAGE_IOZONE=y BR2_PACKAGE_MMC_UTILS=y BR2_PACKAGE_CAN_UTILS=y BR2_PACKAGE_ETHTOOL=y BR2_PACKAGE_IPERF3=y BR2_PACKAGE_TCPDUMP=y BR2_PACKAGE_TCPDUMP_SMB=y BR2_PACKAGE_LINUXPTP=y BR2_PACKAGE_WAYLAND=y BR2_PACKAGE_WESTON=y BR2_PACKAGE_WESTON_DRM=y BR2_PACKAGE_ROCKCHIP_MALI=y # - user space IEEE 802.1X/WPA supplicant BR2_PACKAGE_WPA_SUPPLICANT=y # - support ap mode for your wifi BR2_PACKAGE_WPA_SUPPLICANT_AP_SUPPORT=y # - enable support for the autoscan feature (allow periodic scan) BR2_PACKAGE_WPA_SUPPLICANT_AUTOSCAN=y # - enable eap support for your wifi BR2_PACKAGE_WPA_SUPPLICANT_EAP=y # - install wpa_cli command line utility BR2_PACKAGE_WPA_SUPPLICANT_CLI=y # - install libwpa_client.so BR2_PACKAGE_WPA_SUPPLICANT_WPA_CLIENT_SO=y # - install wpa_passphrase command line utility BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y # - a DHCP client BR2_PACKAGE_DHCPCD=y # - a lightweight DNS and DHCP server. It is intended to provide coupled DNS and DHCP service to a LAN BR2_PACKAGE_DNSMASQ=y # - a user space daemon for wireless access points. BR2_PACKAGE_HOSTAPD=y # - Network Time Protocol, provides things like ntpd, ntpdate, ntpq, etc... BR2_PACKAGE_NTP=y # - tiny ssh server and sftp server BR2_PACKAGE_DROPBEAR=y BR2_PACKAGE_GESFTPSERVER=y # BR2_PACKAGE_DROPBEAR_CLIENT is not set # - Someone will use ssh to login BR2_TARGET_GENERIC_ROOT_PASSWD="rockchip" # - A full-featured exFAT file system implementation and exFAT filesystem utilities. BR2_PACKAGE_EXFAT=y BR2_PACKAGE_EXFAT_UTILS=y # - Support the read/write NTFS driver for Linux BR2_PACKAGE_NTFS_3G=y BR2_PACKAGE_NTFS_3G_NTFSPROGS=y BR2_PACKAGE_UTIL_LINUX_MOUNT=y # video_mpp subset is user space library for harware acceleration of video decoding and encoding # - user space library for use vpu to do video decoding and encoding BR2_PACKAGE_ROCKCHIP_MPP=y # - we use drm for memory allocate BR2_PACKAGE_ROCKCHIP_MPP_ALLOCATOR_DRM=y # - user space library for use rga to do image zoom in/out, rotate, etc BR2_PACKAGE_ROCKCHIP_RGA=y BR2_PACKAGE_ROCKCHIP_MPP=y BR2_PACKAGE_ROCKCHIP_MPP_ALLOCATOR_DRM=y BR2_PACKAGE_GSTREAMER1_ROCKCHIP=y BR2_PACKAGE_ROCKCHIP_RGA=y BR2_PACKAGE_GSTREAMER1=y BR2_PACKAGE_GST1_PLUGINS_BASE_INSTALL_TOOLS=y BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_ALSA=y BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_VIDEOCONVERT=y BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_VIDEOTESTSRC=y BR2_PACKAGE_GST1_PLUGINS_GOOD=y BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_AUDIOPARSERS=y BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_AUTODETECT=y BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_DEINTERLACE=y BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_GDKPIXBUF=y BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_MATROSKA=y BR2_PACKAGE_GST1_PLUGINS_BAD=y BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_DVBSUBOVERLAY=y BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_DVDSPU=y BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_JPEGFORMAT=y BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_KMS=y BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_MPEGDEMUX=y BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_MPEG2ENC=y BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_VIDEOPARSERS=y BR2_PACKAGE_GST1_PLUGINS_UGLY=y BR2_PACKAGE_GST1_PLUGINS_UGLY_PLUGIN_ASFDEMUX=y BR2_PACKAGE_GST1_PLUGINS_UGLY_PLUGIN_DVDLPCMDEC=y BR2_PACKAGE_GST1_PLUGINS_UGLY_PLUGIN_DVDSUB=y BR2_PACKAGE_GST1_PLUGINS_UGLY_PLUGIN_MPEG2DEC=y BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_RTP=y BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_RTPMANAGER=y BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_RTSP=y BR2_PACKAGE_GST1_PLUGINS_GOOD_PLUGIN_UDP=y BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_TCP=y BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_ONVIF=y BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_RTMP=y BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_SDP=y BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_VIDEORATE=y BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_VORBIS=y BR2_PACKAGE_GST1_PLUGINS_BASE_PLUGIN_OGG=y BR2_PACKAGE_GST1_PLUGINS_BAD_PLUGIN_HLS=y # - enable utils, e.g: ifconfig hciconfig... BR2_PACKAGE_BLUEZ5_UTILS=y # - fs overlay for powermanager BR2_cortex_a55=y BR2_PACKAGE_RK356X=y BR2_TARGET_GENERIC_GETTY_PORT="ttyFIQ0" BR2_TARGET_GENERIC_GETTY_BAUDRATE_1500000=y BR2_TARGET_GENERIC_HOSTNAME="RK356X" BR2_TARGET_GENERIC_ISSUE="Welcome to RK356X Buildroot" BR2_aarch64=y # test subset collect test tools # - memtest used to testing the memory subsystem for faults BR2_PACKAGE_MEMTESTER=y # - rt test is a set of utilities for testing the real-time behaviour of a Linux system BR2_PACKAGE_RT_TESTS=y # - a configurable amount of CPU, memory, I/O, and disk stress on the system BR2_PACKAGE_STRESS=y # - stress test on cpu and memory BR2_PACKAGE_STRESSAPPTEST=y # - audio, reboot, bluetooth, ddr, dvfs, flash, suspend/resume, wifi BR2_PACKAGE_ROCKCHIP_TEST=y # wifi subset collect tools for wifi # - rkwifibt is a collection of wifi and bt firmware BR2_PACKAGE_RKWIFIBT=y # - fs overlay for wifi BR2_PACKAGE_RKWIFIBT_AP6212A1=y BR2_PACKAGE_RKWIFIBT_BTUART="ttyS1" BR2_PACKAGE_RKNPU2=y BR2_PACKAGE_QT5=y BR2_PACKAGE_OPENCV3=y BR2_PACKAGE_OPENCV3_WITH_QT5=y BR2_PACKAGE_OPENCV3_LIB_STITCHING=y BR2_PACKAGE_OPENCV3_LIB_SUPERRES=y BR2_PACKAGE_OPENCV3_LIB_TS=y BR2_PACKAGE_OPENCV3_LIB_VIDEOSTAB=y BR2_ROOTFS_OVERLAY="board/rockchip/common/base board/rockchip/common/powermanager board/rockchip/rk356x/fs-overlay/ board/rockchip/common/wifi" root@pql-virtual-machine:/app#
10-23
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值