1 (edited by hnyman 2011-01-29 19:27:06)

Topic: Good build scripts? and scripts for copying built snapshots?

Wiki is a bit vague about the exact commands to rebuild new versions, so I thought to share my current build script and ask about better script versions.

The script below updates svn source, updates feeds, then runs 'defconfig' and 'menuconfig', and finally builds the system.
I am running this script both for Backfire and Trunk branches.
Any comments for it?

#!/usr/bin/env sh
#
# update-and-make  -   Update source code and make the build
echo "Update SVN source..."
svn up
svn info >bin/ar71xx/svninfo.txt
echo "...update feeds..."
./scripts/feeds update -a
echo "...install feeds..."
./scripts/feeds install -a
echo "...make defconfig..."
make defconfig
echo "...make menuconfig..."
make menuconfig
echo "...make world..."
make -j 3 V=99 2>&1 | tee build.log | grep -i error

Additionally, I include my current script for mounting a shared directory in VirtualBox in order to copy the built binary and config files from Ubuntu guest system used for building to the Windows 7 host system. (Similar script can naturally be used also just for copying snaphot files to another location in the system.)

The script mounts the shared folder and then copies both my Backfire and Trunk builds along the .config files, svn diffs and md5 checksums marking all files with clear timestamps (SVN revision and copying date/time).

echo Mount shared folder
Mountpoint=/media/windows-share
sudo mount -t vboxsf WNDR3700 $Mountpoint

echo -n Copy Backfire...
BSvnTime=r`svn info /Openwrt/backfire | grep Revision |cut -d " " -f 2`-`date +%F-%H%M`
BFile=$Mountpoint/WNDR3700-backfire-$BSvnTime
svn diff /Openwrt/backfire > $BFile-svn.diff
svn diff /Openwrt/backfire/feeds/packages > $BFile-packages.diff
grep squashfs-sysupgrade /Openwrt/backfire/bin/ar71xx/md5sums > $BFile-md5.txt
cp /Openwrt/backfire/bin/ar71xx/openwrt-ar71xx-wndr3700-squashfs-sysupgrade.bin $BFile-squashfs-sysupgrade.bin
cp /Openwrt/backfire/.config $BFile.config
echo done.

sleep 3

echo -n Copy Trunk...
TSvnTime=r`svn info /Openwrt/trunk | grep Revision |cut -d " " -f 2`-`date +%F-%H%M`
TFile=$Mountpoint/WNDR3700-trunk-$TSvnTime
svn diff /Openwrt/trunk > $TFile-svn.diff
svn diff /Openwrt/trunk/feeds/packages > $TFile-packages.diff
grep squashfs-sysupgrade /Openwrt/trunk/bin/ar71xx/md5sums > $TFile-md5.txt
cp /Openwrt/trunk/bin/ar71xx/openwrt-ar71xx-generic-wndr3700-squashfs-sysupgrade.bin $TFile-squashfs-sysupgrade.bin
cp /Openwrt/trunk/.config $TFile.config
echo done.

The result is:

WNDR3700-trunk-r25062-2011-01-22-2050-md5.txt
WNDR3700-trunk-r25062-2011-01-22-2050-svn.diff
WNDR3700-trunk-r25062-2011-01-22-2050-packages.diff
WNDR3700-trunk-r25062-2011-01-22-2050.config
WNDR3700-trunk-r25062-2011-01-22-2050-squashfs-sysupgrade.bin
WNDR3700-backfire-r25062-2011-01-22-2050-md5.txt
WNDR3700-backfire-r25062-2011-01-22-2050-svn.diff
WNDR3700-backfire-r25062-2011-01-22-2050-packages.diff
WNDR3700-backfire-r25062-2011-01-22-2050.config
WNDR3700-backfire-r25062-2011-01-22-2050-squashfs-sysupgrade.bin

Comments?

2 (edited by Nilfred 2011-01-24 18:49:39)

Re: Good build scripts? and scripts for copying built snapshots?

To pre-download source code 10 connections at time before make world:

make -j 10 download

Apply custom patches.
ar71xx has a good example in base-files, there are so many defconfig and uci-defaults scripts I don't need wasting flash space, but this is not a bug. I like to get rid of them, moreover if files folder is populated with custom config files:

