Commit Graph

53 Commits

Author SHA1 Message Date
11e1bf73db tar2fs: add grub support
...for vm images; BIOS one tested, EFI one untested yet
but will be required for AArch64 VMs it seems.
2018-12-24 19:33:41 +03:00
Michael Shigorin
c71ff2a39e tar2fs: handle single boot label as default
No sense to "provide" choice when there's none.
2018-10-29 12:46:08 +03:00
Michael Shigorin
27b07b2dca tar2fs: ensure proper cwd when cleaning up
...so that umounts can happen reliably.

Reported-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
2018-10-29 12:45:46 +03:00
Michael Shigorin
b31af10c79 tar2fs: generate proper boot.conf for e2k
This one supports multiple kernels (and tweaks boot
labels aiming to simplify target kernel selection
for the CPU at hand) instead of an earlier attempt
to fill in a template.

No need for the template so just drop it.
2018-05-21 22:50:07 +03:00
Michael Shigorin
650e92bf7f build-vm, tar2fs: handle multiple kernels either
This was crucial for e2k rescue image supporting
multiple CPU versions but can be useful elsewhere.
2018-05-21 22:50:00 +03:00
Michael Shigorin
aa7f2d8423 tar2fs: chgrp and failsafe kpartx
The current state made vm images belong to root group,
no reason to not change those to the primary group of
the user building an image.

kpartx -d -s could fail in some circumstances,
make a safety cleanup call more verbose.
2017-08-07 18:00:16 +03:00
Michael Shigorin
35dd200883 tar2fs: add e2k arch support
Somewhat ARM-like with only the bootloader bits
standing out; Elbrus 2000 firmware can read ext2
and boot the kernel directly.
2017-08-02 22:14:09 +03:00
Michael Shigorin
3d7a0c5c39 build-vm, tar2fs: unify kver handling
No need to deduce kernel version again,
just save it in a temporary file.

The main reason to change what worked is
that e2k kernel-image package has Linux bits
named as image-$kver and not vmlinuz-$kver;
the guessing logic taking all of this into
account resulted in non-aesthetic patch.

NB: there's a duplicating script within
    kernel feature; it wasn't easy to avoid
    this and it might differ when handling
    multiple kernels, I didn't think much
    about this now as vm images tend to ship
    with the sole one.
2017-08-02 22:13:44 +03:00
Gleb Fotengauer-Malinovskiy
1f63af0159 mp-commit: disable git hooks
These commits are temporary, so we do not care about stuff like
trailing whitespaces at all.
2017-02-08 23:04:24 +03:00
Michael Shigorin
a289726792 check-recipe: generalize dependency control
An initial (and quite naive) implementation was done
for conf.d/ files but features do need it as well --
which became obvious during a casual inspection of
distro/alt-workstation's target graph (which occured
broken).

The code is a messy hackery unfortunately, regexes used
are fragile regarding e.g. [A-Z_] in target names.
Read with care.

NB: lib/ might need this too but it's rather stable
    and contains some special cases that would obstruct
    the regexes even more...
2017-01-29 15:50:58 +03:00
Michael Shigorin
949733a9b4 report-targets: tweak targets
There's yet another m-p target class, ve/*; and
let's put a semicolon after anything else, too.
2017-01-29 15:02:05 +03:00
Michael Shigorin
b3caf70fa9 mktmpdir: refer to docs
Manual BUILDDIR specification isn't exactly obvious
from this script (aiming to derive it automatically),
so at least point those interested at QUICKSTART
they might have long forgotten already or, gasp,
not even started reading.
2016-12-26 15:56:46 +03:00
9526477124 - add virtio modules to initrd
- add output to console=ttS0 for run in cloud
2016-03-02 07:20:22 +03:00
Michael Shigorin
3b3cf4cc93 QUICKSTART, mktmpdir, build.mk: hasher's /proc
Either /etc/hasher-priv/system or /etc/hasher-priv/user.d/$USER
must contain at least "allowed_mountpoints=/proc" for mkimage
to work for mkimage-profiles; thanks Daniil Golovanov for
providing feedback indicating the lack of the corresponding
checks.
2016-01-10 13:08:03 +03:00
Michael Shigorin
025e611057 mktmpdir: fixed sort key
The sort key field value has been off-by-one apparently,
"6" corresponds to "capacity" field of df -PT output
while the "available" one was meant:

Filesystem     Type  1024-blocks     Used Available Capacity Mounted on
/dev/sda9      ext4     15350768 12799972   1747980      88% /
tmpfs          tmpfs     1967204    27396   1939808       2% /tmp

