WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: printf in /init, it has missing "f"  (Read 408 times)

Offline nick65go

  • Sr. Member
  • ****
  • Posts: 383
Re: printf in /init, it has missing "f"
« Reply #15 on: August 11, 2020, 03:36:25 PM »
so, in summary,
curaga solved the bug for the next TC version, using
Code: [Select]
awk '{printf("%d\n", $2/3)}'`
rich explained the logic of empiric/statistic chose of average file size = 3K bytes of system ("/") in 90% RAM
 for normal boot option (like without user providing a boot code of "noembed").
 This also means that it is expected to use the rest 10% RAM for zram_swap in memory, or else that 10% RAM is wasted.

FYI: If I would be nasty, I could ask about the second branch from /init, when the user provides the
boot code of "noembed".
 So here again we have a tmp file-system mounted and then chroot into it.
But in this case neglecting the nr_inode parameter for the mount command. so using by default 1/2 ratio.
(how convenient, the final result is another number of inodes, for the same core.gz in the same RAM size).
I do not use this second (noembed) branch, so is no point to complicate the code. Plus very few appl nowadays need it.
« Last Edit: August 11, 2020, 03:53:39 PM by nick65go »

Offline nick65go

  • Sr. Member
  • ****
  • Posts: 383
Re: printf in /init, it has missing "f"
« Reply #16 on: August 11, 2020, 11:49:22 PM »
(no intention to put salt on the wound), I found another piece of code, with the same awk problem:
tc-config: Remove needless modprobes, reported by Rich
https://github.com/tinycorelinux/Core-scripts/commit/fcca3f6c9bdc2762c81222380347bf1ad94e7482
while [ ! -e /dev/zram0 ]; do usleep 50000; done
    grep MemFree /proc/meminfo | awk '{print $2/4 "K"}' > /sys/block/zram0/disksize

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10271
Re: printf in /init, it has missing "f"
« Reply #17 on: August 11, 2020, 11:59:37 PM »
Fixed, thanks.

The noembed case is for special setups, but you have to note it already takes 2x the ram temporarily. For a moment, both the old and new initrd are held in memory. This means you won't be using it on memory-constrained setups, and so an inode limit makes less sense. The 90% size is raising a limit, not lowering.
The only barriers that can stop you are the ones you create yourself.

Offline nick65go

  • Sr. Member
  • ****
  • Posts: 383
Re: printf in /init, it has missing "f"
« Reply #18 on: August 12, 2020, 12:31:50 AM »
@curaga: got it! thanks for the feed-back. will be nice that a full check for all "awk" strings in tc scripts to be done by a skilled programmer; not just cherry-picking like I did.

also, a suggestion: to insert a very short comment in /init, like
Code: [Select]
# allocate 1 inode for 3KB average file size in ramjust because I did not have the documentation of this, I (un-necessary) searched the internet (minutes/hours) for this info.
« Last Edit: August 12, 2020, 12:49:04 AM by nick65go »