# opkg files base-files
Package base-files (64-r25060) is installed on root and has the following files:
/bin/ipcalc.sh
/bin/login.sh
/etc/banner
/etc/config/system
/etc/config/timeserver
/etc/defconfig/ap81/network
/etc/defconfig/ap83/network
/etc/defconfig/ap96/network
/etc/defconfig/aw-nr580/network
/etc/defconfig/bullet-m/network
/etc/defconfig/dir-600-a1/network
/etc/defconfig/dir-615-c1/network
/etc/defconfig/dir-825-b1/network
/etc/defconfig/eap7660d/network
/etc/defconfig/generic/network
/etc/defconfig/ja76pf/network
/etc/defconfig/jwap003/network
/etc/defconfig/mzk-w04nu/network
/etc/defconfig/nbg460n_550n_550nh/network
/etc/defconfig/pb42/network
/etc/defconfig/pb44/network
/etc/defconfig/rb-411/network
/etc/defconfig/rb-433/network
/etc/defconfig/rb-433u/network
/etc/defconfig/rb-450g/network
/etc/defconfig/rb-450/network
/etc/defconfig/rb-750/network
/etc/defconfig/routerstation/network
/etc/defconfig/routerstation-pro/network
/etc/defconfig/tew-632brp/network
/etc/defconfig/tl-mr3220/network
/etc/defconfig/tl-mr3420/network
/etc/defconfig/tl-wa901nd/network
/etc/defconfig/tl-wr1043nd/network
/etc/defconfig/tl-wr741nd/network
/etc/defconfig/tl-wr841n-v1/network
/etc/defconfig/tl-wr941nd/network
/etc/defconfig/wndr3700/network
/etc/defconfig/wnr2000/network
/etc/defconfig/wp543/network
/etc/defconfig/wrt160nl/network
/etc/defconfig/wzr-hp-g300nh/network
/etc/diag.sh
/etc/fstab
/etc/functions.sh
/etc/group
/etc/hosts
/etc/hotplug2-common.rules
/etc/hotplug2-init.rules
/etc/hotplug.d/ieee1394/10-ieee1394
/etc/hotplug.d/iface/00-netstate
/etc/hotplug.d/iface/10-routes
/etc/hotplug.d/iface/40-rdate
/etc/hotplug.d/net/10-net
/etc/hotplug.d/usb/10-usb
/etc/init.d/boot
/etc/init.d/defconfig
/etc/init.d/done
/etc/init.d/led
/etc/init.d/network
/etc/init.d/rcS
/etc/init.d/sysctl
/etc/init.d/umount
/etc/init.d/usb
/etc/init.d/watchdog
/etc/inittab
/etc/mtab
/etc/passwd
/etc/preinit
/etc/profile
/etc/protocols
/etc/rc.common
/etc/rc.local
/etc/resolv.conf
/etc/shells
/etc/sysctl.conf
/etc/sysupgrade.conf
/etc/TZ
/etc/uci-defaults/dir-825
/etc/uci-defaults/mzk-w04nu
/etc/uci-defaults/nbg460n_550n_550nh
/etc/uci-defaults/rb750
/etc/uci-defaults/tl-mr3x20
/etc/uci-defaults/tl-wr1043nd
/etc/uci-defaults/tl-wr941nd
/etc/uci-defaults/vlan-migration
/etc/uci-defaults/wndr3700
/etc/uci-defaults/wrt160nl
/etc/uci-defaults/wzr-hp-g300nh
/etc/uci-defaults/zcn-1523h-2
/etc/uci-defaults/zcn-1523h-5
/init
/lib/ar71xx.sh
/lib/firstboot/05_firstboot_skip
/lib/firstboot/10_determine_parts
/lib/firstboot/10_no_fo_clear_overlay
/lib/firstboot/10_reset_has_mini_fo
/lib/firstboot/20_has_mini_fo
/lib/firstboot/20_no_fo_mount_jffs
/lib/firstboot/20_reset_clear_jffs
/lib/firstboot/30_is_rootfs_mounted
/lib/firstboot/30_no_fo_pivot
/lib/firstboot/30_reset_copy_rom
/lib/firstboot/40_copy_ramoverlay
/lib/firstboot/40_no_fo_copy_ramoverlay
/lib/firstboot/50_pivot
/lib/firstboot/99_10_no_fo_cleanup
/lib/firstboot/99_10_with_fo_cleanup
/lib/functions/boot.sh
/lib/network/config.sh
/lib/preinit/03_preinit_do_ar71xx.sh
/lib/preinit/05_enable_reset_button_ar71xx
/lib/preinit/05_mount_skip
/lib/preinit/05_set_iface_mac_ar71xx
/lib/preinit/05_set_preinit_iface_ar71xx
/lib/preinit/10_check_for_mtd
/lib/preinit/10_essential_fs
/lib/preinit/10_indicate_failsafe
/lib/preinit/10_indicate_preinit
/lib/preinit/20_check_jffs2_ready
/lib/preinit/20_device_fs_mount
/lib/preinit/30_device_fs_daemons
/lib/preinit/30_failsafe_wait
/lib/preinit/40_init_shm
/lib/preinit/40_mount_devpts
/lib/preinit/40_mount_jffs2
/lib/preinit/40_run_failsafe_hook
/lib/preinit/41_merge_overlay_hooks
/lib/preinit/50_choose_console
/lib/preinit/50_indicate_regular_preinit
/lib/preinit/60_init_hotplug
/lib/preinit/70_initramfs_test
/lib/preinit/70_pivot_jffs2_root
/lib/preinit/80_mount_root
/lib/preinit/90_init_console
/lib/preinit/90_mount_no_jffs2
/lib/preinit/90_restore_config
/lib/preinit/99_10_failsafe_login
/lib/preinit/99_10_mount_no_mtd
/lib/preinit/99_10_run_init
/lib/upgrade/common.sh
/lib/upgrade/keep.d/base-files
/lib/upgrade/keep.d/base-files-essential
/lib/upgrade/platform.sh
/rom/note
/sbin/firstboot
/sbin/hotplug-call
/sbin/ifdown
/sbin/ifup
/sbin/led.sh
/sbin/mount_root
/sbin/sysupgrade
/sbin/wget2nand
/sbin/wifi
/usr/lib/common.awk
/usr/share/udhcpc/default.script
/var

