[LEDE-DEV] Adding support for dlink dwr-512

Mathias Kresin dev at kresin.me
Sun Oct 2 12:51:30 PDT 2016


02.10.2016 21:10, Giuseppe Lippolis:
> Hi all,
> I'm trying to port lede to the dwr-512.
> I'm using the latest trunk downloaded with
> git clone https://git.lede-project.org/source.git
>
> The dwr-512 oem bootloader accept a firmware image that shall be processed
> with a dlink tool called binboy and need the binary_kernel_image (lzma
> compressed) + the sqashfs_root.
> In addition, using the oem bootloader, I'm unable to pass kernel param and
> device tree.
>
> More detail here: https://wiki.openwrt.org/inbox/d-link/d-link_dwr-512_b in
> the section FW installation.
>
> I start some discussion in the bug report but I realize it is better to use
> the mailing list.
> According with the latest advice of Mathias Kresin I should use the default
> strategy to generate an Image, therefore I add the following path:
>
> diff --git a/target/linux/ramips/image/rt305x.mk
> b/target/linux/ramips/image/rt305x.mk
> index be21ac4..e830675 100644
> --- a/target/linux/ramips/image/rt305x.mk
> +++ b/target/linux/ramips/image/rt305x.mk
> @@ -168,6 +168,13 @@ endef
>  TARGET_DEVICES += dir-620-d1
>
>
> +define Device/dwr-512-b
> +  DTS := DWR-512-B
> +  DEVICE_TITLE := D-Link DWR-512 B
> +endef
> +TARGET_DEVICES += dwr-512-b
> +
> +
>  define Device/esr-9753
>    DTS := ESR-9753
>    BLOCKSIZE := 64k

You need to add support for the binboy format to tools/firmware-utils/. 
Might be possible that there is already a util to create the required 
header format.

Next step is to add a build recipe for the binboy header. Have a look at 
[0] for an example.

Your build code _might_ look like the following in the end:

define Device/dwr-512-b
   DTS := DWR-512-B
   KERNEL := kernel-bin | append-dtb | lzma
   IMAGES := factory.bin
   IMAGE/factory.bin := \
	append-kernel | binboy-header | append-rootfs | binboy-header
   DEVICE_TITLE := D-Link DWR-512 B
endef
TARGET_DEVICES += dwr-512-b

The basic build recipes like append-dtb are defined in 
include/image-commands.mk. Have a look at target/linux/*/image/Makefile 
to see how it is done for other boards.

The build code is made to build complete images and hide the build 
artefacts from the user. You can find the kernel created by the KERNEL 
line in build_dir/target-mipsel_24kc_musl-1.1.15/linux-ramips_rt305x/.

To see what really happens during the image build, run 'make 
target/linux/install V=s' after the build is finished.

Mathias

[0] 
https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/ramips/image/Makefile;h=d165ec55126e0824cc4b7b11e09a6dc3e425a496;hb=HEAD#l86



More information about the Lede-dev mailing list