2ce86599954c8dd376a9bc4868b8de0c1693b34d
[openwrt/staging/rmilecki.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 SIGNATURE:=$(shell printf "%.8s" $(SOURCE_DATE_EPOCH))
11
12 define Build/tegra-sdcard
13 rm -fR $@.boot
14 mkdir -p $@.boot
15 $(CP) $(KDIR)/$(KERNEL_NAME) $@.boot
16 $(if $(DEVICE_DTS),\
17 $(foreach dtb,$(DEVICE_DTS),$(CP) $(DTS_DIR)/$(dtb).dtb $@.boot), \
18 $(CP) $(DTS_DIR)/*.dtb $@.boot)
19 sed \
20 -e 's#@ROOT@#$(SIGNATURE)#g' \
21 -e 's#@KERNEL@#$(KERNEL_NAME)#g' \
22 $(BOOT_SCRIPT) > $@-boot.scr
23 mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
24 -n '$(DEVICE_TITLE) OpenWrt bootscript' \
25 -d $@-boot.scr \
26 $@.boot/boot.scr
27
28 SIGNATURE="$(SIGNATURE)" \
29 $(SCRIPT_DIR)/gen_image_generic.sh \
30 $@ \
31 $(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \
32 $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS) \
33 2048
34
35 $(if $(UBOOT),dd if=$(STAGING_DIR_IMAGE)/$(UBOOT).img of=$@ bs=512 skip=1 seek=1 conv=notrunc)
36 endef
37
38 DEVICE_VARS += BOOT_SCRIPT UBOOT
39 define Device/Default
40 BOOT_SCRIPT := generic-bootscript
41 IMAGES := sdcard.img.gz
42 IMAGE/sdcard.img.gz := tegra-sdcard | gzip | append-metadata
43 KERNEL_NAME := zImage
44 KERNEL := kernel-bin
45 PROFILES := Default
46 SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
47 endef
48
49 define Device/compulab_trimslice
50 DEVICE_VENDOR := CompuLab
51 DEVICE_MODEL := TrimSlice
52 DEVICE_DTS := tegra20-trimslice
53 DEVICE_PACKAGES := kmod-r8169 kmod-rt2800-usb kmod-rtc-em3027 \
54 kmod-usb-storage wpad-mini
55 UBOOT := trimslice-mmc
56 endef
57 TARGET_DEVICES += compulab_trimslice
58
59 $(eval $(call BuildImage))