Also there are patches not approved but I like to test, so a folder that survive a dist clean with those patches executes before a make world. Orion for example has many old good tickets waiting approval.
Sooner or later you will need that too wink

EDIT: Typo. opkg files base-files output is sorted

Netgear WNR854T (ARM Marvell Orion CPU 500MHz, Marvell 88W8361P mini-PCI STA only, 8/32MB) - trunk r17427 since 09/09/09 to 06-06-12 GLOD
TP-LINK TL-WR741ND v1.9 (Atheros AR7240 CPU 350MHz, Atheros AR9285 Chipset, 4/32MB) - trunk r23281 since 10/10/10
TP-LINK TL-MR3420 v1.1, TL-MR3220 v1.2 - trunk r25302 since 11/11/11
TP-LINK TL-WR842ND v1.0, TL-WR1043ND v1.8 - 12.09-rc1 since 12/12/12

Re: Good build scripts? and scripts for copying built snapshots?

Here's the scripts that I use for checkout, update and build.  This example is for a trunk build for the TL-WR1043ND (ar71xx).

checkout.sh

#!/bin/sh

# checkout source
svn checkout svn://svn.openwrt.org/openwrt/trunk .

# create symbolic link to download directory
ln -s ~/openwrt/download/trunk dl

# update/install feeds
scripts/feeds update packages luci
scripts/feeds install -a -p luci
scripts/feeds install iperf
scripts/feeds install ntpd ntp-utils
scripts/feeds install tcpdump tcpdump-mini
scripts/feeds install openssh-server vsftpd
scripts/feeds install asterisk16
scripts/feeds install

update.sh

#!/bin/sh

# update source
svn update .

# create symbolic link to download directory
if [ ! -d dl ]; then
        ln -s ~/openwrt/download/trunk dl
fi

# update/install feeds
scripts/feeds update packages luci
scripts/feeds install -a -p luci
scripts/feeds install iperf
scripts/feeds install ntpd ntp-utils
scripts/feeds install tcpdump tcpdump-mini
scripts/feeds install openssh-server vsftpd
scripts/feeds install asterisk16
scripts/feeds install

Note: It is assumed that you run "make menuconfig" before running "build.sh".

build.sh

#!/bin/sh

# get svn revision
revision_line=$(svn info | grep Revision)
revision=$(echo $revision_line |  sed 's/Revision: //')

# save build configuration
cp -vu --backup=numbered .config tl-wr1043nd-r$(echo $revision).config

# save svn info
svn info . > svninfo.txt
svn info feeds/packages >> svninfo.txt
svn info feeds/luci >> svninfo.txt

# make
start=$(date +%s)
make V=99
end=$(date +%s)
minutes=$(echo "scale=2; $((end - start))/60.0" | bc)
hours=$(echo "scale=2; $((end - start))/3600.0" | bc)
echo "Build time: $minutes minutes, $hours hours."

# copy binary to ftp directory
cp -vu --backup=numbered bin/ar71xx/openwrt-ar71xx-generic-tl-wr1043nd-v1-squashfs-sysupgrade.bin \
   /srv/ftp/openwrt-ar71xx-tl-wr1043nd-v1-r$(echo $revision)-squashfs-sysupgrade.bin

4 (edited by Nilfred 2011-01-31 07:14:55)

Re: Good build scripts? and scripts for copying built snapshots?

I'm not tidy as you, but here is the script I run for ImageBuilder with some bits borrowed from your script.
The script get a revision as user input, delete old, decompress new, update http server, apply a patch to compile only the routers I have ignoring the rest.
There are commented out some bits left from first/previous runs.

~/imagebuilder.sh

#!/bin/sh
#
# ImageBuilder
#

# Folder where images where previously downloaded:
dlroot="$HOME/Descargas"
oibfl="OpenWrt-ImageBuilder-ar71xx-for-Linux-x86_64"
# An argument is (still) required ie: sh imagebuilder.sh r25223
echo $1
if [ ! -f "$dlroot/$1/$oibfl.tar.bz2" ]; then
    echo $dlroot/$1/$oibfl.tar.bz2 doesn\'t exist, exiting...
    exit 0
fi
# Check if a local package repository mirror exist
if [ ! -d /var/www/openwrt/ar71xx/$1 ]; then
    cd ~
    # mkdir -p files/etc/config
# This is why the files folder is outside:
    rm -rf ~/$oibfl/
    echo Uncompresing $dlroot/$1/$oibfl.tar.bz2
    tar -xjf $dlroot/$1/$oibfl.tar.bz2
    # sudo mkdir /var/www/openwrt/ar71xx/$1/
    # sudo ln -s ~/$oibfl/packages /var/www/openwrt/ar71xx/$1/packages
    # sudo ln -s ~/$oibfl/bin/ar71xx /var/www/openwrt/ar71xx/$1/bin
    echo Need SU password to move the symlink
    sudo mv /var/www/openwrt/ar71xx/r* /var/www/openwrt/ar71xx/$1
# Point opkg to the local package repository mirror:
    sed -i -e 's!http://.*$!http://192.168.1.132/openwrt/ar71xx/'$1'/packages!' ~/files/etc/opkg.conf
# Workaround for bug #8705
    cp $dlroot/$1/openwrt-ar71xx-generic-nbg460n_550n_550nh-u-boot.bin ~/$oibfl/bin/ar71xx/
# Apply patches
    # Remove all other boards from (shorten compile time)
    # OpenWrt-ImageBuilder-ar71xx-for-Linux-x86_64/target/linux/ar71xx/image/Makefile
        #define Image/Build/Profile/Default
    # diff -urN OpenWrt-ImageBuilder-ar71xx-for-Linux-x86_64/target/linux/ar71xx/image/Makefile.old OpenWrt-ImageBuilder-ar71xx-for-Linux-x86_64/target/linux/ar71xx/image/Makefile > rmNonTL.diff

    patch -p0 << "EOP"
--- OpenWrt-ImageBuilder-ar71xx-for-Linux-x86_64/target/linux/ar71xx/image/Makefile.old    2011-01-28 11:09:56.711252538 -0300
+++ OpenWrt-ImageBuilder-ar71xx-for-Linux-x86_64/target/linux/ar71xx/image/Makefile    2011-01-28 15:17:23.602831909 -0300
@@ -666,46 +666,10 @@
 endef
 
 define Image/Build/Profile/Default
-    $(call Image/Build/Profile/AP81,$(1))
-    $(call Image/Build/Profile/AP83,$(1))
-    $(call Image/Build/Profile/A02RBW300N,$(1))
-    $(call Image/Build/Profile/DIR600A1,$(1))
-    $(call Image/Build/Profile/DIR615C1,$(1))
-    $(call Image/Build/Profile/DIR825B1,$(1))
-    $(call Image/Build/Profile/EAP7660D,$(1))
-    $(call Image/Build/Profile/FR54RTR,$(1))
-    $(call Image/Build/Profile/JA76PF,$(1))
-    $(call Image/Build/Profile/JWAP003,$(1))
-    $(call Image/Build/Profile/MZKW04NU,$(1))
-    $(call Image/Build/Profile/MZKW300NH,$(1))
-    $(call Image/Build/Profile/NBG_460N_550N_550NH,$(1))
-    $(call Image/Build/Profile/PB42,$(1))
-    $(call Image/Build/Profile/PB44,$(1))
-    $(call Image/Build/Profile/PB92,$(1))
-    $(call Image/Build/Profile/TEW632BRP,$(1))
-    $(call Image/Build/Profile/TEW652BRP,$(1))
-    $(call Image/Build/Profile/TLMR3220V1,$(1))
     $(call Image/Build/Profile/TLMR3420V1,$(1))
-    $(call Image/Build/Profile/TLWA901NDV1,$(1))
     $(call Image/Build/Profile/TLWR741NDV1,$(1))
     $(call Image/Build/Profile/TLWR740NV1,$(1))
-    $(call Image/Build/Profile/TLWR841NV15,$(1))
-    $(call Image/Build/Profile/TLWR841NDV3,$(1))
-    $(call Image/Build/Profile/TLWR841NDV5,$(1))
-    $(call Image/Build/Profile/TLWR841NDV7,$(1))
-    $(call Image/Build/Profile/TLWR941NDV2,$(1))
-    $(call Image/Build/Profile/TLWR941NDV3,$(1))
-    $(call Image/Build/Profile/TLWR941NDV4,$(1))
     $(call Image/Build/Profile/TLWR1043NDV1,$(1))
-    $(call Image/Build/Profile/UBNT,$(1))
-    $(call Image/Build/Profile/WP543,$(1))
-    $(call Image/Build/Profile/WNDR3700,$(1))
-    $(call Image/Build/Profile/AP96,$(1))
-    $(call Image/Build/Profile/WRT400N,$(1))
-    $(call Image/Build/Profile/WRT160NL,$(1))
-    $(call Image/Build/Profile/WZRHPG300NH,$(1))
-    $(call Image/Build/Profile/ZCN1523H28,$(1))
-    $(call Image/Build/Profile/ZCN1523H516,$(1))
 endef
 
 define Image/Build/Profile/Minimal
EOP
    if [ -f $oibfl/target/linux/ar71xx/image/Makefile.rej ]; then
        echo Patch rejected, exiting...
        exit 0
    fi
    # Remove all other boards from (free some Flash space)
        # base-files
    # (Still handled manually) Basically:
        # PACKAGES="-base-files"
        # base-files decompressed to ~/files/
fi
cd ~/$oibfl/
echo Building...
start=$(date +%s)

make -j 2 image FILES="~/files" PROFILE="TLMR3420V1" PACKAGES="uhttpd liblua lua kmod-scsi-core kmod-usb-storage block-mount block-extroot" 2>&1 | tee build.log | grep -i error

end=$(date +%s)
printf "Build time: %.2d:%.2d:%.2d\n" $(( (end -= start) / 3600 )) $(( (end %= 3600) / 60 )) $(( end %= 60 ))

Changelog 1.01:
+ sed -ie to sed -i -e (Thanks jow)
- Garbage from sed removal (Thanks jow)
+ Builtin build time calculation
+ More hints on base-files removal
- Leftover from old bug
+ Minors things I don't remember

Netgear WNR854T (ARM Marvell Orion CPU 500MHz, Marvell 88W8361P mini-PCI STA only, 8/32MB) - trunk r17427 since 09/09/09 to 06-06-12 GLOD
TP-LINK TL-WR741ND v1.9 (Atheros AR7240 CPU 350MHz, Atheros AR9285 Chipset, 4/32MB) - trunk r23281 since 10/10/10
TP-LINK TL-MR3420 v1.1, TL-MR3220 v1.2 - trunk r25302 since 11/11/11
TP-LINK TL-WR842ND v1.0, TL-WR1043ND v1.8 - 12.09-rc1 since 12/12/12

Re: Good build scripts? and scripts for copying built snapshots?

Nilfred you can avoid the sed garbage by writing it as "sed -i -e ..." instead of "sed -ie".

Re: Good build scripts? and scripts for copying built snapshots?

subscribe big_smile

7 (edited by hnyman 2011-09-20 17:14:39)

Re: Good build scripts? and scripts for copying built snapshots?

Half a year later, and a bit more automation...

My build script includes now an optional "make dirclean" (defaulting to not doing it after 15 sec timeout), creates a version info / timestamp file to be included in the built firmware (as /etc/Compiled_by.txt), and removes unnecessary binary files after the compilation. I am currently building Luci from local source code, so the script also updates it.

#!/bin/bash
#
# update-and-make  -   Update source code and make the build
read -p "Make dirclean first? (y/n) " -n 1 -t 15 dirc
echo " "
case $dirc in
    y|Y)  echo "...make dirclean..."; make dirclean ;;
    *)  echo "...no clean operation...";;
esac

echo "...update SVN source..."
svn up
echo "...update Luci source..."
svn up /Openwrt/luci/
echo "...update feeds..."
./scripts/feeds update -a
echo "...install feeds..."
./scripts/feeds install -a

echo "...make defconfig..."
make defconfig
echo "...make menuconfig..."
make menuconfig

echo "...create version info..."
echo "Compiled by Hannu Nyman" > files/etc/Compiled_by.txt
echo `date "+%F %H:%M"` >> files/etc/Compiled_by.txt
echo -n Openwrt r`svn info | grep Revision |cut -d " " -f 2` >> files/etc/Compiled_by.txt
echo " / Luci r"`svn info /Openwrt/luci/ | grep Revision |cut -d " " -f 2` >> files/etc/Compiled_by.txt

echo "...make world..."
make -j 3 V=99 2>&1 | tee build.log | grep -i -E "error|Entering dir"
echo "...remove unnecessary files..."
rm -f bin/ar71xx/*jffs* bin/ar71xx/*root* bin/ar71xx/*vmlinux* bin/ar71xx/*uImage* bin/ar71xx/*-NA.img

And the file copy script first mounts the Virtualbox shared directory (if it is not already mounted), then creates full svn diffs for the main source, Luci and packages, and then copies the diffs, config, md5sums and the binaries. All filenames include timestamps for making it easy to identify versions.  The script does the copy operation for both Backfire and Trunk versions.

#!/bin/sh

echo Mount shared folder
Mountname=WNDR3700
Mountpoint=/media/windows-share
df | grep $Mountname
if [ "$?" -eq 1 ] ; then
  sudo mount -t vboxsf $Mountname $Mountpoint
fi

TStamp=`date +%F-%H%M`

echo -n Copy Backfire...
BSvnTime=r`svn info /Openwrt/backfire | grep Revision |cut -d " " -f 2`-$TStamp
BFile=$Mountpoint/WNDR3700-backfire-$BSvnTime
Bv2File=$Mountpoint/WNDR3700v2-backfire-$BSvnTime
svn diff /Openwrt/backfire > $BFile-svn.diff
svn diff /Openwrt/backfire/feeds/packages > $BFile-packages.diff
svn diff /Openwrt/luci/branches/luci-0.10 > $BFile-luci-0.10.diff
grep wndr3700.*-squashfs /Openwrt/backfire/bin/ar71xx/md5sums | grep -v NA | sed -e 's/$/\r/' | sed -e 's/*openwrt-ar71xx-//' > $BFile-md5.txt
cp /Openwrt/backfire/bin/ar71xx/openwrt-ar71xx-wndr3700-squashfs-sysupgrade.bin $BFile-squashfs-sysupgrade.bin
cp /Openwrt/backfire/bin/ar71xx/openwrt-ar71xx-wndr3700-squashfs-factory.img $BFile-squashfs-factory.img
cp /Openwrt/backfire/bin/ar71xx/openwrt-ar71xx-wndr3700v2-squashfs-sysupgrade.bin $Bv2File-squashfs-sysupgrade.bin
cp /Openwrt/backfire/bin/ar71xx/openwrt-ar71xx-wndr3700v2-squashfs-factory.img $Bv2File-squashfs-factory.img
cp /Openwrt/backfire/.config $BFile.config
echo done.

sleep 3

echo -n Copy Trunk...
TSvnTime=r`svn info /Openwrt/trunk | grep Revision |cut -d " " -f 2`-$TStamp
TFile=$Mountpoint/WNDR3700-trunk-$TSvnTime
Tv2File=$Mountpoint/WNDR3700v2-trunk-$TSvnTime
svn diff /Openwrt/trunk > $TFile-svn.diff
svn diff /Openwrt/trunk/feeds/packages > $TFile-packages.diff
svn diff /Openwrt/luci/trunk/ > $TFile-luci-trunk.diff
grep wndr3700.*-squashfs /Openwrt/trunk/bin/ar71xx/md5sums | grep -v NA | sed -e 's/$/\r/' | sed -e 's/*openwrt-ar71xx-generic-//' > $TFile-md5.txt
cp /Openwrt/trunk/bin/ar71xx/openwrt-ar71xx-generic-wndr3700-squashfs-sysupgrade.bin $TFile-squashfs-sysupgrade.bin
cp /Openwrt/trunk/bin/ar71xx/openwrt-ar71xx-generic-wndr3700-squashfs-factory.img $TFile-squashfs-factory.img
cp /Openwrt/trunk/bin/ar71xx/openwrt-ar71xx-generic-wndr3700v2-squashfs-sysupgrade.bin $Tv2File-squashfs-sysupgrade.bin
cp /Openwrt/trunk/bin/ar71xx/openwrt-ar71xx-generic-wndr3700v2-squashfs-factory.img $Tv2File-squashfs-factory.img
cp /Openwrt/trunk/.config $TFile.config
echo done.

Result of the copy operation:

WNDR3700-backfire-r27842-2011-07-31-1138-svn.diff
WNDR3700-backfire-r27842-2011-07-31-1138-packages.diff
WNDR3700-backfire-r27842-2011-07-31-1138-luci-0.10.diff
WNDR3700-backfire-r27842-2011-07-31-1138-md5.txt
WNDR3700-backfire-r27842-2011-07-31-1138-squashfs-sysupgrade.bin
WNDR3700-backfire-r27842-2011-07-31-1138-squashfs-factory.img
WNDR3700v2-backfire-r27842-2011-07-31-1138-squashfs-sysupgrade.bin
WNDR3700v2-backfire-r27842-2011-07-31-1138-squashfs-factory.img
WNDR3700-backfire-r27842-2011-07-31-1138.config
WNDR3700-trunk-r27842-2011-07-31-1138-svn.diff
WNDR3700-trunk-r27842-2011-07-31-1138-packages.diff
WNDR3700-trunk-r27842-2011-07-31-1138-luci-trunk.diff
WNDR3700-trunk-r27842-2011-07-31-1138-md5.txt
WNDR3700-trunk-r27842-2011-07-31-1138-squashfs-sysupgrade.bin
WNDR3700-trunk-r27842-2011-07-31-1138-squashfs-factory.img
WNDR3700v2-trunk-r27842-2011-07-31-1138-squashfs-sysupgrade.bin
WNDR3700v2-trunk-r27842-2011-07-31-1138-squashfs-factory.img
WNDR3700-trunk-r27842-2011-07-31-1138.config

Re: Good build scripts? and scripts for copying built snapshots?

hnyman wrote:

Half a year later, and...

... Nothing you learned from this tread.

Take dl away from distclean reach (Is dirclean a typo?)

ln -sf ../../dl
make download

Select target before defconfig:

echo CONFIG_TARGET_ar71xx=y > .config
make defconfig

Patch out unnecessary profiles if you need only 3700 stuff (see my post)
And so on...

Netgear WNR854T (ARM Marvell Orion CPU 500MHz, Marvell 88W8361P mini-PCI STA only, 8/32MB) - trunk r17427 since 09/09/09 to 06-06-12 GLOD
TP-LINK TL-WR741ND v1.9 (Atheros AR7240 CPU 350MHz, Atheros AR9285 Chipset, 4/32MB) - trunk r23281 since 10/10/10
TP-LINK TL-MR3420 v1.1, TL-MR3220 v1.2 - trunk r25302 since 11/11/11
TP-LINK TL-WR842ND v1.0, TL-WR1043ND v1.8 - 12.09-rc1 since 12/12/12

9 (edited by hnyman 2011-08-02 17:43:26)

Re: Good build scripts? and scripts for copying built snapshots?

Yeah, I noticed your suggestions already last time, but haven't bothered to tweak it so much. You have valid points there (e.g. regarding the unnecessary profiles), I admit that.

Dirclean is not a typo. I see no reason to use 'make distclean', as 'make dirclean' cleans almost as much, but doesn't e.g. destroy .config and dl directory.
https://dev.openwrt.org/browser/trunk/Makefile#L58