source: trunk/openwrt/target/linux/fonera2n/image/Makefile @ 2296

Last change on this file since 2296 was 2296, checked in by matthijs, 6 years ago

build-system: Fix building with TARGET_ROOTFS_INITRAMFS=y.

This allows a booting the image through TFTP instead of having to flash
the image onto the Fonera. This needs serial access to tell the
bootloader to boot from TFTP instead of internal flash, though.

This patch was tested only on 2.0n.

File size: 1.5 KB
Line 
1#
2# Copyright (C) 2008 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7include $(TOPDIR)/rules.mk
8include $(INCLUDE_DIR)/image.mk
9
10define Image/Prepare
11        rm -rf $(TARGET_DIR)/usr/lib/opkg
12        rm -rf $(TARGET_DIR)/usr/lib/ikpg
13        # Create an empty opkg dir, to make it easier to use opkg on the
14        # Fonera.
15        mkdir -p $(TARGET_DIR)/usr/lib/opkg
16        for a in `grep usr/bin/lua $(TARGET_DIR)/etc/fonstated/*| cut -d: -f1`; do \
17                ${STAGING_DIR_HOST}/bin/luac -s -o $$$${a}.tmp $$$$a; \
18                echo '#!/usr/bin/lua' > $$$$a; \
19                cat $$$${a}.tmp >> $$$$a; \
20                rm $$$${a}.tmp; \
21        done
22        chmod a+x  $(TARGET_DIR)/etc/fonstated/*
23endef
24
25define Image/BuildKernel
26        $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux -lc1 -lp2 -pb2 $(KDIR)/vmlinux.lzma
27        mkimage -A mips -O linux -T kernel -a 80000000 -C lzma -e \
28                0x80000000 \
29                -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
30                -d $(KDIR)/vmlinux.lzma $(KDIR)/uImage.lzma
31        $(call Image/Build/Initramfs)
32endef
33
34ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
35  define Image/Build/Initramfs
36        cp $(KDIR)/uImage.lzma $(BIN_DIR)/openwrt-$(BOARD)-initrd.uImage
37  endef
38endif
39
40define Image/Build/squashfs
41        # Align and append a JFFS marker
42        $(call prepare_generic_squashfs,$(KDIR)/root.$(1))
43endef
44
45define Image/Build
46        $(call Image/Build/$(1),$(1))
47        ( \
48                dd if=$(KDIR)/uImage.lzma bs=1024k conv=sync; \
49                dd if=$(KDIR)/root.$(1) bs=65536 conv=sync; \
50        ) > $(BIN_DIR)/openwrt-$(BOARD)-$(1).img
51endef
52
53$(eval $(call BuildImage))
Note: See TracBrowser for help on using the repository browser.