Commit Graph

39 Commits

Author SHA1 Message Date
Alexey Sheplyakov
db44ebdc74 Avoid races between init mounting loopback device and udev probing it
LOOP_SET_FD, LOOP_SET_STATUS ioctls trigger a `change` event with
loopback device in question. udev handles those events with
(builtin) blkid command. Probing a device with blkid takes a while,
so init might try to mount the loopback device in question while
`blkid` is still running. As a result init and udev block each other.
Eventually (after 3 minutes or whatever udev event timeout is)
`blkid` gets killed and boot proceeds. However such long delays are
very annoying. Therefore run `udev_settle` after each loop related
ioctl to avoid the concurrent access to the same loopback device.

Closes: #40687
2021-08-19 20:00:34 +04:00
Evgeny Sinelnikov
7a21d264c7 cdrom.c, tools.{h.c}: Add support 'fuid' automatic mode option for method cdrom
The installed system can have several devices with the same structure.
The automatic 'fuid' option can be used to detach one from the other to find the
partition where our stage2 image is stored, launched from stage1 (in this case
propagator). This option works automatically with the cdrom method:
- automatic=method:cdrom,fuid:PATH_TO_UNIQ_UID_FILENAME
2021-04-04 17:18:25 +04:00
Evgeny Sinelnikov
d39b85ae32 tools.c: break reading cycle if we actually loaded program into memory 2019-09-03 17:31:03 +04:00
Arseny Maslennikov
2440a17fbe Remove unnecessary whitespace from C program text 2018-05-09 15:21:26 +03:00
Leonid Krivoshein
da664f7f9e tools.c, tools.h: correct argument type of get_from_env().
This change also suppress compiler warnings.
2018-04-22 15:35:37 +03:00
Mikhail Efremov
68ad717ec3 cdrom.c, network.c, tools.c: Fix memory leaks 2017-12-08 16:18:56 +03:00
Mikhail Efremov
cca0e7faa9 tools.c: Don't do useless comparisons during cmdline processing 2017-12-08 16:18:47 +03:00
Mikhail Efremov
ee71c69502 Use ramdisk_size from kernel cmdline
If we can't get file's size then use ramdisk_size if given.
2017-12-08 16:18:37 +03:00
Mikhail Efremov
7f50a883ac Check that RAM size is enough for ramdisk
Don't try to load ramdisk we don't have enough memory.
2017-12-08 16:18:37 +03:00
Michael Shigorin
5ac5f51125 tools.c: get rid of a useless nested function
I don't understand who and why did that in the first place; undo it.
2017-03-18 22:49:14 +03:00
3d63eecb8d tools.c: refactored verify_ramdisk_digest()
This consists of several changes at once:
- purged unneccessary variables;
- fixed variable and function types;
- more readable return values;
- improved error logging;
- optimized hash printout just in case.

