ScreenShots
Hey
Please note that I'm not a native English speaker, so...
I just bought a netgear R7800, with a 128M ROM. But after I upgraded its firmware to latest official LEDE, I found that it has only <20M free space left.
That's not a good start and makes me, feel depressed. And I don't want use some unstable tech like Extroot/Rootfs though.
After a 3 days research, I made a very perfect custom lede. Here I can't wait to share the detailed process with you.
Features
1. You will get about 80MB free space after use this custom build.
2. Inside the firmeware, it's exactly the same as the official build.
3. That means you can install any packages from the official downloads.lede-project.org, without dependency issue. (usually, when you build your own firmware, you can't use many pkg from downloads.lede-project.org. see: https://forum.openwrt.org/t/kernel-mismatch-on-self-compiled-firmware-and-module/1265)
4. And, you can always keep updated with the latest official releases.
How to
Now let's make R7800 great again.
- Setup basic environment
DO NOT USE root user! use a normal user which has sudo privileges instead.
For debian/ubuntu:
sudo apt-get install subversion g++ zlib1g-dev build-essential git python rsync man-db
sudo apt-get install libncurses5-dev gawk gettext unzip file libssl-dev wget
- Get code and checkout the official release tag
You can get release tags from github or https://git.lede-project.org/source.git. Here I'll use v17.01.2, the current latest version.
git clone https://github.com/lede-project/source lede
cd lede
git fetch --all --tags --prune
git checkout tags/v17.01.2
- Install feeds
./scripts/feeds update -a
./scripts/feeds install -a
- Fix .config to make sure that you have the same fingerprint as official build
# Please change 17.01.2 in the url accordingly.
wget https://downloads.lede-project.org/releases/17.01.2/targets/ipq806x/generic/config.seed -O config.seed
rm -rf .config*
mv config.seed .config
- Fix DTS, free your ROM space.
This is the most important part, please make sure you understand what I said before take actions.
Edit the following file with your favorite editor:
target/linux/ipq806x/files/arch/arm/boot/dts/qcom-ipq8065-r7800.dts
Original section is something like this(you can search for 'netgear'):
nand@1ac00000 {
...
kernel@1480000 {
label = "kernel";
reg = <0x1480000 0x0200000>;
};
ubi@1680000 {
label = "ubi";
reg = <0x1680000 0x1E00000>;
};
netgear@3480000 {
label = "netgear";
reg = <0x3480000 0x4480000>;
read-only;
};
reserve@7900000 {
label = "reserve";
reg = <0x7900000 0x0700000>;
read-only;
};
firmware@1480000 {
label = "firmware";
reg = <0x1480000 0x2000000>;
};
...
Here I'll explain this section and tell you how to change it.
For example:
reserve@7900000 { // reserve is the labeel, 7900000 means begin position, in HEX.
label = "reserve"; // reserve is the label.
reg = <0x7900000 0x0700000>; // reg = < begin position, length of this partition >
read-only; // extra flag, don't change.
};
Another thing keep in mind:
firmware partition should always start from begin of kernel, and end to end of ubi. (Do the math yourself if I didn't make it easy to understand)
So, for R7800:
1. DON'T TOUCH kernel and ubi. and I won't touch reserve neither.
2. Remove netgear section. it contains, actually, nothing useful, if you want to use lede.
3. extend ubi partition to the end of original netgear partition.
Here is what I used finally:
kernel@1480000 {
label = "kernel";
reg = <0x1480000 0x0200000>;
};
ubi@1680000 {
label = "ubi";
reg = <0x1680000 0x6280000>;
};
reserve@7900000 {
label = "reserve";
reg = <0x7900000 0x0700000>;
read-only;
};
firmware@1480000 {
label = "firmware";
reg = <0x1480000 0x6480000>;
};
- make and compile.
make defconfig
make # and you can use -j for optimized concurrency compile.
- Upload firmware to R7800
Firmware is compiled in
bin/targets/ipq806x/generic/lede-17.01.2-ipq806x-R7800-squashfs-factory.img
ALWAYS USE -factory.img instead of sysupgrade one, because factory.img apply new DTS(partition tables) while sysupgrade won't.
And I doubt this is the reason why official image didn't extend the root partition by default -- they just use the same structure as original product, so lede users are able to install LEDE via webpage.
Hope someone from dev team could explain.
Since TFTP firmware upgrading is pertty standard for a R7800 user, I won't write it here, see:
https://kb.netgear.com/22688/How-to-upload-firmware-to-a-NETGEAR-router-using-TFTP
- Done
Yes you just installed your custom and official repositry compatiable firmware. happy hack.
- About backup and Restore
Actually I didn't see the necessary backing up the original partitions, from another thread: https://forum.openwrt.org/t/netgear-r7800-only-19mb-flash-available/
Because,
- when you want to flash you router to any other lede release, just put it into TFTP mode and upload new -factory.img firmware.
- when you want to go back to netgear firmware, just flash an standard official lede firmware first, and then flash the netgear firmware again.
And, Netgear always provides latest firmware on their websites.
Summary
Thanks for @hnyman and many friends in this forum.
I read almost all threads about this topic, no one wrote a complete steps for newbies, hope this one helps.