Jump to content

Armbian build - how to modify dts file to change GPIO mapping?


Recommended Posts

Hi,

 

I have a board Orange Pi Zero with modified PAs for power of WiFi module from PA20 to PA02, by soldering a connection on board. This is done to allow connection of I2C DAC.

 

I see that board definition in 'u-boot/configs/orangepi_zero_defconfig'

It uses dts definition of: 'arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts'

 

I need to modify one section of this dts file from:

reg_vcc_wifi: reg_vcc_wifi {
        compatible = "regulator-fixed";
        regulator-min-microvolt = <3300000>;
        regulator-max-microvolt = <3300000>;
        regulator-name = "vcc-wifi";
        enable-active-high;
        gpio = <&pio 0 20 GPIO_ACTIVE_HIGH>;

to:

reg_vcc_wifi: reg_vcc_wifi {
        compatible = "regulator-fixed";
        regulator-min-microvolt = <3300000>;
        regulator-max-microvolt = <3300000>;
        regulator-name = "vcc-wifi";
        enable-active-high;
        gpio = <&pio 0 2 GPIO_ACTIVE_HIGH>;

 

How can I do this and use armbian build script: compile.sh

 

Thanks,

Michal

 

Link to comment
Share on other sites

Donate your old hardware to community. Start a giveaway Raffle!

There are two ways you can go. Either add a patch and build a new image. Or use official image with a device tree overlay to change that line.

 

If you want to go the first route, run the following command

 

./compile.sh BOARD=orangepizero BRANCH=current uboot-patch

 

It will start the patch mode and then wait for you to make changes. if you are building with docker, you have to open a shell using "docker exec -it <instance_id> /bin/bash". Go to cache/sources/u-boot-sunxi/<version>/ directory and make your changes. Go back to window where you ran ./compile.sh and press enter. It will ask you for few things once you provide those a patch file will be created in output directory. Then you can copy that patch file to patch/u-boot/u-boot-sunxi directory so that the patch applies to the image

 

you have to do the same thing for kernel as well. Most of the workflow will remain the same just command will be kernel-patch instead of uboot-patch and source directory will also be something like cache/sources/linux-something. The patch has to be placed in patch/kernel/archive/sunxi-<kernel_version>/ directory or its corresponding userpatches directory.

 

If you go to device tree overlay route, create a file called sun8i-h3-reg_vcc_wifi.dts with the following content

/dts-v1/;
/plugin/;

&reg_vcc_wifi {
	gpio = <&pio 0 2 GPIO_ACTIVE_HIGH>;
};

 

compile it with "dtc -@ -I dts -O dtb -o sun8i-h3-reg_vcc_wifi.dtb sun8i-h3-reg_vcc_wifi.dts". copy dtb file to /boot/dtb/overlays directory and enable it using armbian-config. It will take affect after reboot

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines