2.3 Configure and Build the Linux Kernel
- Enter the linux directory.
$ cd linux/
- Create a configuration file
(.config) with default configuration.
$ make sama5_defconfig
- Open the sama5d29_curiosity EV07R15A SAMA5D29 Curiosity Development Board’s dts file.
- Add the two nodes: “&macb0”
and “&pioA”.
$ vim arch/arm/boot/dts/microchip/at91-sama5d29_curiosity.dts
&macb0 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_macb0_default>; #address-cells = <1>; #size-cells = <0>; phy-mode = "rmii"; status = "okay"; ethernet-phy@0 { reg = <0x0>; }; }; &pioA { pinctrl_macb0_default: macb0-default { pinmux = <PIN_PB14__GTXCK>, <PIN_PB15__GTXEN>, <PIN_PB16__GRXDV>, <PIN_PB17__GRXER>, <PIN_PB18__GRX0>, <PIN_PB19__GRX1>, <PIN_PB20__GTX0>, <PIN_PB21__GTX1>, <PIN_PB22__GMDC>, <PIN_PB23__GMDIO>; bias-disable; }; };
- Download the latest LAN8670 PHY
driver file from mainline kernel source code.
$ wget raw.githubusercontent.com/torvalds/linux/refs/heads/master/drivers/net/phy/microchip_t1s.c
- Replace the existing LAN8670 PHY
driver file in the Linux kernel source code directory by copying the latest version of the
LAN8670 PHY driver file that you have downloaded.
$ cp microchip_t1s.c drivers/net/phy/
Important: The git clone command downloads the kernel source code corresponding to Linux kernel version 6.12. However, support for the latest LAN8670 PHY revisions C1 and C2 is available only from Linux kernel version 6.13 onwards. Therefore, you need to download the latest LAN8670 PHY driver file from the main kernel source code and copy it into your current directory, which is “linux-6.12-mchp”. If you are using LAN8670 Rev B1, you may skip steps 5 and 6 above and proceed with the subsequent instructions. - Configure LAN8670 support in the kernel.
$ make menuconfig
The kernel configuration window opens.
- Enable PHY driver support.
Select “Device Drivers >> Network device support >> PHY Device support and infrastructure >> Microchip 10BASE-T1S Ethernet PHYs”
Important: Make sure there is a “*” next to “Microchip 10BASE-T1S Ethernet PHYs”. If not, select the entry and press the space bar to cycle through the options. The “*” means the drivers will be built into the kernel. - Save the configuration.
- Build the Linux kernel image.
$ make -j8
- Create a uImage. $ make uImage LOADADDR=0x20008000Tip: Install u-boot-tools if you get the following error: "mkimage" command not found - U-Boot images will not be built.
$ sudo apt-get install u-boot-tools
- Compile device tree source file.
$ make dtbs
If the building process is successful, the final images can be found in the arch/arm/boot/ directory.
- Come out of the Linux directory to create
device tree overlay blob files. Run the following commands:
$ cd ..
$ git clone https://github.com/linux4microchip/dt-overlay-mchp.git
$ cd dt-overlay-mchp/
$ make sama5d29_curiosity_dtbos
$ make sama5d29_curiosity.itb
- Replace
the generated .itb file into the SD card’s below location (boot
partition).
- Close the terminal window.