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