chris-se / tiny-initramfs Goto Github PK
View Code? Open in Web Editor NEWA minimalistic initrd implementation
License: GNU General Public License v3.0
A minimalistic initrd implementation
License: GNU General Public License v3.0
I am using Debian 9 on QNAP TS-409 pro.
As initramfs-tools and dracut are giving result files too large (must be smaller than 4MB), I am trying to use tiny-initramfs.
For TS-409pro, there is no boot loader.
kernel is flash to /dev/mtdblock1
initrd is flashed to/dev/mtdblock2
So I need to include the root= parameter to the initrd.img file.
How can I do that?
Under Debian sid/unstable with gcc (Debian 10.2.1-1) 10.2.1 20201207, make
fails with error below,
$ ./autogen.sh
$ ./configure
$ LANG=C make -j4
make all-am
make[1]: Entering directory '/home/joey/src/tiny-initramfs'
CC tiny_initramfs-tiny_initramfs.o
CC tiny_initramfs-io.o
CC tiny_initramfs-fstab.o
CC tiny_initramfs-mount.o
CC tiny_initramfs-log.o
CC tiny_initramfs-devices.o
CC tiny_initramfs-util.o
devices.c: In function 'scan_devices':
devices.c:290:15: warning: implicit declaration of function 'major' [-Wimplicit-function-declaration]
290 | if (major(st.st_rdev) == maj && minor(st.st_rdev) == min) {
| ^~~~~
devices.c:290:33: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
290 | if (major(st.st_rdev) == maj && minor(st.st_rdev) == min) {
| ^~
devices.c:290:43: warning: implicit declaration of function 'minor' [-Wimplicit-function-declaration]
290 | if (major(st.st_rdev) == maj && minor(st.st_rdev) == min) {
| ^~~~~
devices.c:290:61: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
290 | if (major(st.st_rdev) == maj && minor(st.st_rdev) == min) {
| ^~
CCLD tiny_initramfs
/usr/bin/ld: tiny_initramfs-devices.o: in function `scan_devices':
devices.c:(.text+0x520): undefined reference to `major'
/usr/bin/ld: devices.c:(.text+0x539): undefined reference to `minor'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:398: tiny_initramfs] Error 1
make[1]: Leaving directory '/home/joey/src/tiny-initramfs'
make: *** [Makefile:301: all] Error 2
initramfs: Parameter root=root unsupported (only /dev/, 0xMAJMIN and UUID= are supported)
Using Debian sid/unstable with tiny-initramfs 0.1-5, on an old Acer TravelMate 5735Z/BA51_MV, BIOS V1.14 07/26/2011, with Intel Pentium T4500 and an F2FS root partition, F2FS fails to load as no crc32 routines can be loaded. The problem is, that the module crc32-generic
is not added to the initrd, but only the optimized version using PCLMUL instruction, not present on the old processor.
$ /sbin/modinfo f2fs
filename: /lib/modules/5.10.0-trunk-amd64/kernel/fs/f2fs/f2fs.ko
softdep: pre: crypto-crc32
license: GPL
description: Flash Friendly File System
author: Samsung Electronics's Praesto Team
alias: fs-f2fs
depends:
retpoline: Y
intree: Y
name: f2fs
vermagic: 5.10.0-trunk-amd64 SMP mod_unload modversions
parm: num_compress_pages:Number of intermediate compress pages to preallocate (uint)
To work around it, add crc32-generic
to the module list in /etc/tiny-initramfs/tiny-initramfs.conf
.
please add support for zstd or other compressors
Hi Chris,
Any chance that booting with root LABEL can be added to run_hook() in /usr/share/tiny-initramfs/functions?
Here is a quite robust method using blkid (no udev involved).
run_hook () {
local dev timeout sleepval device=$root
# if udev is running then exit
[ "$udevd_running" -eq 1 ] && return
# try for (timeout * sleepval =) 10 seconds to handle slow (USB) devices
timeout=1000
sleepval=0.01
case $device in
# label to resolve, when resolved the kernel block device also exists
UUID=*|LABEL=*|PARTUUID=*|PARTLABEL=*)
while [ $timeout -gt 0 ]; do
timeout=$((timeout - 1))
dev=$(blkid -lt "$device" -o device)
[ -n "$dev" ] && timeout=0 || sleep $sleepval
done
;;
# kernel named block device, poll for existence
/dev/*)
while [ $timeout -gt 0 ]; do
timeout=$((timeout -1))
if [ -b "$device" ]; then
dev=$device
timeout=0
else
sleep $sleepval
fi
done
;;
esac
}
Thanks,
bodhi
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.