mkrootfs.sh is a bash script for compile and create a rootfs for embedded systems.
This is a project for the RTOS course (look at the end of this readme for the original assignment).
Run the script with '--help' option for more details about options and usage; an equivalent manpage should be provided (mkrootfs.1).
The Makefile contains some usefull commands or shortcuts, run 'make help' for more details; for example 'make download' is a simple way for downloading some tools like Busybox.
The etc.tar.xz archive contains a minimal configuration for a rootfs; between test programs, there's an etc directory for experiments and customizations.
Some C/C++ programs are provided for testing in 'test_programs/'.
An auxiliary script ldd.sh is attached, required for the "libraries filter" option -l
; it uses additional tools like readlink
and readelf
(that should be provided by binutils)
- Shell bash 4.3.30 or greater
- Some standard/classic Linux utilities:
cp
,rm
,ln
,mkdir
,chmod
,dirname
,basename
- Other tools:
tar
,find
,cpio
,gzip
- If you want to compile something, typically you need
make
- For ldd.sh:
find
,readlink
,basename
- Some space on your disk (it depends on what you want install)
- All the dependencies of what you want compile/install (typically a compiler or a complete GNU toolchain)
- deallocate variables
- default etc/
- some init script require some busybox component (eg
mdev
) that can be not included
- some init script require some busybox component (eg
do not re-compile or build what you have already built successfully before- this might be more difficult than expected
- some other interesting utilities? dropbear ssh? lua interpreter? ....
- no external dependencies
- support cross-compilation
-
build cross-compiler(optional)
-
- support inclusion of custom:
- programs
- kernel modules
- boot script
- non-interactive, support command-line
- size reduced to the minimum
- able to run in Qemu
- arm + linux + uclibc-ng
- arm + linux + libc
- x86_64 + linux + libc
- mips + linux + uclibc-ng
Original assignment:
Write a set of shell scripts allowing to create a ramfs or initrd for embedded systems. The scripts must not have external dependencies and must support cross-compilation (optional: allow to build the cross-compiler). The inclusion of custom programs, kernel modules, or boot scripts in the image must be supported. The shell script must be non-interactive (controlled through command-line parameters. Use "getopt" to parse them). The size of the initramfs must be reduced to the minimum. The resulting image must be able to run in Qemu.