33e7b508d966b94b15f6cdaf9dcdfd869bedb078
[openwrt/openwrt.git] / target / linux / tegra / image / Makefile
1 #
2 # Copyright (C) 2017-2019 Tomasz Maciej Nowak <tomek_n@o2.pl>
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
9
10 define Build/tegra-sdcard
11 rm -fR $@.boot
12 mkdir -p $@.boot
13 $(CP) $(KDIR)/$(KERNEL_NAME) $@.boot
14 $(if $(DEVICE_DTS),\
15 $(foreach dtb,$(DEVICE_DTS),$(CP) $(DTS_DIR)/$(dtb).dtb $@.boot), \
16 $(CP) $(DTS_DIR)/*.dtb $@.boot)
17 sed \
18 -e 's#@ROOT@#$(IMG_PART_SIGNATURE)#g' \
19 -e 's#@KERNEL@#$(KERNEL_NAME)#g' \
20 $(BOOT_SCRIPT) > $@-boot.scr
21 mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
22 -n '$(DEVICE_TITLE) OpenWrt bootscript' \
23 -d $@-boot.scr \
24 $@.boot/boot.scr
25
26 SIGNATURE="$(IMG_PART_SIGNATURE)" \
27 $(SCRIPT_DIR)/gen_image_generic.sh \
28 $@ \
29 $(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \
30 $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS) \
31 2048
32
33 $(if $(UBOOT),dd if=$(STAGING_DIR_IMAGE)/$(UBOOT).img of=$@ bs=512 skip=1 seek=1 conv=notrunc)
34 endef
35
36 DEVICE_VARS += BOOT_SCRIPT UBOOT
37
38 define Device/Default
39 BOOT_SCRIPT := generic-bootscript
40 IMAGES := sdcard.img.gz
41 IMAGE/sdcard.img.gz := tegra-sdcard | gzip | append-metadata
42 KERNEL_NAME := zImage
43 KERNEL := kernel-bin
44 PROFILES := Default
45 SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
46 endef
47
48 define Device/compulab_trimslice
49 DEVICE_VENDOR := CompuLab
50 DEVICE_MODEL := TrimSlice
51 DEVICE_DTS := tegra20-trimslice
52 DEVICE_PACKAGES := kmod-r8169 kmod-rt2800-usb kmod-rtc-em3027 \
53 kmod-usb-storage wpad-basic-wolfssl
54 UBOOT := trimslice-mmc
55 endef
56 TARGET_DEVICES += compulab_trimslice
57
58 $(eval $(call BuildImage))