Root/binaries/reflash/Makefile

1#
2# Written 2010, by Xiangfu Liu.
3#
4
5LOADER = openwrt-xburst-qi_lb60-u-boot.bin
6KERNEL = openwrt-xburst-qi_lb60-uImage.bin
7ROOTFS_UBI = openwrt-xburst-qi_lb60-root.ubi
8ROOTFS_UBIFS = openwrt-xburst-qi_lb60-root.ubifs
9ROOTFS_TGZ = openwrt-xburst-qi_lb60-rootfs.tar.gz
10
11QI_IMAGE_URL=http://downloads.qi-hardware.com/software/images/Ben_NanoNote_2GB_NAND/latest/
12QI_MIRKO_URL=http://downloads.qi-hardware.com/people/mirko/testing/
13
14DL=$(if $(wildcard ../dl/.),../dl,dl)
15
16.PHONY: all clean reflash_rootfs reflash_kernel reflash_uboot
17
18all: reflash_rootfs reflash_kernel reflash_uboot
19
20$(DL)/$(ROOTFS_TGZ).ok:
21    mkdir -p dl
22    wget -c -O $(DL)/$(ROOTFS) $(QI_IMAGE_URL)/$(ROOTFS_TGZ)
23    touch $@
24
25$(DL)/$(KERNEL).ok:
26    mkdir -p dl
27    wget -c -O $(DL)/$(KERNEL) $(QI_MIRKO_URL)/$(KERNEL)
28    touch $@
29
30$(DL)/$(LOADER).ok:
31    mkdir -p dl
32    wget -c -O $(DL)/$(LOADER) $(QI_MIRKO_URL)/$(LOADER)
33    touch $@
34
35create_rootfs: $(DL)/$(ROOTFS_TGZ).ok
36    mkdir -p $(DL)/rootfs_tmp
37    tar xvf $(DL)/$(ROOTFS_TGZ) -C $(DL)/rootfs_tmp/
38    cp -rf ../sie_rootfs_files/* $(DL)/rootfs_tmp/
39    mkfs.ubifs -r $(DL)/rootfs_tmp/ -m 4096 -e 516096 -c 4095 -o $(ROOTFS_UBIFS)
40    ubinize -o $(ROOTFS_UBI) -m 4096 -p 512KiB ubinize.cfg
41    touch $@
42
43reflash_rootfs: create_rootfs
44    sudo usbboot -f ./usbboot_2gb_nand.cfg -c "boot;nerase 16 512 0 0;nprog 2048 $(DL)/$(ROOTFS_UBI) 0 0 -n"
45
46reflash_kernel: $(DL)/$(KERNEL).ok
47    sudo usbboot -f ./usbboot_2gb_nand.cfg -c "boot;nprog 1024 $(DL)/$(KERNEL) 0 0 -n"
48
49reflash_uboot: $(DL)/$(LOADER).ok
50    sudo usbboot -f ./usbboot_2gb_nand.cfg -c "boot;nprog 0 $(DL)/$(LOADER) 0 0 -n"
51
52clean:
53    rm -rf $(DL)
54    rm -rf $(ROOTFS_UBI) $(ROOTFS_UBIFS)
55    rm -rf create_rootfs
56

Archive Download this file

Branches:
master



interactive