Handle cross compilation via CC override, provide no default
Convert to C99

Define _BSD_SOURCE for access to non-standard libc functions.
Declare variables where they are used.
Use the "bool" type.
Fixed a few signed/unsigned comparisons.
Separate parsing of "rootfs_bak" and "boot="

Untangling the code makes it easier to change later on.
Make "boot=" parameter mandatory

When running in initramfs, no file system is automatically mounted by
the kernel, so we need to mount the fs containing the rootfs image.
If the "boot=" parameter is missing, we cannot do that, so it's simpler
to give up immediately than getting stranded later.

In theory mininit could be used for non-loop boot sequences and not
require "boot=" in that case. But those scenarios can be handled by
just kernel configuration, so there is no need to have mininit support
them.
Mount the losetup-attached image on /root

This allows dropping "root=/dev/loop0" from the kernel command line.
Use loop device definitions from the kernel UAPI

There is no need to replicate these in our sources.
Cleanups in loop.c

Removed lodelete(): it is never called and I don't see why we would
want to delete a loop device in mininit.

Removed unnecessary separator comments: no need for them in a tiny file
like this. And other formatting simplifications.
When the path passed to losetup is too long, return an error

Previously the code would truncate the path and try to continue with
the truncated version, which is a bad idea: most likely it will lead
to a misleading file-not-found error later on, but if the operation
would somehow succeed then it is working on the wrong path.

If we can't give the user what they asked for, returning an error is
the only right thing to do. I picked ENAMETOOLONG rather than ERANGE
since the exceeded limit is hardwired in the OS.
Mount devtmpfs on /dev

This leads to a big reduction in the number of device nodes that are
required in the initramfs. In particular, loop devices and other block
devices aren't required anymore.
Removed LOOP_SET_STATUS64 call from losetup()

I don't see why this would be necessary. I tested without setting the
name and the image mounts fine and also the information in sysfs is
present and correct.
Merged __losetup() into losetup()

There was very little left that losetup() did after the previous
commit removed unnecessary code.
Use /dev/loop-control to acquire a loop device

This makes kernels with CONFIG_BLK_DEV_LOOP_MIN_COUNT=0 work.
Hardcode rootfs file name as "rootfs.squashfs"

The advantage is that we need one fewer command line argument.
All the other file names on the system partition were already
hardcoded, so we won't lose much flexibility because of this.

I think the rootfs name argument dates back to the time when mininit
did not play a role in updates: the original Dingux had to be updated
offline, by writing the new files to the SD card from a PC.
Don't use __multi_mount() to mount rootfs

We use a hardcoded path now, so the ability to parse comma-separated
paths is not needed anymore. And there is no need to retry mounting,
since we're mounting a regular file instead of a block device that may
take a while to come online.
Hardcode system partition file system

The boot loaders we use only support vfat.

In the future, it may be useful to make this configurable using either
a build time option or a command line argument. But I don't think
trying every supported file system type until one succeeds is the right
approach for OpenDingux.
Removed file system autodetection

Since we hardcoded the rootfs and system partition file system types,
the autodetection code wasn't used anymore.

It wasn't real autodetection by looking for signatures, it just tried
mounting as each of the file systems listed in /proc/filesystems until
one succeeds. While this works, it is not very efficient and it can
also lead to a lot of logging about failed mounts.

This also brings us closer to not having to mount /proc.
Removed "init=" argument

One reason for removing it is that I want to be able to run mininit
from the system partition instead of from initramfs. In that case,
mininit is the actual init process and the kernel "init=" argument
will be used to point to mininit.

Another reason for removing it is that the kernel passes all arguments
it doesn't know to the init process. But "init=" is a kernel argument,
so it is not passed in this way and can only be retrieved from procfs.
Read arguments using argv and getenv()

The Linux kernel passes arguments that it doesn't consume itself to the
init process (except those containing a dot in the name). Use those
instead of the full command line from /proc/cmdline.
Forward environment to actual init process

It might have a use for key-value arguments from the kernel command
line too.
Removed mounting of /proc

The parsing of /proc/cmdline is no longer necessary since we now use
argv and the environment instead. The parsing of /proc/filesystems
was removed earlier. That leaves nothing using /proc anymore, so there
is no longer a neeed to mount it.

Also the helper functions to read and parse files from /proc were
removed.