mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-24 00:04:38 +02:00
Add initial version of the new Image Builder
It's still a bit rough in a few places, but it seems to work for Broadcom at least - other targets untested. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@6071 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
1d77522787
commit
b806b00806
@ -59,6 +59,7 @@ config SOURCE_FEEDS
|
||||
Separate sources with spaces : " "
|
||||
|
||||
source "toolchain/Config.in"
|
||||
source "target/imagebuilder/Config.in"
|
||||
source "target/sdk/Config.in"
|
||||
|
||||
menu "Target Images"
|
||||
|
@ -77,10 +77,15 @@ endef
|
||||
define BuildImage
|
||||
download:
|
||||
prepare:
|
||||
compile: compile-targets
|
||||
ifneq ($(IB),1)
|
||||
compile: compile-targets
|
||||
$(call Build/Compile)
|
||||
else
|
||||
compile:
|
||||
endif
|
||||
|
||||
install: compile install-targets
|
||||
ifneq ($(IB),1)
|
||||
install: compile install-targets
|
||||
$(call Image/Prepare)
|
||||
$(call Image/mkfs/prepare)
|
||||
$(call Image/BuildKernel)
|
||||
@ -88,9 +93,21 @@ install: compile install-targets
|
||||
$(call Image/mkfs/squashfs)
|
||||
$(call Image/mkfs/tgz)
|
||||
$(call Image/mkfs/ext2)
|
||||
else
|
||||
install: compile install-targets
|
||||
$(call Image/BuildKernel)
|
||||
$(call Image/mkfs/jffs2)
|
||||
$(call Image/mkfs/squashfs)
|
||||
$(call Image/mkfs/tgz)
|
||||
$(call Image/mkfs/ext2)
|
||||
endif
|
||||
|
||||
clean: clean-targets
|
||||
ifneq ($(IB),1)
|
||||
clean: clean-targets
|
||||
$(call Build/Clean)
|
||||
else
|
||||
clean:
|
||||
endif
|
||||
|
||||
compile-targets:
|
||||
install-targets:
|
||||
|
@ -7,6 +7,11 @@
|
||||
|
||||
include $(TMP_DIR)/.target.mk
|
||||
|
||||
ifeq ($(IB),1)
|
||||
$(TMP_DIR)/.target.mk: $(TOPDIR)/.target.mk
|
||||
$(CP) $< $@
|
||||
else
|
||||
$(TMP_DIR)/.target.mk: $(TMP_DIR)/.targetinfo
|
||||
$(SCRIPT_DIR)/gen_target_mk.pl < $(TMP_DIR)/.targetinfo > $@
|
||||
endif
|
||||
|
||||
|
@ -12,25 +12,24 @@ all: install
|
||||
$(BIN_DIR):
|
||||
mkdir -p $(BIN_DIR)
|
||||
|
||||
TARGETS-y := linux
|
||||
TARGETS-$(CONFIG_SDK) += sdk
|
||||
|
||||
linux-install: $(BIN_DIR)
|
||||
image_install: linux-install
|
||||
|
||||
IMAGE_DIR:=linux/$(BOARD)-$(KERNEL)/image
|
||||
|
||||
|
||||
download: $(patsubst %,%-download,$(TARGETS-y))
|
||||
prepare: linux-prepare
|
||||
compile: linux-compile image_compile
|
||||
install: image_clean $(patsubst %,%-install,$(TARGETS-y)) image_install
|
||||
clean: $(patsubst %,%-clean,$(TARGETS-y)) image_clean
|
||||
install: image_clean linux-install sdk_install image_install imagebuilder_install
|
||||
clean: linux-clean sdk-clean imagebuilder-clean image_clean
|
||||
|
||||
prereq: FORCE
|
||||
$(MAKE) -C linux/$(BOARD)-$(KERNEL) prereq
|
||||
$(MAKE) -C $(IMAGE_DIR) prereq
|
||||
|
||||
sdk_install: FORCE
|
||||
$(MAKE) -C sdk install
|
||||
|
||||
image_clean: FORCE
|
||||
$(MAKE) -C $(IMAGE_DIR) clean
|
||||
rm -f $(BIN_DIR)/openwrt-*
|
||||
@ -41,6 +40,9 @@ image_compile: FORCE
|
||||
image_install: image_compile
|
||||
$(MAKE) -C $(IMAGE_DIR) install
|
||||
|
||||
imagebuilder_install: image_install
|
||||
$(MAKE) -C imagebuilder install
|
||||
|
||||
%-clean: FORCE
|
||||
$(MAKE) -C $(patsubst %-clean,%,$@) clean
|
||||
%-download: FORCE
|
||||
|
10
target/imagebuilder/Config.in
Normal file
10
target/imagebuilder/Config.in
Normal file
@ -0,0 +1,10 @@
|
||||
config IB
|
||||
bool "Build the OpenWrt Image Builder"
|
||||
depends !TARGET_ROOTFS_INITRAMFS
|
||||
default y if ALL
|
||||
help
|
||||
This is essentially a stripped-down version of the buildroot
|
||||
with precompiled packages, kernel image and image building tools.
|
||||
You can use it to generate custom images without compiling anything
|
||||
|
||||
|
46
target/imagebuilder/Makefile
Normal file
46
target/imagebuilder/Makefile
Normal file
@ -0,0 +1,46 @@
|
||||
#
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# $Id: Makefile 6070 2007-01-10 21:21:59Z nbd $
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/host.mk
|
||||
|
||||
PKG_OS:=$(shell uname -s)
|
||||
PKG_CPU:=$(shell uname -m)
|
||||
|
||||
IB_NAME:=OpenWrt-ImageBuilder-$(BOARD)-$(KERNEL)-for-$(PKG_OS)-$(PKG_CPU)
|
||||
IB_BUILD_DIR:=$(BUILD_DIR)/$(IB_NAME)
|
||||
|
||||
all: compile
|
||||
|
||||
$(BIN_DIR)/$(IB_NAME).tar.bz2:
|
||||
rm -rf $(IB_BUILD_DIR)
|
||||
mkdir -p $(IB_BUILD_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD) $(IB_BUILD_DIR)/staging_dir_$(ARCH)/bin $(IB_BUILD_DIR)/target/linux
|
||||
$(CP) \
|
||||
$(INCLUDE_DIR) $(SCRIPT_DIR) $(PACKAGE_DIR) \
|
||||
$(TOPDIR)/rules.mk $(TOPDIR)/.config \
|
||||
$(TMP_DIR)/.target.mk \
|
||||
./files/Makefile \
|
||||
$(IB_BUILD_DIR)/
|
||||
$(CP) $(STAGING_DIR)/bin/* $(IB_BUILD_DIR)/staging_dir_$(ARCH)/bin
|
||||
$(CP) $(TOPDIR)/target/linux/* $(IB_BUILD_DIR)/target/linux
|
||||
rm -rf $(IB_BUILD_DIR)/target/linux/*/patches
|
||||
-cp $(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)/* $(IB_BUILD_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD) # don't copy subdirectories here
|
||||
find $(IB_BUILD_DIR) -name .svn | xargs rm -rf
|
||||
find $(IB_BUILD_DIR) -name CVS | xargs rm -rf
|
||||
(cd $(BUILD_DIR); \
|
||||
tar cfj $@ $(IB_NAME); \
|
||||
)
|
||||
|
||||
download:
|
||||
prepare:
|
||||
compile: $(BIN_DIR)/$(IB_NAME).tar.bz2
|
||||
install: compile
|
||||
|
||||
clean:
|
||||
rm -rf $(IB_BUILD_DIR) $(BIN_DIR)/$(IB_NAME).tar.bz2
|
147
target/imagebuilder/files/Makefile
Normal file
147
target/imagebuilder/files/Makefile
Normal file
@ -0,0 +1,147 @@
|
||||
# Makefile for the OpenWrt Image Builder
|
||||
#
|
||||
# Copyright (C) 2006-2007 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
export TOPDIR=${CURDIR}
|
||||
|
||||
all: help
|
||||
|
||||
include rules.mk
|
||||
include .config
|
||||
|
||||
SHELL:=/usr/bin/env bash
|
||||
export LC_ALL=C
|
||||
export LANG=C
|
||||
ifeq ($(KBUILD_VERBOSE),99)
|
||||
MAKE:=3>/dev/null $(MAKE)
|
||||
endif
|
||||
export IS_TTY=$(shell tty -s && echo 1 || echo 0)
|
||||
|
||||
# override variables from rules.mk
|
||||
PACKAGE_DIR:=$(TOPDIR)/packages
|
||||
IPKG:= \
|
||||
IPKG_TMP="$(TOPDIR)/tmp/ipkgtmp" \
|
||||
IPKG_INSTROOT="$(TARGET_DIR)" \
|
||||
IPKG_CONF_DIR="$(TOPDIR)/tmp" \
|
||||
IPKG_OFFLINE_ROOT="$(TARGET_DIR)" \
|
||||
$(SCRIPT_DIR)/ipkg -force-defaults
|
||||
|
||||
|
||||
define Profile/Default
|
||||
ID:=
|
||||
NAME:=
|
||||
PACKAGES:=
|
||||
endef
|
||||
|
||||
define Profile
|
||||
$(eval $(call Profile/Default))
|
||||
$(eval $(call Profile/$(1)))
|
||||
ifneq ($(ID),)
|
||||
ifeq ($(PROFILE),)
|
||||
PROFILE:=$(ID)
|
||||
endif
|
||||
$(ID)_NAME:=$(NAME)
|
||||
$(ID)_PACKAGES:=$(PACKAGES)
|
||||
PROFILE_LIST += \
|
||||
echo '$(ID):'; echo ' $(NAME)';
|
||||
endif
|
||||
endef
|
||||
|
||||
include .target.mk
|
||||
|
||||
define Helptext
|
||||
Available Commands:
|
||||
help: This help text
|
||||
info: Show a list of available target profiles
|
||||
clean: Remove images and temporary build files
|
||||
image: Build an image (see below for more information).
|
||||
|
||||
Building images:
|
||||
By default 'make image' will create an image with the default
|
||||
target profile and package set. You can use the following parameters
|
||||
to change that:
|
||||
|
||||
make image PROFILE="<profilename>" # override the default target profile
|
||||
make image PACKAGES="<pkg1> [<pkg2> [<pkg3> ...]]" # include extra packages
|
||||
make image FILES="<path>" # include extra files from <path>
|
||||
|
||||
endef
|
||||
$(eval $(call shexport,Helptext))
|
||||
|
||||
help: FORCE
|
||||
echo "$$$(call shvar,Helptext)"
|
||||
|
||||
info: FORCE
|
||||
echo 'Current Target: "$(BOARDNAME)"'
|
||||
echo 'Available Profiles:'
|
||||
echo; $(PROFILE_LIST)
|
||||
|
||||
$(TOPDIR)/tmp/ipkg.conf: FORCE
|
||||
@mkdir -p $(TOPDIR)/tmp
|
||||
@echo 'dest root /' > $@
|
||||
@echo 'src packages file:$(TOPDIR)/packages' >> $@
|
||||
|
||||
BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $(PACKAGES) $($(PROFILE)_PACKAGES) kernel)
|
||||
BUILD_PACKAGES:=$(patsubst base-files,base-files-$(BOARD)-$(KERNEL),$(BUILD_PACKAGES))
|
||||
|
||||
image: $(TOPDIR)/tmp/ipkg.conf
|
||||
if [ -z "$($(PROFILE)_NAME)" ]; then \
|
||||
echo Profile $(PROFILE) not found.; \
|
||||
echo 'Use "make info" to get a list of available target profiles'; \
|
||||
false; \
|
||||
fi
|
||||
echo 'Building images for $(BOARDNAME) - $($(PROFILE)_NAME)'
|
||||
echo 'Packages: $(BUILD_PACKAGES)'
|
||||
echo
|
||||
rm -rf $(TARGET_DIR)
|
||||
mkdir -p $(TARGET_DIR) $(BIN_DIR) $(TMP_DIR)
|
||||
$(MAKE) package_index
|
||||
$(MAKE) package_install
|
||||
ifneq ($(FILES),)
|
||||
$(MAKE) copy_files
|
||||
endif
|
||||
$(MAKE) package_postinst
|
||||
$(MAKE) build_image
|
||||
|
||||
package_index: FORCE
|
||||
@echo
|
||||
@echo Building package index...
|
||||
(cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages) >/dev/null 2>/dev/null
|
||||
$(IPKG) update
|
||||
|
||||
package_install: FORCE
|
||||
@echo
|
||||
@echo Installing packages...
|
||||
$(IPKG) install $(BUILD_PACKAGES)
|
||||
|
||||
copy_files: FORCE
|
||||
@echo
|
||||
@echo Copying extra files
|
||||
$(CP) $(FILES)/* $(TARGET_DIR)/
|
||||
|
||||
package_postinst: FORCE
|
||||
@echo
|
||||
@echo Activating init scripts
|
||||
( \
|
||||
cd $(BUILD_DIR)/root; \
|
||||
for script in ./etc/init.d/*; do \
|
||||
grep '#!/bin/sh /etc/rc.common' $$script >/dev/null || continue; \
|
||||
IPKG_INSTROOT=$(BUILD_DIR)/root $(which bash) ./etc/rc.common $$script enable; \
|
||||
done; \
|
||||
)
|
||||
|
||||
build_image: FORCE
|
||||
@echo
|
||||
@echo Building images...
|
||||
$(NO_TRACE_MAKE) -C target/linux/$(BOARD)-$(KERNEL)/image install IB=1
|
||||
|
||||
clean:
|
||||
rm -rf tmp $(TARGET_DIR)
|
||||
|
||||
.PHONY: FORCE
|
||||
.SILENT: help info image
|
||||
%: ;
|
@ -7,8 +7,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
|
||||
define Image/Prepare
|
||||
cp $(KDIR)/linux-*/vmlinux $(KDIR)/vmlinux.elf
|
||||
endef
|
||||
|
||||
define Image/BuildKernel
|
||||
cp $(KDIR)/linux-*/vmlinux $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux.elf
|
||||
cp $(KDIR)/vmlinux.elf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux.elf
|
||||
gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
|
||||
$(STAGING_DIR)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.bin.l7
|
||||
dd if=$(KDIR)/vmlinux.bin.l7 of=$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux.lzma bs=65536 conv=sync
|
||||
|
@ -24,10 +24,11 @@ define Build/Clean
|
||||
endef
|
||||
|
||||
define Image/Prepare
|
||||
cp $(LINUX_DIR)/arch/arm/boot/zImage $(KDIR)/zImage
|
||||
endef
|
||||
|
||||
define Image/BuildKernel
|
||||
cp $(LINUX_DIR)/arch/arm/boot/zImage $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-zImage
|
||||
cp $(KDIR)/zImage $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-zImage
|
||||
# $(shell BIN_DIR=$(BIN_DIR) $(TOPDIR)/scripts/arm-magic.sh)
|
||||
BIN_DIR=$(BIN_DIR) $(TOPDIR)/scripts/arm-magic.sh
|
||||
endef
|
||||
|
@ -11,10 +11,11 @@ define Build/Clean
|
||||
endef
|
||||
|
||||
define Image/Prepare
|
||||
cp $(LINUX_DIR)/arch/ppc/boot/images/uImage $(KDIR)/uImage
|
||||
endef
|
||||
|
||||
define Image/BuildKernel
|
||||
cp $(LINUX_DIR)/arch/ppc/boot/images/uImage $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-uImage
|
||||
cp $(KDIR)/uImage $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-uImage
|
||||
endef
|
||||
|
||||
define Image/Build
|
||||
@ -23,7 +24,7 @@ endef
|
||||
|
||||
define Image/Build/jffs2-64k
|
||||
( \
|
||||
dd if=$(LINUX_DIR)/arch/ppc/boot/images/uImage bs=65536 conv=sync; \
|
||||
dd if=$(KDIR)/uImage bs=65536 conv=sync; \
|
||||
dd if=$(KDIR)/root.$(1) bs=65536 conv=sync; \
|
||||
) > $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
|
||||
endef
|
||||
|
@ -29,13 +29,13 @@ define Build/Clean
|
||||
endef
|
||||
|
||||
define Image/Prepare
|
||||
$(STAGING_DIR)/bin/patch-cmdline $(LINUX_DIR)/vmlinux 'root=/dev/cfa2 '
|
||||
$(KERNEL_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $(LINUX_DIR)/vmlinux $(LINUX_KERNEL)
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
$(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile
|
||||
cp $(LINUX_DIR)/vmlinux $(KDIR)/vmlinux.elf
|
||||
endef
|
||||
|
||||
define Image/BuildKernel
|
||||
cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
|
||||
$(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean compile
|
||||
$(CP) $(KDIR)/loader.elf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux
|
||||
endef
|
||||
|
||||
@ -52,7 +52,7 @@ root=/dev/cfa2 rootfstype=ext2
|
||||
endef
|
||||
|
||||
define Image/Build
|
||||
$(STAGING_DIR)/bin/patch-cmdline $(LINUX_DIR)/vmlinux '$(strip $(call Image/cmdline/$(1))) '
|
||||
$(STAGING_DIR)/bin/patch-cmdline $(KDIR)/vmlinux.elf '$(strip $(call Image/cmdline/$(1))) '
|
||||
./gen_image.sh $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).bin 4 $(LINUX_DIR)/vmlinux 16 $(KDIR)/root.$(1)
|
||||
endef
|
||||
|
||||
|
@ -11,11 +11,12 @@ define Build/Clean
|
||||
endef
|
||||
|
||||
define Image/Prepare
|
||||
$(CP) $(LINUX_DIR)/arch/i386/boot/bzImage $(KDIR)/bzImage
|
||||
endef
|
||||
|
||||
define Image/Build
|
||||
touch $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
|
||||
$(STAGING_DIR)/bin/airlink -b 0 -j $(LINUX_DIR)/arch/i386/boot/bzImage $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
|
||||
$(STAGING_DIR)/bin/airlink -b 0 -j $(KDIR)/bzImage $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
|
||||
endef
|
||||
|
||||
$(eval $(call BuildImage))
|
||||
|
@ -7,9 +7,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
|
||||
define Image/Prepare
|
||||
cp $(LINUX_DIR)/linux $(KDIR)/vmlinux.elf
|
||||
endef
|
||||
|
||||
define Image/Build
|
||||
cp $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img
|
||||
cp $(LINUX_DIR)/linux $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux
|
||||
cp $(KDIR)/vmlinux.elf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux
|
||||
endef
|
||||
|
||||
$(eval $(call BuildImage))
|
||||
|
@ -49,10 +49,14 @@ ifeq ($(CONFIG_X86_GRUB_IMAGES),y)
|
||||
endef
|
||||
endif
|
||||
|
||||
define Image/Prepare
|
||||
cp $(LINUX_DIR)/arch/i386/boot/bzImage $(KDIR)/bzImage
|
||||
endef
|
||||
|
||||
define Image/Build
|
||||
$(call Image/Build/grub,$(1))
|
||||
cp $(KDIR)/root.$(1) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).fs
|
||||
cp $(LINUX_DIR)/arch/i386/boot/bzImage $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz
|
||||
cp $(KDIR)/bzImage $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinuz
|
||||
endef
|
||||
|
||||
$(eval $(call BuildImage))
|
||||
|
Loading…
Reference in New Issue
Block a user