omap: rework image generation and profiles
Migrate to new image generation and introduce sdcard generation (based on sunxi). Profile now generated via image/Makefile instead of profiles/ directory. Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
This commit is contained in:
		@@ -4,6 +4,7 @@
 | 
				
			|||||||
# This is free software, licensed under the GNU General Public License v2.
 | 
					# This is free software, licensed under the GNU General Public License v2.
 | 
				
			||||||
# See /LICENSE for more information.
 | 
					# See /LICENSE for more information.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
include $(TOPDIR)/rules.mk
 | 
					include $(TOPDIR)/rules.mk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ARCH:=arm
 | 
					ARCH:=arm
 | 
				
			||||||
@@ -25,6 +26,4 @@ endef
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
include $(INCLUDE_DIR)/target.mk
 | 
					include $(INCLUDE_DIR)/target.mk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DEFAULT_PACKAGES += uboot-omap-am335x_evm uboot-omap-omap3_beagle uboot-omap-omap3_overo uboot-omap-omap4_panda
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$(eval $(call BuildTarget))
 | 
					$(eval $(call BuildTarget))
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										5
									
								
								target/linux/omap/image/Config.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								target/linux/omap/image/Config.in
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					config OMAP_SD_BOOT_PARTSIZE
 | 
				
			||||||
 | 
						int "Boot (SD Card) filesystem partition size (in MB)"
 | 
				
			||||||
 | 
						depends on TARGET_omap
 | 
				
			||||||
 | 
						default 20
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -7,35 +7,74 @@
 | 
				
			|||||||
include $(TOPDIR)/rules.mk
 | 
					include $(TOPDIR)/rules.mk
 | 
				
			||||||
include $(INCLUDE_DIR)/image.mk
 | 
					include $(INCLUDE_DIR)/image.mk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FAT32_BLOCK_SIZE=1024
 | 
				
			||||||
 | 
					FAT32_BLOCKS=$(shell echo $$(($(CONFIG_OMAP_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
UBIFS_OPTS = -F -m 2048 -e 124KiB -c 4096 -U
 | 
					UBIFS_OPTS = -F -m 2048 -e 124KiB -c 4096 -U
 | 
				
			||||||
UBI_OPTS = -m 2048 -p 128KiB -s 512 -O 2048
 | 
					UBI_OPTS = -m 2048 -p 128KiB -s 512 -O 2048
 | 
				
			||||||
 | 
					
 | 
				
			||||||
define Image/BuildKernel
 | 
					define Build/omap-sdcard
 | 
				
			||||||
	$(CP) $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
 | 
						rm -f $@.boot
 | 
				
			||||||
 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
 | 
						mkfs.fat $@.boot -C $(FAT32_BLOCKS)
 | 
				
			||||||
	$(CP) $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs
 | 
					
 | 
				
			||||||
 endif
 | 
						mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)/MLO ::MLO
 | 
				
			||||||
	-mkdir $(BIN_DIR)/dtbs
 | 
						mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)/u-boot.img ::u-boot.img
 | 
				
			||||||
	-$(CP) $(DTS_DIR)/am335x*.dtb $(BIN_DIR)/dtbs/
 | 
						mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)/uEnv.txt ::uEnv.txt
 | 
				
			||||||
	-$(CP) $(DTS_DIR)/omap3*.dtb $(BIN_DIR)/dtbs/
 | 
						mmd -i $@.boot ::/dtbs
 | 
				
			||||||
	-$(CP) $(DTS_DIR)/omap4*.dtb $(BIN_DIR)/dtbs/
 | 
						mcopy -i $@.boot $(DTS_DIR)/$(DEVICE_DTS).dtb ::/dtbs/$(DEVICE_DTS).dtb
 | 
				
			||||||
 | 
						mcopy -i $@.boot $(IMAGE_KERNEL) ::/zImage
 | 
				
			||||||
 | 
						./gen_omap_sdcard_img.sh $@ \
 | 
				
			||||||
 | 
							$@.boot \
 | 
				
			||||||
 | 
							$(IMAGE_ROOTFS) \
 | 
				
			||||||
 | 
							$(CONFIG_OMAP_SD_BOOT_PARTSIZE) \
 | 
				
			||||||
 | 
							$(CONFIG_TARGET_ROOTFS_PARTSIZE)
 | 
				
			||||||
 | 
						rm -f $@.boot
 | 
				
			||||||
endef
 | 
					endef
 | 
				
			||||||
 | 
					
 | 
				
			||||||
define Image/Build
 | 
					define Device/Default
 | 
				
			||||||
	$(call Image/Build/$(1),$(1))
 | 
					  PROFILES := Default
 | 
				
			||||||
 | 
					  DEVICE_VARS :=
 | 
				
			||||||
 | 
					  KERNEL_NAME := zImage
 | 
				
			||||||
 | 
					  KERNEL := kernel-bin
 | 
				
			||||||
 | 
					  IMAGES := sdcard.img.gz
 | 
				
			||||||
 | 
					  IMAGE/sdcard.img.gz := omap-sdcard | append-metadata | gzip
 | 
				
			||||||
 | 
					  SUPPORTED_DEVICES = $$(DEVICE_DTS)
 | 
				
			||||||
endef
 | 
					endef
 | 
				
			||||||
 | 
					
 | 
				
			||||||
define Image/Build/jffs2-64k
 | 
					#uboot-omap-am335x_evm uboot-omap-omap3_beagle uboot-omap-omap3_overo uboot-omap-omap4_panda
 | 
				
			||||||
	dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=65536 conv=sync
 | 
					
 | 
				
			||||||
 | 
					define Device/am335x-evm
 | 
				
			||||||
 | 
					  DEVICE_TITLE := TI AM335x EVM
 | 
				
			||||||
 | 
					  DEVICE_DTS := am335x-evm
 | 
				
			||||||
endef
 | 
					endef
 | 
				
			||||||
 | 
					
 | 
				
			||||||
define Image/Build/jffs2-128k
 | 
					TARGET_DEVICES += am335x-evm
 | 
				
			||||||
	dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=131072 conv=sync
 | 
					
 | 
				
			||||||
 | 
					define Device/am335x-boneblack
 | 
				
			||||||
 | 
					  DEVICE_TITLE := TI AM335x BeagleBone Black
 | 
				
			||||||
 | 
					  DEVICE_DTS := am335x-boneblack
 | 
				
			||||||
endef
 | 
					endef
 | 
				
			||||||
 | 
					
 | 
				
			||||||
define Image/Build/squashfs
 | 
					TARGET_DEVICES += am335x-boneblack
 | 
				
			||||||
	$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
 | 
					
 | 
				
			||||||
	dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=131072 conv=sync
 | 
					define Device/omap4-panda
 | 
				
			||||||
 | 
					  DEVICE_TITLE := OMAP4 TI pandaboard
 | 
				
			||||||
 | 
					  DEVICE_DTS := omap4-panda
 | 
				
			||||||
 | 
					  DEVICE_PACKAGES := kmod-usb-net-smsc95xx
 | 
				
			||||||
endef
 | 
					endef
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TARGET_DEVICES += omap4-panda
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					define Device/omap3-beagle
 | 
				
			||||||
 | 
					  DEVICE_TITLE := OMAP3 TI beagleboard
 | 
				
			||||||
 | 
					  DEVICE_DTS := omap3-beagle
 | 
				
			||||||
 | 
					  # beagleboard doesn't have a network interface, support most common usb net
 | 
				
			||||||
 | 
					  DEVICE_PACKAGES := kmod-usb-net \
 | 
				
			||||||
 | 
						kmod-usb-net-asix kmod-usb-net-asix-ax88179 kmod-usb-net-hso \
 | 
				
			||||||
 | 
						kmod-usb-net-kaweth kmod-usb-net-pegasus kmod-usb-net-mcs7830 \
 | 
				
			||||||
 | 
						kmod-usb-net-smsc95xx kmod-usb-net-dm9601-ether
 | 
				
			||||||
 | 
					endef
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TARGET_DEVICES += omap3-beagle
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$(eval $(call BuildImage))
 | 
					$(eval $(call BuildImage))
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										33
									
								
								target/linux/omap/image/gen_omap_sdcard_img.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										33
									
								
								target/linux/omap/image/gen_omap_sdcard_img.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,33 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Copyright (C) 2013 OpenWrt.org
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# This is free software, licensed under the GNU General Public License v2.
 | 
				
			||||||
 | 
					# See /LICENSE for more information.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set -x
 | 
				
			||||||
 | 
					[ $# -eq 5 ] || {
 | 
				
			||||||
 | 
					    echo "SYNTAX: $0 <file> <bootfs image> <rootfs image> <bootfs size> <rootfs size>"
 | 
				
			||||||
 | 
					    exit 1
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					OUTPUT="$1"
 | 
				
			||||||
 | 
					BOOTFS="$2"
 | 
				
			||||||
 | 
					ROOTFS="$3"
 | 
				
			||||||
 | 
					BOOTFSSIZE="$4"
 | 
				
			||||||
 | 
					ROOTFSSIZE="$5"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					head=4
 | 
				
			||||||
 | 
					sect=63
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set `ptgen -o $OUTPUT -h $head -s $sect -l 1024 -t c -p ${BOOTFSSIZE}M -t 83 -p ${ROOTFSSIZE}M`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BOOTOFFSET="$(($1 / 512))"
 | 
				
			||||||
 | 
					BOOTSIZE="$(($2 / 512))"
 | 
				
			||||||
 | 
					ROOTFSOFFSET="$(($3 / 512))"
 | 
				
			||||||
 | 
					ROOTFSSIZE="$(($4 / 512))"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc
 | 
				
			||||||
 | 
					dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc
 | 
				
			||||||
@@ -6,7 +6,14 @@
 | 
				
			|||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
define Profile/Default
 | 
					define Profile/Default
 | 
				
			||||||
	NAME:=Default Profile
 | 
					  NAME:=Default Profile
 | 
				
			||||||
 | 
					  PACKAGES:= \
 | 
				
			||||||
 | 
						kmod-usb-net \
 | 
				
			||||||
 | 
						kmod-usb-net-asix kmod-usb-net-asix-ax88179 kmod-usb-net-hso \
 | 
				
			||||||
 | 
						kmod-usb-net-kaweth kmod-usb-net-pegasus kmod-usb-net-mcs7830 \
 | 
				
			||||||
 | 
						kmod-usb-net-smsc95xx kmod-usb-net-dm9601-ether \
 | 
				
			||||||
 | 
						wpad-mini
 | 
				
			||||||
 | 
					  PRIORITY := 1
 | 
				
			||||||
endef
 | 
					endef
 | 
				
			||||||
 | 
					
 | 
				
			||||||
define Profile/Default/Description
 | 
					define Profile/Default/Description
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,23 +0,0 @@
 | 
				
			|||||||
#
 | 
					 | 
				
			||||||
# Copyright (C) 2015 OpenWrt.org
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# This is free software, licensed under the GNU General Public License v2.
 | 
					 | 
				
			||||||
# See /LICENSE for more information.
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
define Profile/BEAGLEBOARD
 | 
					 | 
				
			||||||
	NAME:=EBV BeagleBoard
 | 
					 | 
				
			||||||
	DEFAULT_PACKAGES += \
 | 
					 | 
				
			||||||
			kmod-usb-net kmod-usb-net-asix \
 | 
					 | 
				
			||||||
			kmod-usb-net-asix-ax88179 kmod-usb-net-hso \
 | 
					 | 
				
			||||||
			kmod-usb-net-kaweth kmod-usb-net-pegasus \
 | 
					 | 
				
			||||||
			kmod-usb-net-mcs7830 kmod-usb-net-smsc95xx \
 | 
					 | 
				
			||||||
			kmod-usb-net-dm9601-ether
 | 
					 | 
				
			||||||
endef
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
define Profile/BEAGLEBOARD/Description
 | 
					 | 
				
			||||||
	Package set for the BEAGLEBOARD and similar devices.
 | 
					 | 
				
			||||||
	Contains various USB-NET drivers for boards without Ethernet.
 | 
					 | 
				
			||||||
endef
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$(eval $(call Profile,BEAGLEBOARD))
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user