Building a Custom Linux Kernel for Arduino
Step-by-step guide to configuring and building a custom Gentoo Linux kernel with proper USB and CDC-ACM support for Arduino boards, including required CONFIG options, module setup, and verification using dmesg and ttyACM"
This configuration is for Gentoo Linux it can be different on other distros/kernel versions
- Current
kernelin use:6.12.58-gentoo-x86_64
Kernel Settings
Set the following kernel option to [y] in kernel
- Those drivers are
requiredto be installed
CONFIG_USB_SUPPORT
CONFIG_USB
CONFIG_USB_DEVICEFS
CONFIG_USB_EHCI_HCD
CONFIG_USB_OHCI_HCD
CONFIG_USB_XHCI_HCD
CONFIG_USB_SERIAL
CONFIG_USB_SERIAL_GENERIC
CONFIG_TTY
CONFIG_SERIAL_CORE
Set the following kernel options to [´y´] but those are optional to include
CONFIG_USB_ACM
CONFIG_HID
CONFIG_HID_GENERIC
CONFIG_INPUT
CONFIG_UDEV
CONFIG_HOTPLUG
CONFIG_PROC_FS
CONFIG_SYSFS
Set the following kernel options to [M] in kernel
CONFIG_USB_SERIAL_CDC_ACM
CONFIG_USB_SERIAL_FTDI_SIO
CONFIG_USB_SERIAL_CH341
CONFIG_USB_SERIAL_CP210X
CONFIG_USB_SERIAL_PL2303
Optional (debugging / development / advanced use)
CONFIG_USB_MON
CONFIG_USB_DEBUG
CONFIG_DYNAMIC_DEBUG
CONFIG_DEBUG_FS
If using Arduino as HID (Keyboard / Mouse / Joystick)
CONFIG_USB_HID
CONFIG_HIDRAW
If using native USB boards (Leonardo, Micro, Due, Teensy)
CONFIG_USB_GADGET
CONFIG_USB_GADGET_VBUS_DRAW
CONFIG_USB_CONFIGFS
CONFIG_USB_CONFIGFS_ACM
CONFIG_USB_CONFIGFS_HID
- Reboot
PCafter you have configured the kernel
Testing the Arduino after the system has been rebooted.
- Monitor
dmesgoutput and if everything was correct set you should see something similiar as below
Listening for Ardunio output
$ dmesg -Twx
kern :info : [Sat Jan 31 18:15:26 2026] usb 1-9.4: new full-speed USB device number 8 using xhci_hcd
kern :info : [Sat Jan 31 18:15:26 2026] usb 1-9.4: New USB device found, idVendor=2341, idProduct=0043, bcdDevice= 0.01
kern :info : [Sat Jan 31 18:15:26 2026] usb 1-9.4: New USB device strings: Mfr=1, Product=2, SerialNumber=220
kern :info : [Sat Jan 31 18:15:26 2026] usb 1-9.4: Manufacturer: Arduino (www.arduino.cc)
kern :info : [Sat Jan 31 18:15:26 2026] usb 1-9.4: SerialNumber: 6ba2b6f84522459f9af1
kern :info : [Sat Jan 31 18:15:26 2026] cdc_acm 1-9.4:1.0: ttyACM0: USB ACM device
- Kernel setup is now
completedand you can start use yourArdunio
Misc
Optional - Sanity test (no Arduino IDE required)
echo test > /dev/ttyACM0
echo $?
- If that doesn’t error with
permission denied,userspace accessis fine
Optional - Upload test (if using avrdude)
- Typical
Unoupload command:
avrdude -patmega328p -carduino -P/dev/ttyACM0 -b115200 -U flash:w:sketch.hex
- You are completely done configuring and installing everything that is required for
Ardunio
Resource(s)