DT overlay support

Experimental feature to include DT overlays and custom boot args
pull/382/head
ludiazv 2023-05-30 13:27:31 +02:00
parent ab649c5d39
commit cddadc1f4b
40 changed files with 1009 additions and 8 deletions

View File

@ -84,4 +84,72 @@ This code changes the default CPU governor from _fantasy_ to _ondemand_, and tun
For additional discussion, see https://github.com/linux-sunxi/meta-sunxi/issues/25
Custom boot environment & devicetree overlay suppport
=====================================================
The layer provide a basic custom enviroment for linux mainline that enables:
- Custom boot argument to be passed to the kernel.
- Basic devicetree overlay support.
By default this features are disabled and have to be activated including this the bitbake configuration (e.g. local.conf):
```
DISTRO_FEATURES:append = " sunxi-env"
```
This feature instruct the layer to deploy the file ``` /boot/sunxienv.txt ``` that is loaded during boot customize kernel boot command line.
DT Overlay support
------------------
To enable overlays the following line must be activated in bitbake configuration (e.g. local.conf):
```
SUNXI_OVERLAYS_ENABLE:append = " <space separeted list with the desired overlay names without .dts>"
```
The layer includes a common set for DT overalys organized by family. The list can be found in the
following path ```meta-sunxi/recipes-bs/sunxi-overlays/files/<socfamily>/<dts file>```
Once activated the following content will be added to yout image in the boot partition:
```
/boot/dtbo/*.dbto (all compiled overlays selected in SUNXI_OVERLAYS_ENABLE)
/boot/sunxienv.txt (uboot config file with the full list of devicetree overlays)
```
```/boot/sunxienv.txt``` can be modified after the build to activate or deactive the overlays on boot to provide
runtime flexibility or for debugging. A ```.dbto``` file can be also loaded at runtime
if the kernel supports it via sysfs interface using ```cat [dbto file] > /sys/kernel/config/device-tree/overlays/```
Adding custom DT overlays
-------------------------
It is possible to add custom overlay/s via a ```bbappend``` recipe.
```
recipies-bsp
- sunxi-overlays
- sunxi-overlays%.bbappend
- files
- <custom.dts>
Inside the .bbappend the following metadata is requried:
```
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
SRC_URI:${SOC_FAMILY}:append = " file://<custom.dts>"
```
Don't forget to add the custom overlay in your image or local configuration:
```
SUNXI_OVERLAYS_ENABLED:append = " <custom>"
```

View File

@ -41,6 +41,11 @@ SUNXI_BOOT_SPACE ?= "40"
IMAGE_BOOT_FILES ?= "${KERNEL_IMAGETYPE} boot.scr"
# ship fex file for sunxi kernel, devicetree file for mainline kernel
IMAGE_BOOT_FILES += "${@bb.utils.contains('PREFERRED_PROVIDER_virtual/kernel', 'linux-sunxi', '${SUNXI_FEX_FILE}', '${KERNEL_DEVICETREE}', d)}"
IMAGE_BOOT_FILES:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'sunxi-env', 'sunxienv.txt', '', d)}"
IMAGE_BOOT_FILES:append = " ${@ '' if (d.getVar('SUNXI_OVERLAYS_ENABLE') or "").strip() == "" else 'devicetree/*.dtbo;dtbo/'}"
WKS_FILES ?= "sunxi-sdcard-image.wks.in"
WKS_FILE_DEPENDS ?= "virtual/kernel u-boot"
# in case of sunxi kernel, sunxi-board-fex must be built prior wic image assembly

View File

@ -46,6 +46,9 @@ addtask do_fix_device_tree_location after do_write_wks_template before do_image_
SUNXI_BOOT_SPACE ?= "40"
IMAGE_BOOT_FILES ?= "${KERNEL_IMAGETYPE} boot.scr ${KERNEL_DEVICETREE}"
IMAGE_BOOT_FILES:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'sunxi-env', 'sunxienv.txt', '', d)}"
IMAGE_BOOT_FILES:append = " ${@ '' if (d.getVar('SUNXI_OVERLAYS_ENABLE') or "").strip() == "" else 'devicetree/*.dtbo;dtbo/'}"
WKS_FILES ?= "sunxi-sdcard-image.wks.in"
WKS_FILE_DEPENDS ?= "virtual/kernel u-boot"

View File

@ -0,0 +1,20 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h616";
fragment@0 {
target-path = "/aliases";
__overlay__ {
i2c0 = "/soc/i2c@5002000";
};
};
fragment@1 {
target = <&i2c0>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,20 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h616";
fragment@0 {
target-path = "/aliases";
__overlay__ {
i2c1 = "/soc/i2c@5002400";
};
};
fragment@1 {
target = <&i2c1>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,20 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h616";
fragment@0 {
target-path = "/aliases";
__overlay__ {
i2c2 = "/soc/i2c@5002800";
};
};
fragment@1 {
target = <&i2c2>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,22 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h616";
fragment@0 {
target-path = "/aliases";
__overlay__ {
serial1 = "/soc/serial@5000400";
};
};
fragment@1 {
target = <&uart1>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&uart1_pins>;
status = "okay";
};
};
};

View File

@ -0,0 +1,32 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h616";
fragment@0 {
target-path = "/aliases";
__overlay__ {
serial2 = "/soc/serial@5000800";
};
};
fragment@1 {
target = <&pio>;
__overlay__ {
uart2_rts_cts: uart2_rts_cts {
pins = "PD21", "PD22";
function = "uart2";
};
};
};
fragment@2 {
target = <&uart2>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&uart2_pins>;
status = "okay";
};
};
};

View File

@ -0,0 +1,20 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h5";
fragment@0 {
target-path = "/aliases";
__overlay__ {
i2c0 = "/soc/i2c@01c2ac00";
};
};
fragment@1 {
target = <&i2c0>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,20 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h5";
fragment@0 {
target-path = "/aliases";
__overlay__ {
i2c1 = "/soc/i2c@01c2b000";
};
};
fragment@1 {
target = <&i2c1>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,20 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h5";
fragment@0 {
target-path = "/aliases";
__overlay__ {
i2c2 = "/soc/i2c@01c2b400";
};
};
fragment@1 {
target = <&i2c2>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,22 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h5";
fragment@0 {
target-path = "/aliases";
__overlay__ {
serial1 = "/soc/serial@01c28400";
};
};
fragment@1 {
target = <&uart1>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&uart1_pins>;
status = "okay";
};
};
};

View File

@ -0,0 +1,32 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h5";
fragment@0 {
target-path = "/aliases";
__overlay__ {
serial2 = "/soc/serial@01c28800";
};
};
fragment@1 {
target = <&pio>;
__overlay__ {
uart2_rts_cts: uart2_rts_cts {
pins = "PA2", "PA3";
function = "uart2";
};
};
};
fragment@2 {
target = <&uart2>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&uart2_pins>;
status = "okay";
};
};
};

View File

@ -0,0 +1,32 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h5";
fragment@0 {
target-path = "/aliases";
__overlay__ {
serial3 = "/soc/serial@01c28c00";
};
};
fragment@1 {
target = <&pio>;
__overlay__ {
uart3_rts_cts: uart3_rts_cts {
pins = "PA15", "PA16";
function = "uart3";
};
};
};
fragment@2 {
target = <&uart3>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&uart3_pins>;
status = "okay";
};
};
};

View File

@ -0,0 +1,27 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h5";
fragment@0 {
target = <&ehci0>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&ohci0>;
__overlay__ {
status = "okay";
};
};
fragment@2 {
target = <&usbphy>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,27 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h5";
fragment@0 {
target = <&ehci1>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&ohci1>;
__overlay__ {
status = "okay";
};
};
fragment@2 {
target = <&usbphy>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,27 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h5";
fragment@0 {
target = <&ehci2>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&ohci2>;
__overlay__ {
status = "okay";
};
};
fragment@2 {
target = <&usbphy>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,20 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h6";
fragment@0 {
target-path = "/aliases";
__overlay__ {
i2c0 = "/soc/i2c@5002000";
};
};
fragment@1 {
target = <&i2c0>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,20 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h6";
fragment@0 {
target-path = "/aliases";
__overlay__ {
i2c1 = "/soc/i2c@5002400";
};
};
fragment@1 {
target = <&i2c1>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,20 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h6";
fragment@0 {
target-path = "/aliases";
__overlay__ {
i2c2 = "/soc/i2c@5002800";
};
};
fragment@1 {
target = <&i2c2>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,22 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h6";
fragment@0 {
target-path = "/aliases";
__overlay__ {
serial1 = "/soc/serial@5000400";
};
};
fragment@1 {
target = <&uart1>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&uart1_pins>;
status = "okay";
};
};
};

View File

@ -0,0 +1,32 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h6";
fragment@0 {
target-path = "/aliases";
__overlay__ {
serial2 = "/soc/serial@5000800";
};
};
fragment@1 {
target = <&pio>;
__overlay__ {
uart2_rts_cts: uart2_rts_cts {
pins = "PD21", "PD22";
function = "uart2";
};
};
};
fragment@2 {
target = <&uart2>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&uart2_pins>;
status = "okay";
};
};
};

View File

@ -0,0 +1,32 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun50i-h6";
fragment@0 {
target-path = "/aliases";
__overlay__ {
serial3 = "/soc/serial@05000c00";
};
};
fragment@1 {
target = <&pio>;
__overlay__ {
uart3_rts_cts: uart3_rts_cts {
pins = "PD25", "PD26";
function = "uart3";
};
};
};
fragment@2 {
target = <&uart3>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&uart3_pins>;
status = "okay";
};
};
};

View File

@ -0,0 +1,20 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun8i-h3";
fragment@0 {
target-path = "/aliases";
__overlay__ {
i2c0 = "/soc/i2c@01c2ac00";
};
};
fragment@1 {
target = <&i2c0>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,20 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun8i-h3";
fragment@0 {
target-path = "/aliases";
__overlay__ {
i2c1 = "/soc/i2c@01c2b000";
};
};
fragment@1 {
target = <&i2c1>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,20 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun8i-h3";
fragment@0 {
target-path = "/aliases";
__overlay__ {
i2c2 = "/soc/i2c@01c2b400";
};
};
fragment@1 {
target = <&i2c2>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,22 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun8i-h3";
fragment@0 {
target-path = "/aliases";
__overlay__ {
serial1 = "/soc/serial@01c28400";
};
};
fragment@1 {
target = <&uart1>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&uart1_pins>;
status = "okay";
};
};
};

View File

@ -0,0 +1,22 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun8i-h3";
fragment@0 {
target-path = "/aliases";
__overlay__ {
serial2 = "/soc/serial@01c28800";
};
};
fragment@1 {
target = <&uart2>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&uart2_pins>;
status = "okay";
};
};
};

View File

@ -0,0 +1,22 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun8i-h3";
fragment@0 {
target-path = "/aliases";
__overlay__ {
serial3 = "/soc/serial@01c28c00";
};
};
fragment@1 {
target = <&uart3>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&uart3_pins>;
status = "okay";
};
};
};

View File

@ -0,0 +1,27 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun8i-h3";
fragment@0 {
target = <&ehci0>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&ohci0>;
__overlay__ {
status = "okay";
};
};
fragment@2 {
target = <&usbphy>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,27 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun8i-h3";
fragment@0 {
target = <&ehci1>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&ohci1>;
__overlay__ {
status = "okay";
};
};
fragment@2 {
target = <&usbphy>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,27 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun8i-h3";
fragment@0 {
target = <&ehci2>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&ohci2>;
__overlay__ {
status = "okay";
};
};
fragment@2 {
target = <&usbphy>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,27 @@
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun8i-h3";
fragment@0 {
target = <&ehci3>;
__overlay__ {
status = "okay";
};
};
fragment@1 {
target = <&ohci3>;
__overlay__ {
status = "okay";
};
};
fragment@2 {
target = <&usbphy>;
__overlay__ {
status = "okay";
};
};
};

View File

@ -0,0 +1,18 @@
#!/bin/sh
# helper script to generate sunxi-overlays-builtin.inc
OFILE="sunxi-overlays-builtin.inc"
echo "# generated by gen_builtin.sh" > $OFILE
for famd in $(ls -1d files/*/); do
fam=${famd##files/}
fam=${fam%%/}
echo "SRC_URI:${fam} = \" \\" >> $OFILE
for f in $(ls ${famd}*.dts); do
echo "file://$(basename $f) \\" >> $OFILE
done
echo "\"" >> $OFILE
families="$families|$fam"
done
families=${families#|}
echo "COMPATIBLE_MACHINE = \"(${families})\"" >> $OFILE

View File

@ -0,0 +1,38 @@
# generated by gen_builtin.sh
SRC_URI:sun50i = " \
file://h5-i2c0.dts \
file://h5-i2c1.dts \
file://h5-i2c2.dts \
file://h5-uart1.dts \
file://h5-uart2.dts \
file://h5-uart3.dts \
file://h5-usbhost0.dts \
file://h5-usbhost1.dts \
file://h5-usbhost2.dts \
file://h6-i2c0.dts \
file://h6-i2c1.dts \
file://h6-i2c2.dts \
file://h6-uart1.dts \
file://h6-uart2.dts \
file://h6-uart3.dts \
"
SRC_URI:sun50i-h616 = " \
file://h616-i2c0.dts \
file://h616-i2c1.dts \
file://h616-i2c2.dts \
file://h616-uart1.dts \
file://h616-uart2.dts \
"
SRC_URI:sun8i = " \
file://h3-i2c0.dts \
file://h3-i2c1.dts \
file://h3-i2c2.dts \
file://h3-uart1.dts \
file://h3-uart2.dts \
file://h3-uart3.dts \
file://h3-usbhost0.dts \
file://h3-usbhost1.dts \
file://h3-usbhost2.dts \
file://h3-usbhost3.dts \
"
COMPATIBLE_MACHINE = "(sun50i|sun50i-h616|sun8i)"

View File

@ -0,0 +1,11 @@
DESCRIPTION = "Support for sunxi DT overlays"
LICENSE = "MIT"
SUNXI_OVERLAYS_ENABLE ??= ""
require sunxi-overlays-builtin.inc
inherit devicetree

View File

@ -1,11 +1,64 @@
# Default to (primary) SD
rootdev=mmcblk0p2
# boot.cmd with overlay support
# edit sunxienv.txt to add overlays
setenv load_addr "0x45000000"
# Default env variables
setenv ov_error "n"
setenv rootdev "mmcblk${devnum}p2"
setenv earlycon "n"
setenv overlays
echo "meta-sunxi boot devtype=${devtype} devnum=${devnum}"
# Print boot source
itest.b *0x28 == 0x00 && echo "U-boot loaded from SD"
itest.b *0x28 == 0x01 && echo "U-boot loaded from NAND"
itest.b *0x28 == 0x02 && echo "U-boot loaded from eMMC or secondary SD"
itest.b *0x28 == 0x03 && echo "U-boot loaded from SPI"
# Load sunxienv.txt
if test -e ${devtype} ${devnum} sunxienv.txt; then
load ${devtype} ${devnum} ${load_addr} sunxienv.txt
env import -t ${load_addr} ${filesize}
echo "sunxienv.txt loaded"
fi
if itest.b *0x28 == 0x02 ; then
# U-Boot loaded from eMMC or secondary SD so use it for rootfs too
echo "U-boot loaded from eMMC or secondary SD"
rootdev=mmcblk1p2
fi
# bootargs
if test "${earlycon}" = "y"; then setenv extra "earlycon ${extra}"; fi
setenv bootargs console=${console} console=tty1 root=/dev/${rootdev} rootwait panic=10 ${extra}
load mmc 0:1 ${fdt_addr_r} ${fdtfile}
load mmc 0:1 ${kernel_addr_r} Image
# Load kernel
load ${devtype} ${devnum} ${kernel_addr_r} Image
# load fdt
load ${devtype} ${devnum} ${fdt_addr_r} ${fdtfile}
# apply overlays
if test -n "${overlays}"; then
fdt addr ${fdt_addr_r}
fdt resize 65536
for ov in ${overlays}; do
if load ${devtype} ${devnum} ${load_addr} /dtbo/${ov}.dtbo; then
echo "Applying DT overlay ${ov}.dtbo"
fdt apply ${load_addr} || setenv ov_error "y"
else
setenv ov_error "y"
fi
done
# Restore orginal fdt if overaly failed
if test "${ov_error}" = "y"; then
echo "Error in DT overaly resoring main DT"
load ${devtype} ${devnum} ${fdt_addr_r} ${fdtfile}
fi
fi
# Finally boot withou intramfs
booti ${kernel_addr_r} - ${fdt_addr_r}

View File

@ -1,11 +1,64 @@
# Default to (primary) SD
rootdev=mmcblk0p2
# boot.cmd with overlay support
# edit sunxienv.txt to add overlays
setenv load_addr "0x45000000"
# Default env variables
setenv ov_error "n"
setenv rootdev "mmcblk${devnum}p2"
setenv earlycon "n"
setenv overlays
echo "meta-sunxi boot devtype=${devtype} devnum=${devnum}"
# Print boot source
itest.b *0x28 == 0x00 && echo "U-boot loaded from SD"
itest.b *0x28 == 0x01 && echo "U-boot loaded from NAND"
itest.b *0x28 == 0x02 && echo "U-boot loaded from eMMC or secondary SD"
itest.b *0x28 == 0x03 && echo "U-boot loaded from SPI"
# Load sunxienv.txt
if test -e ${devtype} ${devnum} sunxienv.txt; then
load ${devtype} ${devnum} ${load_addr} sunxienv.txt
env import -t ${load_addr} ${filesize}
echo "sunxienv.txt loaded"
fi
if itest.b *0x28 == 0x02 ; then
# U-Boot loaded from eMMC or secondary SD so use it for rootfs too
echo "U-boot loaded from eMMC or secondary SD"
rootdev=mmcblk1p2
fi
# bootargs
if test "${earlycon}" = "y"; then setenv extra "earlycon ${extra}"; fi
setenv bootargs console=${console} console=tty1 root=/dev/${rootdev} rootwait panic=10 ${extra}
load mmc 0:1 ${fdt_addr_r} ${fdtfile} || load mmc 0:1 ${fdt_addr_r} boot/${fdtfile}
load mmc 0:1 ${kernel_addr_r} zImage || load mmc 0:1 ${kernel_addr_r} boot/zImage || load mmc 0:1 ${kernel_addr_r} uImage || load mmc 0:1 ${kernel_addr_r} boot/uImage
# load fdt
load ${devtype} ${devnum} ${fdt_addr_r} ${fdtfile} || load ${devtype} ${devnum} ${fdt_addr_r} boot/${fdtfile}
# apply overlays
if test -n "${overlays}"; then
fdt addr ${fdt_addr_r}
fdt resize 65536
for ov in ${overlays}; do
if load ${devtype} ${devnum} ${load_addr} /dtbo/${ov}.dtbo; then
echo "Applying DT overlay ${ov}.dtbo"
fdt apply ${load_addr} || setenv ov_error "y"
else
setenv ov_error "y"
fi
done
# Restore orginal fdt if overaly failed
if test "${ov_error}" = "y"; then
echo "Error in DT overaly resoring main DT"
load ${devtype} ${devnum} ${fdt_addr_r} ${fdtfile} || load ${devtype} ${devnum} ${fdt_addr_r} boot/${fdtfile}
fi
fi
# Load the kernel
load ${devtype} ${devnum} ${kernel_addr_r} zImage || load ${devtype} ${devnum} ${kernel_addr_r} boot/zImage || load ${devtype} ${devnum} ${kernel_addr_r} uImage || load ${devtype} ${devnum} ${kernel_addr_r} boot/uImage
# Finally boot withou intramfs
bootz ${kernel_addr_r} - ${fdt_addr_r} || bootm ${kernel_addr_r} - ${fdt_addr_r}

View File

@ -28,3 +28,31 @@ do_compile_sun50i[depends] += "atf-sunxi:do_deploy"
do_compile:append:sunxi() {
${B}/tools/mkimage -C none -A arm -T script -d ${WORKDIR}/boot.cmd ${WORKDIR}/${UBOOT_ENV_BINARY}
}
# Add custom env files
do_install:append:sunxi() {
if ${@bb.utils.contains('DISTRO_FEATURES','sunxi-env','false','true',d)}; then
return
fi
echo "# sunxi boot parameters" > ${D}/boot/sunxienv.txt
echo "# extra=" >> ${D}/boot/sunxienv.txt
echo "overlays=${SUNXI_OVERLAYS_ENABLE}" >> ${D}/boot/sunxienv.txt
chmod 0644 ${D}/boot/sunxienv.txt
}
do_deploy:append:sunxi() {
if ${@bb.utils.contains('DISTRO_FEATURES','sunxi-env','false','true',d)}; then
return
fi
install -Dm 0644 ${D}/boot/sunxienv.txt ${DEPLOYDIR}/sunxienv.txt
}
FILES:${PN} += "${@bb.utils.contains('DISTRO_FEATURES','sunxi-env','/boot/sunxienv.txt','',d)}"
RDEPENDS:${PN}:append = " ${@ '' if (d.getVar('SUNXI_OVERLAYS_ENABLE') or "").strip() == "" else 'sunxi-overlays'}"

View File

@ -16,6 +16,9 @@ DEPENDS += "rsync-native"
# Pull in the devicetree files into the rootfs
RDEPENDS_${KERNEL_PACKAGE_NAME}-base += "kernel-devicetree"
# if sunxi-env featture is enable devicetrees need to be compiled with symbols
KERNEL_DTC_FLAGS += " ${@bb.utils.contains('DISTRO_FEATURES','sunxi-env','-@ -H epapr','',d)}"
KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}"
S = "${WORKDIR}/linux-${PV}"