The original version of this patch fixed an off-by-one
issue too (it's been committed separately now).
2014-04-23 01:45:56 +04:00
Michael Shigorin
f3fe4de580 tools.c: fix off-by-one
Trailing \0 has to go somewhere; thanks ldv@ for the hint.
2014-04-22 18:32:07 +04:00
Michael Shigorin
8d2cd5aec8 initial verify_ramdisk_digest()
This is a patch by Maxim Suhanov <suhanov/group-ib.ru>
aiming to provide integrity and authenticity check for
stage2 rootfs image when required:

- media bootloader passes sha256 hash of stage2 image;
- stage1 early userspace code (that is, propagator)
  checks the candidate files against that during search;
- existing file with different checksum results in a warning
  with a dialog to just say NO, continue searching for the
  proper squashfs image and have a look at that weird one;
- existing file with correct checksum results in booting
  as usual.

The check is triggered by "hash=..." kernel boot parameter.

See also http://www.forensicswiki.org/wiki/Forensic_Live_CD_issues
2014-04-19 12:49:58 +04:00
Sisyphus
267ca6e7d1 fix build warning
tools.c: In function 'splash_verbose':
tools.c:309:2: warning: implicit declaration of function 'spawn' [-Wimplicit-function-declaration]

stage1.c: In function 'spawn_splash':
stage1.c:165:2: warning: implicit declaration of function 'spawn' [-Wimplicit-function-declaration]
2013-11-06 20:34:30 +04:00
Michael Shigorin
96da0337a6 check for /bin/plymouth before trying to run it
Essentially finished what gfd2a83d started; this is to avoid
"/bin/plymouth: No such file or directory" spam all over the place
when "splash" boot parameter is present but plymouth itself is absent.
2013-02-21 13:55:17 +02:00
Anton V. Boyarshinov
5e3a8c51a3 20101130-alt9
- completely broken memory calculation code deleted: we are lucky
2011-06-10 15:43:42 +04:00
Anton V. Boyarshinov
6e6f761864 tools.c: tell plymouth to quit if automatic fails 2010-12-21 17:56:50 +03:00
Anton Farygin
63a060b19a 20101202-alt1
- disable plymouth if splash parameter not in cmdline
- removed nosplash command
2010-12-06 11:17:21 +00:00
Anton Farygin
1e8818d6ff 20101130-alt3
- add nosplash command for disable plymouth
2010-12-01 16:10:02 +00:00
Anton V. Boyarshinov
cc71950045 20101130-alt2
- spawning plymouth fixed
2010-12-01 12:51:16 +03:00
Anton V. Boyarshinov
9728339b03 plymouth support improoved 2010-11-30 22:14:42 +03:00
Anton V. Boyarshinov
5379a6c482 basic plymouth support 2010-11-22 19:56:35 +03:00
Andriy Stepanov
20cf255d7b parse `init=' parameter 2009-07-01 15:17:05 +04:00
Sergey Bolshakov
d5799f185f typo in debug message fixed 2008-03-13 14:57:19 +03:00
Sergey Bolshakov
0a6af0fb35 massive change caused by udev use in initramfs:
- added udevd, udevtrigger & udevsettle spawning from init,
reproducing nead same logic, found in initrd, created by
/sbin/mkinitd
- lots of obsolete by this change stuff removed
- use external /sbin/modprobe form klibc utils
in places, where manual module loading still needed
- pack unchangeable part of initramfs into `initfs'
file (gzipped cpio archive), which may be concatenated later
with other parts (especially kernel modules) to form
actual initramfs image.
2008-03-01 22:02:06 +03:00
Sergey Bolshakov
48d26b2d15 - cleaned up 2007-03-03 00:48:18 +03:00
Anton Farygin
3085a93992 bootsplash progressbar support 2005-04-21 11:06:44 +00:00
Anton Farygin
fb310ae93a use squashfs for stage2 2005-04-12 19:32:01 +00:00
Sergey Bolshakov
1d2720df30 made things working:
- ramdisk name calculating
- lowmem parameter, ramdisk will not be loaded, if specified
- stagename parameter appeared, eq "altinst" if not specified
2005-03-05 15:26:22 +00:00
Sergey Bolshakov
c199c141b5 - do not die when couldn't open console rw
- losetup tweaks
2005-02-03 15:38:15 +00:00
Sergey Bolshakov
59b435ddcc changed location and name of stage2 image:
now resides at installation tree root and named as altinst.
If altinst is directory, then just mound --bind used.
This can be used in nfsroot env.
2005-02-02 19:26:15 +00:00
Sergey Bolshakov
67363c8441 ftp method fixed 2005-01-24 18:12:06 +00:00
Sergey Bolshakov
d62b45ce1a propagate env from stage1 further 2005-01-21 13:52:04 +00:00
Sergey Bolshakov
68463187b0 'disk' install method fixed.
WARNING: proto changed: get_ramdisk_path(char *)
2004-12-12 22:22:50 +00:00
Anton Farygin
8e45f2d2e5 use cloop images for stage2
removed method live (use parameter live for detection stage2 filesystem image)
2004-11-30 11:47:57 +00:00
Anton Farygin
2c956f151a livecd mode and method added
rescue method must be rewrited !!!
2004-11-24 21:44:32 +00:00
Alexander V. Nikolaev
b22dd2b038 rollback change name of second stage (keep install2)
src/*.c:  add some malloc checks and more informative error messages
2004-04-03 21:19:34 +00:00
Anton Kachalov
47fd3ec16e rename mdkinst_stage2.bz2 -> altinst_stage2.bz2
define stage2 executable in config-stage1.h
2004-01-30 16:50:12 +00:00
Anton Kachalov
46438969c6 Initial revision 2004-01-20 18:32:43 +00:00