Hello,
I'm sorry, but it does not work. The leds, including the power led, are not working when the image is created with the ImageBuilder.
WAN and LAN leds do work.
I did everything from scratch:
wget http://downloads.openwrt.org/barrier_breaker/14.07/ramips/rt305x/OpenWrt-ImageBuilder-ramips_rt305x-for-linux-x86_64.tar.bz2
tar jxvf OpenWrt-ImageBuilder-ramips_rt305x-for-linux-x86_64.tar.bz2
cd OpenWrt-ImageBuilder-ramips_rt305x-for-linux-x86_64
Then, the patch -file is supposed to patch a few, already existing files:
cat ../bb-final-ramips-add-zyxel-nbg-419n2.patch | grep ^Index
Index: target/linux/ramips/base-files/lib/ramips.sh
Index: target/linux/ramips/base-files/lib/upgrade/platform.sh
Index: target/linux/ramips/base-files/etc/diag.sh
Index: target/linux/ramips/base-files/etc/uci-defaults/01_leds
Index: target/linux/ramips/image/Makefile
Index: target/linux/ramips/dts/NBG-419N2.dts
So, just to ensure the functionality, we back-up the files.
mkdir backup_files
cat ../bb-final-ramips-add-zyxel-nbg-419n2.patch | grep ^Index | cut -d ' ' -f2 | xargs -i cp {} backup_files/.
cp: cannot stat ‘target/linux/ramips/dts/NBG-419N2.dts’: No such file or directory
Before patching the files, we need to create the .dts -file, since a file which does not exist can't be patched; i.e. the patch won't creat a new file. (At least not on Fedora 20).
touch target/linux/ramips/dts/NBG-419N2.dts
Then we patch:
patch < ../bb-final-ramips-add-zyxel-nbg-419n2.patch
can't find file to patch at input line 5
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|Index: target/linux/ramips/base-files/lib/ramips.sh
|===================================================================
|--- target/linux/ramips/base-files/lib/ramips.sh (revision 42702)
|+++ target/linux/ramips/base-files/lib/ramips.sh (working copy)
--------------------------
File to patch: target/linux/ramips/base-files/lib/ramips.sh
patching file target/linux/ramips/base-files/lib/ramips.sh
can't find file to patch at input line 19
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|Index: target/linux/ramips/base-files/lib/upgrade/platform.sh
|===================================================================
|--- target/linux/ramips/base-files/lib/upgrade/platform.sh (revision 42702)
|+++ target/linux/ramips/base-files/lib/upgrade/platform.sh (working copy)
--------------------------
File to patch: target/linux/ramips/base-files/lib/upgrade/platform.sh
patching file target/linux/ramips/base-files/lib/upgrade/platform.sh
can't find file to patch at input line 31
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|Index: target/linux/ramips/base-files/etc/diag.sh
|===================================================================
|--- target/linux/ramips/base-files/etc/diag.sh (revision 42702)
|+++ target/linux/ramips/base-files/etc/diag.sh (working copy)
--------------------------
File to patch: target/linux/ramips/base-files/etc/diag.sh
patching file target/linux/ramips/base-files/etc/diag.sh
can't find file to patch at input line 45
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|Index: target/linux/ramips/base-files/etc/uci-defaults/01_leds
|===================================================================
|--- target/linux/ramips/base-files/etc/uci-defaults/01_leds (revision 42702)
|+++ target/linux/ramips/base-files/etc/uci-defaults/01_leds (working copy)
--------------------------
File to patch: target/linux/ramips/base-files/etc/uci-defaults/01_leds
patching file target/linux/ramips/base-files/etc/uci-defaults/01_leds
patching file Makefile
Hunk #1 FAILED at 448.
Hunk #2 FAILED at 605.
2 out of 2 hunks FAILED -- saving rejects to file Makefile.rej
patching file NBG-419N2.dts
It says that the Makefile can't be patched, and claims that the .dts -file is patched. (Which in fact didn't happen ??)
Now we compare the patched files, against the backed-up files:
mkdir new_files
cat ../bb-final-ramips-add-zyxel-nbg-419n2.patch | grep ^Index | cut -d ' ' -f2 | xargs -i cp {} new_files/.
for i in `ls backup_files` ; do echo " == $i ==" ; diff backup_files/$i new_files/$i ; done
== 01_leds ==
134a135,138
> nbg-419n2)
> set_usb_led "nbg-419n2:green:usb"
> set_wifi_led "rt2800pci-phy0::radio"
> ;;
== diag.sh ==
90a91,93
> nbg-419n2)
> status_led="nbg-419n2:green:power"
> ;;
== Makefile ==
== NBG-419N2.dts ==
== platform.sh ==
63a64
> nbg-419n2 | \
== ramips.sh ==
171a172,174
> *"NBG-419N v2")
> name="nbg-419n2"
> ;;
We can see that some of the files were patched, and some were intact.
We must fix the remaining files by hand.
cp /home/jama/Downloads/OpenWRT/NBG-419N2.dts target/linux/ramips/dts/.
vi target/linux/ramips/image/Makefile
And perform the comparison of the Makefile again. (The .dts -file excluded due to size)
diff target/linux/ramips/image/Makefile backup_files/Makefile
451d450
< Image/Build/Profile/NBG-419N2=$(call BuildFirmware/Default8M/$(1),$(1),nbg-419n2,NBG-419N2)
609d607
< $(call Image/Build/Profile/NBG-419N2,$(1))
diff target/linux/ramips/image/Makefile new_files/Makefile
451d450
< Image/Build/Profile/NBG-419N2=$(call BuildFirmware/Default8M/$(1),$(1),nbg-419n2,NBG-419N2)
609d607
< $(call Image/Build/Profile/NBG-419N2,$(1))
As we can be confident that everything is as it's supposed to be, we can create the images.
And verify the results.
ls -al bin/ramips/*419*
-rw-rw-r--. 1 jama jama 2883588 Oct 7 14:47 bin/ramips/openwrt-ramips-rt305x-nbg-419n2-squashfs-sysupgrade.bin
-rw-r--r--. 1 jama jama 2883588 Oct 7 14:47 bin/ramips/openwrt-ramips-rt305x-nbg-419n-squashfs-sysupgrade.bin
But the leds won't work. The image can be flashed, it boots, etc., but the leds won't work ??
During the boot, a message appears.
[ 5.130000] leds-gpio gpio-leds.4: pins are not configured from the driver
????
Ok, I also tried to include everything to the single image again.
make image PACKAGES="base-files busybox dnsmasq dropbear firewall fstools hostapd-common ip6tables iptables iw jshn jsonfilter kernel kmod-cfg80211 kmod-crypto-aes kmod-crypto-arc4 kmod-crypto-core kmod-eeprom-93cx6 kmod-fs-vfat kmod-gpio-button-hotplug kmod-i2c-core kmod-input-core kmod-ip6tables kmod-ipt-conntrack kmod-ipt-core kmod-ipt-nat kmod-ipt-nathelper kmod-ipv6 kmod-leds-gpio kmod-ledtrig-usbdev kmod-lib-crc-ccitt kmod-lib-crc-itu-t kmod-mac80211 kmod-mmc kmod-nls-base kmod-nls-cp437 kmod-nls-iso8859-1 kmod-ppp kmod-pppoe kmod-pppox kmod-rt2800-lib kmod-rt2800-mmio kmod-rt2800-soc kmod-rt2x00-lib kmod-rt2x00-mmio kmod-scsi-core kmod-scsi-generic kmod-sdhci kmod-slhc kmod-usb-core kmod-usb-ohci kmod-usb-storage kmod-usb-storage-extras kmod-video-core kmod-video-uvc kmod-video-videobuf2 libblobmsg-json libc libgcc libip4tc libip6tc libiwinfo libiwinfo-lua libjson-c libjson-script liblua libncurses libnl-tiny libubox libubus libubus-lua libuci libuci-lua libxtables lua luci luci-app-firewall luci-base luci-lib-nixio luci-mod-admin-full luci-proto-ppp luci-theme-bootstrap mtd netifd odhcp6c odhcpd opkg ppp ppp-mod-pppoe procd swconfig terminfo ubox ubus ubusd uci uhttpd uhttpd-mod-ubus wpad-mini"
And check the image size again.
ls -al bin/ramips/*419*
-rw-rw-r--. 1 jama jama 3670020 Oct 7 15:22 bin/ramips/openwrt-ramips-rt305x-nbg-419n2-squashfs-sysupgrade.bin
-rw-r--r--. 1 jama jama 3670020 Oct 7 15:22 bin/ramips/openwrt-ramips-rt305x-nbg-419n-squashfs-sysupgrade.bin
Which shows that the image is much larger, and should now contain everything needed for leds to work.
But, still, the leds won't work ???
?????