at91: fix sdcard create image
[openwrt/openwrt.git] / target / linux / at91 / image / sama5.mk
1 AT91_SD_BOOT_PARTSIZE:=64
2 FAT32_BLOCK_SIZE:=1024
3 FAT32_BLOCKS:=$(shell echo \
4 $$(($(AT91_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
5
6 define Build/at91-sdcard
7 rm -f $@.boot
8 mkfs.fat -C $@.boot $(FAT32_BLOCKS)
9
10 mcopy -i $@.boot $(KDIR)/zImage ::zImage
11
12 $(foreach dts,$(DEVICE_DTS), \
13 mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb \
14 ::$(dts).dtb;)
15
16 mcopy -i $@.boot \
17 $(BIN_DIR)/u-boot-$(DEVICE_NAME:at91-%=%)_mmc/u-boot.bin \
18 ::u-boot.bin
19
20 $(CP) $(BIN_DIR)/at91bootstrap-$(DEVICE_NAME:at91-%=%)sd*/at91bootstrap.bin \
21 $@.BOOT.bin; \
22 mcopy -i $@.boot $@.BOOT.bin ::BOOT.bin
23
24 ./gen_at91_sdcard_img.sh \
25 $@.img \
26 $@.boot \
27 $(KDIR)/root.ext4 \
28 $(AT91_SD_BOOT_PARTSIZE) \
29 $(CONFIG_TARGET_ROOTFS_PARTSIZE)
30
31 gzip -nc9 $@.img > $@
32
33 rm -f $@.img $@.boot $@.BOOT.bin
34 endef
35
36 define Device/evaluation-sdimage
37 IMAGES += sdcard.img.gz
38 IMAGE/sdcard.img.gz := at91-sdcard
39 endef
40
41 define Device/default-nand
42 BLOCKSIZE := 128k
43 PAGESIZE := 2048
44 SUBPAGESIZE := 2048
45 MKUBIFS_OPTS := -m $$(PAGESIZE) -e 124KiB -c 2048
46 endef
47
48 define Device/at91-sama5d3_xplained
49 $(Device/evaluation-dtb)
50 DEVICE_TITLE := Microchip(Atmel AT91) SAMA5D3 Xplained
51 KERNEL_SIZE := 6144k
52 $(Device/evaluation-sdimage)
53 endef
54 TARGET_DEVICES += at91-sama5d3_xplained
55
56 define Device/at91-sama5d2_xplained
57 $(Device/evaluation-dtb)
58 DEVICE_TITLE := Microchip(Atmel AT91) SAMA5D2 Xplained
59 KERNEL_SIZE := 6144k
60 $(Device/evaluation-sdimage)
61 endef
62 TARGET_DEVICES += at91-sama5d2_xplained
63
64 define Device/at91-sama5d4_xplained
65 $(Device/evaluation-dtb)
66 DEVICE_TITLE := Microchip(Atmel AT91) SAMA5D4 Xplained
67 KERNEL_SIZE := 6144k
68 BLOCKSIZE := 256k
69 PAGESIZE := 4096
70 SUBPAGESIZE := 2048
71 MKUBIFS_OPTS := -m $$(PAGESIZE) -e 248KiB -c 2082 -x lzo
72 $(Device/evaluation-sdimage)
73 endef
74 TARGET_DEVICES += at91-sama5d4_xplained
75
76 ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
77 ifeq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"")
78 define Device/wb50n
79 $(Device/evaluation-fit)
80 DEVICE_TITLE := Laird WB50N
81 DEVICE_PACKAGES := \
82 kmod-mmc-at91 kmod-ath6kl-sdio ath6k-firmware \
83 kmod-usb-storage kmod-fs-vfat kmod-fs-msdos \
84 kmod-leds-gpio
85 BLOCKSIZE := 128k
86 PAGESIZE := 2048
87 SUBPAGESIZE := 2048
88 MKUBIFS_OPTS := -m $$(PAGESIZE) -e 124KiB -c 955
89 endef
90 TARGET_DEVICES += wb50n
91 endif
92 endif