BBB linux内核及模块编译

BBB基于TI公司的AM335X 开发的Linux内核编译

先进行环境变量导出,参考上一篇文章: 

export PATH=<sdk path>/linux-devkit/sysroots/x86_64-arago-linux/usr/bin:$PATH

root@joe-virtual-machine:/home/joe# cat /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "${PS1-}" ]; then
  if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi
export PATH=$PATH:/opt/ti-processor-sdk-linux-am335x-evm-08.02.00.24/linux-devkit/sysroots/x86_64-arago-linux/usr/bin
root@joe-virtual-machine:/home/joe# source /etc/profile
root@joe-virtual-machine:/home/joe# 
root@joe-virtual-machine:/home/joe# arm
arm2hpdl                                arm-none-linux-gnueabihf-gcc-ar         arm-none-linux-gnueabihf-ld.gold
arm-none-linux-gnueabihf-addr2line      arm-none-linux-gnueabihf-gcc-nm         arm-none-linux-gnueabihf-nm
arm-none-linux-gnueabihf-ar             arm-none-linux-gnueabihf-gcc-ranlib     arm-none-linux-gnueabihf-objcopy
arm-none-linux-gnueabihf-as             arm-none-linux-gnueabihf-gcov           arm-none-linux-gnueabihf-objdump
arm-none-linux-gnueabihf-c++filt        arm-none-linux-gnueabihf-gdb            arm-none-linux-gnueabihf-ranlib
arm-none-linux-gnueabihf-cpp            arm-none-linux-gnueabihf-gdb-add-index  arm-none-linux-gnueabihf-readelf
arm-none-linux-gnueabihf-g++            arm-none-linux-gnueabihf-gprof          arm-none-linux-gnueabihf-size
arm-none-linux-gnueabihf-gcc            arm-none-linux-gnueabihf-ld             arm-none-linux-gnueabihf-strings
arm-none-linux-gnueabihf-gcc-9.2.1      arm-none-linux-gnueabihf-ld.bfd         arm-none-linux-gnueabihf-strip

清理源代码

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- distclean

配置内核编译选项

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- <defconfig>

 配置采用默认设置:tisdk_am335x-evm_defconfig

root@joe-virtual-machine:/opt/ti-processor-sdk-linux-am335x-evm-08.02.00.24/board-support/linux-5.10.100+gitAUTOINC+7a7a3af903-g7a7a3af903# make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- distclean
root@joe-virtual-machine:/opt/ti-processor-sdk-linux-am335x-evm-08.02.00.24/board-support/linux-5.10.100+gitAUTOINC+7a7a3af903-g7a7a3af903# make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- tisdk_am335x-evm_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#

编译内核:

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- zImage
root@joe-virtual-machine:/opt/ti-processor-sdk-linux-am335x-evm-08.02.00.24/board-support/linux-5.10.100+gitAUTOINC+7a7a3af903-g7a7a3af903# make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- zImage -j 2

编译完成后生成结果:

  OBJCOPY arch/arm/boot/zImage
  Kernel: arch/arm/boot/zImage is ready
root@joe-virtual-machine:/opt/ti-processor-sdk-linux-am335x-evm-08.02.00.24/board-support/linux-5.10.100+gitAUTOINC+7a7a3af903-g7a7a3af903# ls arch/arm/boot/
bootp  compressed  deflate_xip_data.sh  dts  Image  install.sh  Makefile  zImage

编译内核模块(含驱动模块):

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- modules
root@joe-virtual-machine:/opt/ti-processor-sdk-linux-am335x-evm-08.02.00.24/board-support/linux-5.10.100+gitAUTOINC+7a7a3af903-g7a7a3af903# make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabihf- modules

编译后生成的KO文件在各个驱动文件目录下。

内核模块、设备树文件及驱动模块文件拷贝

将kernel、dtb文件拷贝至文件系统根目录下的boot目录:

cd <kernel sources dir>
sudo cp arch/arm/boot/zImage /media/rootfs/boot
arch/arm/boot/dts/am335x-boneblack.dtb /media/rootfs/boot

驱动模块ko文件安装(存放路径:/rootfs/lib/modules/5.10.100-g7a7a3af903/kernel和extra):

