706cc65d92e86a91212c3c71b7c9f2e80bf47078
[openwrt/staging/dedeckeh.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 PADDING="$(CONFIG_TARGET_IMAGES_PAD)" \
29 SIGNATURE="$(SIGNATURE)" \
30 $(SCRIPT_DIR)/gen_image_generic.sh \
31 $@ \
32 $(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \
33 $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS) \
34 2048
35
36 $(if $(UBOOT),dd if=$(STAGING_DIR_IMAGE)/$(UBOOT).img of=$@ bs=512 skip=1 seek=1 conv=notrunc)
37 endef
38
39 DEVICE_VARS += BOOT_SCRIPT UBOOT
40 define Device/Default
41 BOOT_SCRIPT := generic-bootscript
42 IMAGES := sdcard.img.gz
43 IMAGE/sdcard.img.gz := tegra-sdcard | gzip | append-metadata
44 KERNEL_NAME := zImage
45 KERNEL := kernel-bin
46 PROFILES := Default
47 endef
48
49 define Device/trimslice
50 DEVICE_TITLE := CompuLab TrimSlice
51 DEVICE_DTS := tegra20-trimslice
52 DEVICE_PACKAGES := kmod-r8169 kmod-rt2800-usb kmod-rtc-em3027 \
53 kmod-usb-storage wpad-mini
54 SUPPORTED_DEVICES := compulab,trimslice
55 UBOOT := trimslice-mmc
56 endef
57 TARGET_DEVICES += trimslice
58
59 $(eval $(call BuildImage))