DGND3700 V1 Rebuild Firmware Toolchain
- 1 Download pre-built toolchain
- 2 Creating the toolchain manually
- 3 Comments
Download pre-built toolchain
If you just want to download pre-built working toolchain, click here, built 29/Oct/2013
(previous build 16/Feb/2013 )
Creating the toolchain manually
So you found the toolchain is missing in the GPL firmware 'package'!, you need to find it , fix it and build it!
Hardy Heron 32bit
(You need a relatively old linux release as the build requirements are for old versions of various tools)
Create a new virtual machine with defaults, 8 Gb HDD is fine and install Hardy.
Suggest installing Virtualbox additions (if using VrtualBox) which makes it resizable and easier to work with.
Don't try and share the working folder with your machine as output requires soft and hard links, which vboxsf nor samba support. (didn't try NFS?)
cd /media/cdrom sudo ./VBoxLinuxAdditions.run
Install prerequistes packages for buildroot
Once installed get some needed packages. I think this is everything extra from a default install.
sudo apt-get install bison build-essential bzip2 dpkg-dev flex g++ g++-4.2 gawk gettext libbz2-1.0 libc6 libc6-dev libc6-i686 \ libncurses5-dev libperl5.8 libstdc++6-4.2-dev libtimedate-perl linux-libc-dev m4 patch perl perl-base perl-modules texinfo
The readme says the correct toolchain is this, uclibc-crosstools-gcc-4.2.3-3_LFS.tar.bz2 found by [ali1234] from here;
From this spaghetti mess of a nested archive (a microcosm of how this firmware is constructed) extract contents of toolchain.tar.bz2 & keep all these files somewhere, discard all the other crap.
> EVG2000_v220.127.116.11_with_toolchain_src.tar.bz2.zip > EVG2000_v18.104.22.168_with_toolchain_src.tar.bz2 > EVG2000_v22.214.171.124_with_toolchain_src > toolchain_EVG2000.zip > toolchain.tar.bz2 > toolchain Which should contain toolchain ├── binutils-2.18.tar.bz2 ├── buildroot.config ├── buildroot.src.tar.bz2 ├── build_toolchain_readme.txt ├── gcc-4.2.3.tar.bz2 ├── gdb-6.6.tar.bz2 ├── HowTo.txt ├── uClibc-0.9.29.tar.tar └── uClibc.config
configure, fix and add to the buildroot toolchain
- the pre-built one doesn't work so you have to build it yourself!
- although buildroot fetches files most of the sources are out of date so get them yourself first.
- you need to create missing folders, fetch missing files, patch incorrect configs, get missing uClibc patches, rename incorrectly named files (.tar.tar wtf!)
#go to root of toolchain folder above cd <wherever you extracted it>/toolchain #extract buildroot tar jxvf buildroot.src.tar.bz2 #create output toolchains folder sudo mkdir -p /opt/toolchains sudo chmod -R a+rw /opt/toolchains #create missing folders mkdir -p buildroot/toolchain/ccache buildroot/dl touch buildroot/toolchain/ccache/Config.in touch buildroot/toolchain/ccache/Config.in.2 touch buildroot/toolchain/ccache/ccache.mk #fix uClibc config file for 3 wrong options, and you must set correct location for KERNEL_HEADERS cp uClibc.config uClibc.fixed.config sed -i "s/UCLIBC_SUSV3_LEGACY=y/# UCLIBC_SUSV3_LEGACY is not set/" uClibc.fixed.config sed -i "s/UCLIBC_HAS_FOPEN_LARGEFILE_MODE=y/# UCLIBC_HAS_FOPEN_LARGEFILE_MODE is not set/" uClibc.fixed.config sed -i "s/# UCLIBC_HAS_WCHAR is not set/UCLIBC_HAS_WCHAR=y/" uClibc.fixed.config sed -i "s@KERNEL_HEADERS.*@KERNEL_HEADERS=\"$(pwd)/buildroot/toolchain_build_mips/linux/include\"@" uClibc.fixed.config #populate dl folder as buildroot's auto-download liks are duff cp uClibc-0.9.29.tar.tar buildroot/dl/uClibc-0.9.29.tar.bz2 cp gcc-4.2.3.tar.bz2 buildroot/dl cp gdb-6.6.tar.bz2 buildroot/dl cp binutils-2.18.tar.bz2 buildroot/dl wget -P buildroot/dl http://ftp.gnu.org/gnu/gmp/gmp-4.2.2.tar.bz2 wget -P buildroot/dl ftp://126.96.36.199/pub/linux/kernel/v2.6/linux-188.8.131.52.tar.bz2 wget -P buildroot/dl http://www.atmel.no/buildroot/source/mirror/mpfr-2.3.0.tar.bz2 wget -P buildroot/dl http://www.atmel.no/buildroot/source/mirror/mpfr-2.3.0.patch #add newer patches from github for i in 009-fix_getaddrinfo_infinite_loop.patch 100-termios.patch 110-compat_macros.patch 120-adjtimex.patch 130-compile_fixes.patch 130-sockets_throw.patch 140-fix-endless-recursion-in-pthread.patch 141-fix-daemon-to-support-pthread.patch 150-fix-ldso-text-realloc-segfault.patch 170-enable-getifaddrs.patch do wget --no-check-certificate -O "buildroot/toolchain/uClibc/uClibc-0.9.29-$i" "https://raw.github.com/ninuxorg/SDK.UBNT.v5.5/master/toolchain/uClibc/patches/$i" done #copy the included buildroot config and FIXED uClibc config, and build, strictly in this order, toolchain_build_mips is created by making menu-config etc. cp buildroot.config buildroot/.config cd buildroot make menuconfig make uclibc-menuconfig cp ../uClibc.fixed.config toolchain_build_mips/uClibc-0.9.29/.config make #compress up the shiny new toolchain ready for copying to your main firmware building machine, use cmd line as file roller doesn't preserver hard links! cd /opt/toolchains tar -czf uclibc-crosstools-gcc-4.2.3-3.tar.gz uclibc-crosstools-gcc-4.2.3-3
- The order of the build steps matter!
- If these are all correctly downloaded in the right place buildroot shouldn't give any errors about not being able to find anything (as its source locations are out of data)
What some of the patches are for
- These are vital to build transmission
- This is vital to build minidlna so its damonize process works (Netgear didn't manage to do this and ended up running it in debug mode spewing out tons of debug log data!)
- This is vital to quite a few things (proper patch to replace the code Netgear mention in the Howto to be done manually afterwards, nice)
Other patch notes
These patces on github duplicate ones already present in the buildroot bundled ones
001-fix_mmap.patch 002-conditional_sched_affinity.patch 004-fix_gethostent_r_failure_retval.patch 005-fix_internal_function_definition.patch 006-rm_whitespace.patch 007-avr32.patch 008-avr32_fix_sa_onstack.patch
These are only present in the bundle and not on github
uClibc-0.9.29-filter-gnu99-from-assembly-flags.patch uClibc-0.9.29-fix-fget_putc.diff uClibc-0.9.29-linuxthreads.patch
Commentsblog comments powered by Disqus