sudo make ARCH=arm INSTALL_MOD_PATH=/media/rootfs modules_install
root@joe-virtual-machine:/opt/ti-processor-sdk-linux-am335x-evm-08.02.00.24/board-support/linux-5.10.100+gitAUTOINC+7a7a3af903-g7a7a3af903# make ARCH=arm INSTALL_MOD_PATH=/media/book/rootfs modules_install
  INSTALL arch/arm/crypto/aes-arm-bs.ko
  INSTALL arch/arm/crypto/aes-arm-ce.ko
  INSTALL arch/arm/crypto/aes-arm.ko
  INSTALL arch/arm/crypto/chacha-neon.ko
  INSTALL arch/arm/crypto/crc32-arm-ce.ko
  INSTALL arch/arm/crypto/ghash-arm-ce.ko
  INSTALL arch/arm/crypto/sha1-arm-ce.ko
  INSTALL arch/arm/crypto/sha1-arm-neon.ko
  INSTALL arch/arm/crypto/sha1-arm.ko
  INSTALL arch/arm/crypto/sha2-arm-ce.ko
  INSTALL arch/arm/crypto/sha256-arm.ko
  INSTALL arch/arm/crypto/sha512-arm.ko
  INSTALL crypto/aes_generic.ko
  INSTALL crypto/af_alg.ko
  INSTALL crypto/algif_aead.ko
  INSTALL crypto/algif_hash.ko
  INSTALL crypto/algif_rng.ko
  INSTALL crypto/algif_skcipher.ko
  INSTALL crypto/authenc.ko
  INSTALL crypto/authencesn.ko
  INSTALL crypto/cbc.ko
  INSTALL crypto/ccm.ko
  INSTALL crypto/cmac.ko
  INSTALL crypto/cryptd.ko
  INSTALL crypto/crypto_engine.ko
  INSTALL crypto/crypto_simd.ko
  INSTALL crypto/crypto_user.ko
  INSTALL crypto/ctr.ko
  INSTALL crypto/drbg.ko
  INSTALL crypto/ecb.ko
  INSTALL crypto/ecc.ko
  INSTALL crypto/ecdh_generic.ko
  INSTALL crypto/echainiv.ko
  INSTALL crypto/gcm.ko
  INSTALL crypto/gf128mul.ko
  INSTALL crypto/ghash-generic.ko
  INSTALL crypto/hmac.ko
  INSTALL crypto/jitterentropy_rng.ko
  INSTALL crypto/md4.ko
  INSTALL crypto/md5.ko
  INSTALL crypto/seqiv.ko
  INSTALL crypto/sha256_generic.ko
  INSTALL crypto/sha512_generic.ko
  INSTALL crypto/tcrypt.ko
  INSTALL drivers/ata/ahci.ko
  INSTALL drivers/ata/ahci_dm816.ko
  INSTALL drivers/ata/ahci_platform.ko
  INSTALL drivers/ata/libahci.ko
  INSTALL drivers/ata/libahci_platform.ko
  INSTALL drivers/ata/libata.ko
  INSTALL drivers/ata/sata_mv.ko
  INSTALL drivers/bcma/bcma.ko
  INSTALL drivers/bluetooth/btbcm.ko
  INSTALL drivers/bluetooth/btmrvl.ko
  INSTALL drivers/bluetooth/btmrvl_sdio.ko
  INSTALL drivers/bluetooth/hci_uart.ko
  INSTALL drivers/char/tpm/tpm.ko
  INSTALL drivers/char/tpm/tpm_i2c_infineon.ko
  INSTALL drivers/crypto/omap-aes-driver.ko
  INSTALL drivers/crypto/omap-crypto.ko
  INSTALL drivers/crypto/omap-des.ko
  INSTALL drivers/crypto/omap-sham.ko
  INSTALL drivers/extcon/extcon-palmas.ko
  INSTALL drivers/extcon/extcon-usb-gpio.ko
  INSTALL drivers/firmware/efi/capsule-loader.ko
  INSTALL drivers/fsi/fsi-core.ko
  INSTALL drivers/fsi/fsi-master-aspeed.ko
  INSTALL drivers/fsi/fsi-master-gpio.ko
  INSTALL drivers/fsi/fsi-master-hub.ko
  INSTALL drivers/fsi/fsi-occ.ko
  INSTALL drivers/fsi/fsi-sbefifo.ko
  INSTALL drivers/fsi/fsi-scom.ko
  INSTALL drivers/gpio/gpio-pisosr.ko
  INSTALL drivers/gpio/gpio-tpic2810.ko
  INSTALL drivers/gpu/drm/bridge/cadence/cdns-mhdp8546.ko
  INSTALL drivers/gpu/drm/bridge/simple-bridge.ko
  INSTALL drivers/gpu/drm/bridge/synopsys/dw-hdmi.ko
  INSTALL drivers/gpu/drm/imx/dw_hdmi-imx.ko
  INSTALL drivers/gpu/drm/imx/imx-ldb.ko
  INSTALL drivers/gpu/drm/imx/imx-tve.ko
  INSTALL drivers/gpu/drm/imx/imxdrm.ko
  INSTALL drivers/gpu/drm/imx/parallel-display.ko
  INSTALL drivers/gpu/ipu-v3/imx-ipu-v3.ko
  INSTALL drivers/hid/hid-multitouch.ko
  INSTALL drivers/hid/usbhid/usbhid.ko
  INSTALL drivers/hwmon/aspeed-pwm-tacho.ko
  INSTALL drivers/hwmon/ina2xx.ko
  INSTALL drivers/hwmon/ntc_thermistor.ko
  INSTALL drivers/hwmon/pwm-fan.ko
  INSTALL drivers/i2c/busses/i2c-emev2.ko
  INSTALL drivers/i2c/muxes/i2c-arb-gpio-challenge.ko
  INSTALL drivers/iio/adc/cpcap-adc.ko
  INSTALL drivers/iio/adc/ti_am335x_adc.ko
  INSTALL drivers/iio/adc/vf610_adc.ko
  INSTALL drivers/iio/buffer/industrialio-buffer-cb.ko
  INSTALL drivers/iio/light/cm36651.ko
  INSTALL drivers/input/keyboard/matrix_keypad.ko
  INSTALL drivers/input/keyboard/qt1070.ko
  INSTALL drivers/input/keyboard/samsung-keypad.ko
  INSTALL drivers/input/matrix-keymap.ko
  INSTALL drivers/input/misc/adxl34x-i2c.ko
  INSTALL drivers/input/misc/adxl34x-spi.ko
  INSTALL drivers/input/misc/adxl34x.ko
  INSTALL drivers/input/misc/cpcap-pwrbutton.ko
  INSTALL drivers/input/misc/gpio_decoder.ko
  INSTALL drivers/input/mouse/cyapatp.ko
  INSTALL drivers/input/touchscreen/atmel_mxt_ts.ko
  INSTALL drivers/input/touchscreen/edt-ft5x06.ko
  INSTALL drivers/input/touchscreen/elants_i2c.ko
  INSTALL drivers/input/touchscreen/goodix.ko
  INSTALL drivers/input/touchscreen/mms114.ko
  INSTALL drivers/input/touchscreen/pixcir_i2c_ts.ko
  INSTALL drivers/input/touchscreen/resistive-adc-touch.ko
  INSTALL drivers/input/touchscreen/st1232.ko
  INSTALL drivers/input/touchscreen/ti_am335x_tsc.ko
  INSTALL drivers/irqchip/irq-pruss-intc.ko
  INSTALL drivers/leds/led-class-flash.ko
  INSTALL drivers/leds/leds-cpcap.ko
  INSTALL drivers/media/common/v4l2-tpg/v4l2-tpg.ko
  INSTALL drivers/media/common/videobuf2/videobuf2-vmalloc.ko
  INSTALL drivers/media/dvb-frontends/a8293.ko
  INSTALL drivers/media/dvb-frontends/af9013.ko
  INSTALL drivers/media/dvb-frontends/af9033.ko
  INSTALL drivers/media/dvb-frontends/ascot2e.ko
  INSTALL drivers/media/dvb-frontends/atbm8830.ko
  INSTALL drivers/media/dvb-frontends/au8522_common.ko
  INSTALL drivers/media/dvb-frontends/au8522_decoder.ko
  INSTALL drivers/media/dvb-frontends/au8522_dig.ko
  INSTALL drivers/media/dvb-frontends/bcm3510.ko
  INSTALL drivers/media/dvb-frontends/cx22700.ko
  INSTALL drivers/media/dvb-frontends/cx2270
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值