The "MemTotal" value shown by /proc/meminfo is the total amount of physical RAM that is usable by the system *after* subtracting the memory that is permanently reserved by the F/W and kernel code during bootup. The amounts of memory allocated during bootup are usually shown in the boot log.
So if you add up all the reserved memory allocated during bootup and the "MemTotal" amount shown by /proc/meminfo, you should get the total amount of physical RAM.
The "MemTotal" value shown by /proc/meminfo is the total amount of physical RAM that is usable by the system *after* subtracting the memory that is permanently reserved by the F/W and kernel code during bootup. The amounts of memory allocated during bootup are usually shown in the boot log.
So if you add up all the reserved memory allocated during bootup and the "MemTotal" amount shown by /proc/meminfo, you should get the total amount of physical RAM.
Asus "cheats" there to determine the total amount of memory: they calculate the next power of two based on MemTotal, since it's known that total physical memory will be a power of two.
Code:
unsigned long next_power_of_two(unsigned long n) {
if (n == 0) return 1;
n--;
n |= n >> 1;
n |= n >> 2;
n |= n >> 4;
n |= n >> 8;
n |= n >> 16;
#if ULONG_MAX > 0xFFFFFFFF
n |= n >> 32; //for 64-bit unsigned long
#endif
return n + 1;
}
Asus "cheats" there to determine the total amount of memory: they calculate the next power of two based on MemTotal, since it's known that total physical memory will be a power of two.
Code:
unsigned long next_power_of_two(unsigned long n) {
if (n == 0) return 1;
n--;
n |= n >> 1;
n |= n >> 2;
n |= n >> 4;
n |= n >> 8;
n |= n >> 16;
#if ULONG_MAX > 0xFFFFFFFF
n |= n >> 32; //for 64-bit unsigned long
#endif
return n + 1;
}
The "MemTotal" value shown by /proc/meminfo is the total amount of physical RAM that is usable by the system *after* subtracting the memory that is permanently reserved by the F/W and kernel code during bootup. The amounts of memory allocated during bootup are usually shown in the boot log.
So if you add up all the reserved memory allocated during bootup and the "MemTotal" amount shown by /proc/meminfo, you should get the total amount of physical RAM.
World’s first AI WiFi 7 tri-band gaming router with 19Gbps speeds, dual 10G + 4×2.5G ports, AI Game Booster, ASUSWRT 6.0, up to 5 VLAN & SSID, and AiProtection.
Unclear where UI4 will show up, but is this likely to be another fragment in the fragmented add-on community for different WebUI requirements per firmware branch/version?
Unclear where UI4 will show up, but is this likely to be another fragment in the fragmented add-on community for different WebUI requirements per firmware branch/version?
It was expected from the beginning that anything that touched the webui would be susceptible to break at any time. I implemented a basic API back in the day to at least prevent mod authors from constantly patching the existing pages through binding mounts, which would cause issues with every single new firmware releases as people "forgot" they had replaced a web page with a customized one. But breakage will still happen whenever Asus changes the menu rendering engine (the switch to menuTree), changes dependencies on built-in javascripts (the recent client_functions.js changes) or flat out changes the whole UI or switches from a dark to a light theme (the switch to Bootstrap with UI4/Business UI).
Asus themselves took "shortcuts" in UI4 by having Boostrap dynamically replace some CSS values on-the-fly so their original non-Boostrap pages (basically all the Settings pages) would require minimum changes. The frequently used #FFCC00 colour used for notifications for instance is automatically replaced by a shade of blue that's readable on a white background. In-page text set to white is also automatically switched to that same blue colour. But if you got creative and used your own colour that's not readable on a white background, you have to handle that yourself.
Here's a fragment showing a partial portion of changes I had to do on a single page - and that kind of rework has more or less to be repeated for all the other pages that I created myself.
Boostrap only processes the page at load time, so that means anything inserted into the DOM at runtime (like the client entries in the example above) will need to handle the UI4 colouring itself.
I currently need to load each page that I had created myself one by one, documenting the visual issues, and addressing them. Some are just a few colour tweaks. Others (like the VPN client and server pages) are completely broken as the tab switcher didn't render properly, and needed deeper investigation to resolve. It's all slow work, but by now I made it far enough to know that it's very doable. It's also the occasion for me to start learning some ECMAScript 2015 features that do make this much more manageable - namely the use of Template Strings.
So yes, once I start releasing firmware for models that are using UI4, addon authors should be prepared to potentially have a LOT of work to do, depending on how "creative" they got in their layout, or if they tried to stick to a more traditional Asus page layout, reusing the existing CSS classes.
At this time tho, I cannot go into any further details as to what my plans are regarding models using that new UI4. That will come later. Some stuff is still under embargo for me.
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!