diff options
author | Zoltan HERPAI <wigyori@uid0.hu> | 2014-09-14 13:47:42 +0000 |
---|---|---|
committer | Zoltan HERPAI <wigyori@uid0.hu> | 2014-09-14 13:47:42 +0000 |
commit | b23fe461c19c8616eb4a1e81d8ad1d6073349338 (patch) | |
tree | 15b5045e54dd218d4d7b6c433490ad9ce6704495 /target/linux/sunxi/image | |
parent | 61d5cd647faafa987e820fb4057b2a3439749140 (diff) | |
download | master-187ad058-b23fe461c19c8616eb4a1e81d8ad1d6073349338.tar.gz master-187ad058-b23fe461c19c8616eb4a1e81d8ad1d6073349338.tar.bz2 master-187ad058-b23fe461c19c8616eb4a1e81d8ad1d6073349338.zip |
sunxi: add sdcard image generation support when board profile is selected
Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@42534 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/sunxi/image')
-rw-r--r-- | target/linux/sunxi/image/Config.in | 5 | ||||
-rw-r--r-- | target/linux/sunxi/image/Makefile | 59 | ||||
-rwxr-xr-x | target/linux/sunxi/image/gen_sunxi_sdcard_img.sh | 35 |
3 files changed, 98 insertions, 1 deletions
diff --git a/target/linux/sunxi/image/Config.in b/target/linux/sunxi/image/Config.in new file mode 100644 index 0000000000..0d6861c631 --- /dev/null +++ b/target/linux/sunxi/image/Config.in @@ -0,0 +1,5 @@ +config SUNXI_SD_BOOT_PARTSIZE + int "Boot (SD Card) filesystem partition size (in MB)" + depends on TARGET_sunxi + default 20 + diff --git a/target/linux/sunxi/image/Makefile b/target/linux/sunxi/image/Makefile index c41c51b424..81ba5979ec 100644 --- a/target/linux/sunxi/image/Makefile +++ b/target/linux/sunxi/image/Makefile @@ -6,6 +6,10 @@ # include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk +include $(INCLUDE_DIR)/host.mk + +FAT32_BLOCK_SIZE=1024 +FAT32_BLOCKS=$(shell echo $$(($(CONFIG_SUNXI_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE)))) BOARDS:= \ sun4i-a10-cubieboard \ @@ -40,9 +44,62 @@ define Image/BuildKernel ) endef +define Image/Build/SDCard + rm -f $(KDIR)/boot.img + mkdosfs $(KDIR)/boot.img -C $(FAT32_BLOCKS) + + mcopy -i $(KDIR)/boot.img $(BIN_DIR)/uboot-sunxi-$(PROFILE)/openwrt-sunxi-$(PROFILE)-uEnv.txt ::uEnv.txt + mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(2).dtb ::dtb + mcopy -i $(KDIR)/boot.img $(BIN_DIR)/$(IMG_PREFIX)-uImage ::uImage + + ./gen_sunxi_sdcard_img.sh \ + $(BIN_DIR)/$(IMG_PREFIX)-$(PROFILE)-sdcard-vfat-$(1).img \ + $(KDIR)/boot.img \ + $(KDIR)/root.$(1) \ + $(CONFIG_SUNXI_SD_BOOT_PARTSIZE) \ + $(CONFIG_TARGET_ROOTFS_PARTSIZE) \ + $(BIN_DIR)/uboot-sunxi-$(PROFILE)/openwrt-sunxi-$(PROFILE)-u-boot-with-spl.bin +endef + +define Image/Build/Profile/A10-OLinuXino-Lime + $(call Image/Build/SDCard,$(1),sun4i-a10-olinuxino-lime) +endef + +define Image/Build/Profile/A13-OLinuXino + $(call Image/Build/SDCard,$(1),sun5i-a13-olinuxino) +endef + +define Image/Build/Profile/A20-OLinuXino_MICRO + $(call Image/Build/SDCard,$(1),sun7i-a20-olinuxino-micro) +endef + +define Image/Build/Profile/Bananapi + $(call Image/Build/SDCard,$(1),sun7i-a20-bananapi) +endef + +define Image/Build/Profile/Cubieboard + $(call Image/Build/SDCard,$(1),sun4i-a10-cubieboard) +endef + +define Image/Build/Profile/Cubieboard2 + $(call Image/Build/SDCard,$(1),sun7i-a20-cubieboard2) +endef + +define Image/Build/Profile/OLIMEX-A13-SOM + $(call Image/Build/SDCard,$(1),sun5i-a13-olinuxino) +endef + +define Image/Build/Profile/pcDuino + $(call Image/Build/SDCard,$(1),sun4i-a10-pcduino) +endef + +define Image/Build/Profile/Linksprite_pcDuino3 + $(call Image/Build/SDCard,$(1),sun7i-a20-pcduino3) +endef + define Image/Build $(call Image/Build/$(1),$(1)) - dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-root.$(1) bs=128k conv=sync + $(call Image/Build/Profile/$(PROFILE),$(1)) endef $(eval $(call BuildImage)) diff --git a/target/linux/sunxi/image/gen_sunxi_sdcard_img.sh b/target/linux/sunxi/image/gen_sunxi_sdcard_img.sh new file mode 100755 index 0000000000..06957a5aec --- /dev/null +++ b/target/linux/sunxi/image/gen_sunxi_sdcard_img.sh @@ -0,0 +1,35 @@ +#!/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 +[ $# == 6 ] || { + echo "SYNTAX: $0 <file> <bootfs image> <rootfs image> <bootfs size> <rootfs size> <u-boot image>" + exit 1 +} + +OUTPUT="$1" +BOOTFS="$2" +ROOTFS="$3" +BOOTFSSIZE="$4" +ROOTFSSIZE="$5" +UBOOT="$6" + +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=1024 if="$UBOOT" of="$OUTPUT" seek=8 conv=notrunc +dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc +dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc |