[klibc] "Destructive" utilities

Alexander E. Patrakov patrakov at ums.usu.ru
Mon Jun 7 22:49:24 PDT 2004


The following threads suggest that the way to reclaim memory occupied by 
initramfs is to remove files from it:

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&frame=right&th=c6cb846bba1a7aea&seekm=SAUO.51B.21%40gated-at.bofh.it#link1
http://seclists.org/lists/linux-kernel/2003/Dec/0707.html

However, there is no way to do it using utilities provided by klibs.

Could you please include the "unlink" and "rmdir" programs into the 
distribution? Just put the attached *.c files in klibc/utils and adjust 
the PROGS target in the Makefile there.

Also, to make life for script-writers simpler, we could consider writing 
a "glue" program that has the following synopsis:

glue real_root program args

The "glue" program removes all files except "real_root" directory from 
the / directory (including itself), remounts that directory on the root 
directory, chroots there and execs the specified program with the 
remaining arguments.

Rationale: without this, it is impossible to completely reclaim the 
initramfs memory from the script since at least the "chroot" binary must 
exist before chrooting from a script, and it can't be removed after chroot.

-- 
Alexander E. Patrakov



More information about the klibc mailing list