Created
July 21, 2018 15:54
-
-
Save geekman/4ab2c074201efd76994a38dab36b23b9 to your computer and use it in GitHub Desktop.
boot-time device tree overlays with U-Boot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
part uuid ${devtype} ${devnum}:${bootpart} uuid | |
setenv bootargs console=${console} root=PARTUUID=${uuid} rw rootwait | |
if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /boot/zImage; then | |
if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then | |
fdt addr ${fdt_addr_r} | |
fdt resize | |
setexpr fdtovaddr ${fdt_addr_r} + F000 | |
if load ${devtype} ${devnum}:${bootpart} ${fdtovaddr} /boot/dtbs/overlay.txt && env import -t ${fdtovaddr} ${filesize} && test -n ${overlay}; then | |
echo loaded overlay.txt: ${overlay} | |
for ov in ${overlay}; do | |
echo overlaying ${ov}... | |
load ${devtype} ${devnum}:${bootpart} ${fdtovaddr} /boot/dtbs/${ov}.dtb && fdt apply ${fdtovaddr} | |
done | |
fi | |
if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /boot/initramfs-linux.img; then | |
bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}; | |
else | |
bootz ${kernel_addr_r} - ${fdt_addr_r}; | |
fi; | |
fi; | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/dts-v1/; | |
/plugin/; | |
/ { | |
compatible = "allwinner,sun7i-a20"; | |
fragment@0 { | |
target = <&i2c2>; | |
__overlay__ { | |
#address-cells = <1>; | |
#size-cells = <0>; | |
ina219@40 { | |
status = "okay"; | |
compatible = "ti,ina219"; | |
reg = <0x40>; | |
shunt-resistor = <100000>; // R100 | |
}; | |
}; | |
}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
overlay=abc ina219 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment