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