1              2               3        4         5       6

This lapse has been five years old, looks like it's only
been masked by lower available space limit *and* filesystem
ordering by type so far.  It didn't hit me even now, rather
inspected the code while implementing volumes-profile-starterkit...
2015-09-07 21:01:14 +03:00
Michael Shigorin
0cdc8a7d77 tar2fs: fixed broken sfdisk use
Yet another age old bug: `sfdisk -l' is mimicking what
a person does by hand but the script is rather interested
in what `sfdisk -g' provides, that is, geometry.

And it's stupid enough to only grok C locale.
2015-05-31 18:08:19 +03:00
Michael Shigorin
5542415e19 tar2fs: wait a bit
Looks like there's a race condition somewhere: this script
will fail to clean up after itself when considerable background
load is inflicted upon the host it's running on (e.g. LA ~16
on a 8-core, single-disk system).

Note that this commit is NOT enough to win that race
but just a step in the right direction...
2015-02-16 17:58:51 +03:00
Michael Shigorin
e238973c04 tar2fs: add ahci module
It's unwise to skip the common storage driver,
and vagrant (which uses virtualbox by default)
is likely to crash and burn as well.
2015-02-16 17:58:43 +03:00
Michael Shigorin
7b0501ae2a tar2fs: fix check for lilo binary
The check introduced by commit d7689f30 while rewriting tar2vm
(which presumed x86) was subtly broken: it checked for *host*
binary before preparing *chroot* configuration file for it.

Wonder how many build servers run lilo over here that this BUG
has managed to evade attention for almost two years...
2015-02-02 21:45:57 +03:00
Gleb Fotengauer-Malinovskiy
e177121ddf tar2vm: use UUID, prepare for virtio as well
Forward-port of b84182c5cb684afbd30ed1f9e5b6f89f55b4b53f
commit extended to handle /boot as well.
2014-03-20 19:46:53 +04:00
Michael Shigorin
9e162659a4 tar2fs: append to MODULES_PRELOAD, do not clobber
Thanks glebfm@ for spotting that it's = instead of +=
as it goes in all the other places; I remember no good
reason to overwrite the potentially preexisting contents.
2014-03-03 19:56:09 +04:00
Michael Shigorin
7c7d74b4d9 tags2lists: skip backup files too
Seeing tagged/base+rescue~ in build.log isn't particularly
heart-warming; while other editors but the one leaving tilda
marked backups and .sw* swap files might exist let's do this
step at this time.

Wonder what changed though, this used not to happen before.
2014-01-16 15:52:12 +04:00
Michael Shigorin
4918019b29 tar2fs: use -s Luke
Really no need to test and sleep when there's sync mode.
2013-07-22 23:40:58 +04:00
Gleb F-Malinovskiy
81a6ab9ec1 tar2fs: double /boot size
Factor of 2 is not enough for kernel upgrade due to filesystem overhead.
Add BOOT_SIZE_FACTOR on top of that.
2013-07-15 13:56:00 +04:00
Michael Shigorin
e3e9d4b894 report-targets: process vm/* either
A trivial overlook fixed up.
2013-07-02 00:01:38 +04:00
Michael Shigorin
d7689f30c7 tar2vm: rewrote as tar2fs
Overview of the changes:
- ARM support: separate ext2 /boot, no LILO
- avoid race condition with devmapper
- trap ERR so that -e in shebang doesn't result in extra cleanup hassle
- configurable root filesystem type (ext4 by default)
- jumps through parted hoops

Details:

1. LILO is x86-specific while the rest of the script can be used
   to prepare e.g. Marvell ArmadaXP or CuBox images; we can generally
   count on uboot supporting ext2 for relatively sane platforms but
   not ext4 that would be a better root filesystem performance-wise.

2. Apparently /dev/mapper/loopXpY can be still missing at the time
   when kpartx returns and pop up a bit later... sit there, wait
   and check for it.

3. If something went wrong with any command of the script it would bail out
   due to -e in shebang; it is now better to clean up the loopback device
   and its mappings in this situation either.

4. One size doesn't fit all, really.

5. The parted sizing was sloppy as in broken, now it's just half insane.
   Someone's decision to stick units and auto-alignment knobs into
   a single one was apparently hilarious...

   http://www.gnu.org/software/parted/manual/parted.html#unit

Manual loop/dm cleanup is described in documentation just in case.

/boot size meter is suboptimal in terms of additional I/O incurred,
will be most likely rewritten to make use of advance "du -s".
2013-06-17 19:29:11 +04:00
Michael Shigorin
6c9ca9af08 tar2vm: added xfs note
The issue at hand is the ability to accomodate boot sector
payload at the start of the filesystem's underlying block device.

XFS doesn't spare that space.

Thanks vsu@ for the reminder, by the way.
2013-04-19 21:00:29 +04:00
Michael Shigorin
ad264c7033 fixed mp-commit and its use
Now this is ugly: instead of commoditizing the repetitive code
the result ended up working differently by creating several
repositories for the target subdirs instead of the single one
for the generated subprofile as a whole.

This results in .disk/profile.tgz being basically useless
in every image since c4311108ea.
2013-02-11 21:29:15 +04:00
Michael Shigorin
bad7fb53ca tags2lists: filter out vim swap files
The (funny but somewhat confusing) problem manifests itself as

  E: Couldn't find package Binary

during a build run in the profile where a tagged packagelist
referenced by a specific target being built is open with vim
(which results in .FILE.sw? temporary file lying aside).
2012-12-26 17:15:59 +04:00
Michael Shigorin
5e9ba6fb1a tar2vm: reworked to use sfdisk
The issue (#28002) resulting in vm image build error reading

  Syntax error at or above line 5 in file '/etc/lilo-loop.conf'

was caused by fdisk-2.22 changing its "-l" option output format
to drop the very mention of the long irrelevant crap named "CHS".

The problem is, however, that we still need that crap to piggyback
a loop device's fake geometry to lilo while installing it there.

Reported by icesik@.
2012-11-19 23:26:51 +02:00
Michael Shigorin
e52e21781f actually useful vm/icewm
See http://www.opennet.ru/openforum/vsluhforumID3/86239.html#1
for a query that has led to this one; in particular,
- xdm dropped (won't log in root and there are no users yet);
- network is brought up and configured via DHCP by default;
- apt-get works out-of-box;
- default image size is twice the chroot size.
2012-09-03 19:16:50 +03:00
Michael Shigorin
c4311108ea git usage refactoring
There were heaps of "if type -t git" there already;
it wasn't an unintentional mishap but rather a moderate
copy-paste to get the use cases, and now these seem to
have essentially settled.

So time to scrap some dups.

NB: the scripts in the generated profile can't rely on
the contents of the metaprofile (these need to be able
to work in standalone case either), so a bit of crap
still lurks there.
2012-08-10 00:12:46 +03:00
Michael Shigorin
4ea5959f79 bin/mktmpdir: hasher might be unconfigured yet
No need to just go ahead and source files in potentially
unavailable directories, really.
2012-07-17 15:53:42 +03:00
Michael Shigorin
18f1a6360a bin/mktmpdir: grok NFS root
"df -l" is going to hurt (or at least spam) if it's a diskless node;
"df -P" helps maintain output parseability.  So be it.
2012-07-16 21:19:06 +03:00
Michael Shigorin
e355bd7ce9 bashize tar2vm
Finally tired of expr(1) quirks,
and even ash(1) does $((arithmetic-expansion))!
2012-06-25 19:29:38 +03:00
Michael Shigorin
75f7c62bd1 initial build-vm feature
Yes, mkimage-profiles is now able to build VM disk images.
So far the support is pretty basic:

- a single hard drive image with a single partition/FS
- only stock root password is configurable
- LILO is hardwired as a bootloader

The resulting images tend to boot under qemu/kvm though.

Please see doc/vm.txt for the warning regarding additional
privileges and setup required.  This was started back in
February but I still hoped to avoid sudo/privileged helper
(and libguestfs is almost as undistributable as can be)...

Thanks:

- http://blog.quinthar.com/2008/07/building-1gb-bootable-qemu-image-using.html
- Alexey Morarash who reworked that as https://github.com/tuxofil/linsygen
- led@, legion@, vitty@, aen@ for providing advice and inspiration
2012-06-18 21:56:46 +03:00
Michael Shigorin
f4519332e9 READMEs: pkglist related clarification
glebfm@ asked what to do with new package lists: whether these
belong to features, or to distributions themselves.  This question
is actually open and up for discussion but there are guidelines
that can and should be written down already; and so they were.

Added pkgdups utility reference as well.
2012-04-09 22:21:10 +03:00
Michael Shigorin
9fd0bc143e more readable `make help', finally
The output was still somewhat ragged in 80x24 terminal window
with fmt(1) which wasn't anticipating the word length difference
subsequent column(1) would have to cope with later on.

Thanks Loic Cattani for his shell columnizer implementation:
https://github.com/Arko/Columnize
2012-04-02 17:16:27 +03:00
Michael Shigorin
788cad885e initial target tracing support and reporting
The purpose is being able to examine particular target interdependency
graph for a given image having been configured to avoid convoluted
dependencies (loops in particular).

The implementation is based on SHELL hook hint by John Graham-Cumming:
http://cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
2012-03-19 19:23:38 +02:00
Michael Shigorin
5a1065c33e bin/mktmpdir: check for filesystem mount options
As was found out by Vladimir Karpinsky (thanks for patience!),
the autochosen directory might still have too restrictive mount
options -- nodev and/or noexec.  Hopefully the diags are a bit
better and faster by now.
2012-01-10 16:00:56 +02:00
Michael Shigorin
87bfa3f65d check vigorously the autochosen path prefix either
It happens that if the host environment isn't particularly
tuned up for package builds already then bin/mktmpdir might
come up with a directory outside hasher-allowed prefix list;
now that's a shame and not a Christmas gift, clearly.

Thanks Vladimir Karpinsky for pointing this problem out too.
2012-01-06 19:15:07 +02:00
Michael Shigorin
7738c6a67d bin/mktmpdir tweaks
The fallback case of building in a brother directory moved
from the last line of code to the first one becoming more
explicit along the way.

Support for slash-containing argument (being a tmpdir name
template prefix) has been added.
2012-01-02 21:01:09 +02:00
Michael Shigorin
8790a90cee pkgdups.sh and semi-random tagged pkglists shuffle
The bin/pkgdups.sh script comes from m-p-d in considerably optimized
form and is to be used with the pkglist files of interest passed
as its arguments to produce a "hall of duplicates" among those.

The tagged lists received some updates along the rescue image lines,
most of those are actually inspired by http://rescuecd.pld-linux.org/
and to lesser extent a few articles on rescue/recovery/forensics
software -- so some newcomers are even employed already.
2011-12-02 20:02:55 +02:00
Michael Shigorin
b6438b9c8f bin/mktmpdir: lower the space bar
With not-that-recent mkimage-profiles development,
it's no longer apparent that at least a gigabyte
of free space is required to build something useful
(at least for the tests, like syslinux.iso).

In short, the guesser cutoff margin is now 256M.
2011-11-06 17:36:09 +02:00
Michael Shigorin
ace2ee1fc1 features.in/Makefile: fixups
src/dst tags might have been empty confusing tags2lists;
the current implementation is more robust (along with
slightly better debug within bin/tags2lists itself).

pushd/popd spam tamed too (replaced by nice log messages).
2011-11-04 16:54:41 +02:00
Michael Shigorin
b474bff468 iso.mk: low space hint on build failure
Just in case the build.log will be inobvious, and it's easy to diagnose
automatically.  Thanks Andrey Stroganov for this use case.

Thanks for improving the initial implementation go to raorn@ for kind
commit lynch and to Yuri Bushmelev for actually suggesting something
more concise.

BTW the "1024" magic number was taken out of thin air:
the "no free space" errors are most likely to happen while
forming/populating a chroot (apt/rpm errors out) and chroots are
roughly two orders of magnitude heftier than a megabyte.
2011-11-04 16:15:31 +02:00
Michael Shigorin
ace5cb0ff6 assorted fixups
- more thorough build stages inline doc
- quieter BUILDDIR instantiation
- branding-altlinux-sisyphus by default
- prettify installer selection somewhat
- mkimage #24669 fixed upstream
- sub.in/stage1/modules: +drm (as in m-p-d, for KMS)
- tags2lists: generalize a bit
2011-11-04 16:15:29 +02:00
Michael Shigorin
62f7ad5bcc tagged lists updates
tags2lists was tweaked to work on the more natural word boundaries
than explicit "_", and the lists were renamed accordingly.

Dropped the borrowed pkglists by the way.
2011-11-04 16:15:29 +02:00
Michael Shigorin
c91a2a0994 syslinux and features
- syslinux: menu.c32 works
- features: initial draft
  + memtest
- mv pkg/ pkg.in/
  + server-base: include openssh-blacklist by default
- mv isodata/ copy/
- README: changed to utf8, added an URL
2011-11-03 20:38:35 +02:00
Michael Shigorin
c36b4df23e tagged lists again
These feel quite interesting but not that obvious yet...
2011-11-03 20:38:35 +02:00