Re: Control Debian image size

Johannes Schauer <[email protected]> Sun, 03 Mar 2019 11:53:59 +0100
Newsgroups gmane.linux.debian.devel.embedded
Message-ID <155161043998.20079.15091787993075073223@hoothoot>
--===============1404969632504829129==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

Quoting JH (2019-03-03 11:06:39)
> > An easy way to create a chroot tarball with this option already set is =
by
> > using mmdebstrap (shameless plug: I'm the author) like so:
> >
> > mmdebstrap --variant=3Dapt \
> >     --dpkgopt=3D'path-exclude=3D/usr/share/man/*' \
> >     --dpkgopt=3D'path-include=3D/usr/share/man/man[1-9]/*' \
> >     --dpkgopt=3D'path-exclude=3D/usr/share/locale/*' \
> >     --dpkgopt=3D'path-include=3D/usr/share/locale/locale.alias' \
> >     --dpkgopt=3D'path-exclude=3D/usr/share/doc/*' \
> >     --dpkgopt=3D'path-include=3D/usr/share/doc/*/copyright' \
> >     --dpkgopt=3D'path-include=3D/usr/share/doc/*/changelog.Debian.*' \
> >     unstable > debian-unstable.tar
> >
> > The resulting tarball debian-unstable.tar is 69M in size. You can find a
> > very similar example in the mmdebstrap man page. You can go even smalle=
r if
> > you omit the path-include parts of above command (64M) and even smaller=
 by
> > not installing apt (49M). You can go even more extreme with the custom
> > variant which lets you pick exactly the package set you want, ignoring
> > Essential:yes packages.
> That is encouraging, I'll remove the /var/cache as well.
>=20
> But the chroot rootfs in tar ball only works to install a device where
> the kernel is already available, correct?

Yes, this does not include a kernel but only Essential:yes packages, apt and
their dependencies.

> What can I do to build Debian image with kernel for imx6? Using Isar or
> something?

I'm not familiar with imx6 and which kernel image you need for that but I c=
an
tell you how you can create a bootable qemu image for amd64 and maybe by
replacing linux-image-amd64 by the correct kernel this might work for you.
Though maybe you boot with uboot or the like and thus more work might be
needed.

    $ mmdebstrap --variant=3Dapt --include=3Dlinux-image-amd64 unstable deb=
ian-unstable.tar
    $ cat << END > extlinux.conf
    > default linux
    > timeout 0
    >
    > label linux
    > kernel /vmlinuz
    > append initrd=3D/initrd.img root=3D/dev/sda1 rw console=3DttyS0
    END
    $ guestfish -N debian-unstable.img=3Ddisk:2G -- \
        part-disk /dev/sda mbr : \
        part-set-bootable /dev/sda 1 true : \
        mkfs ext2 /dev/sda1 : mount /dev/sda1 / : \
        tar-in debian-unstable.tar / : \
        extlinux / : \
        copy-in extlinux.conf /
    $ qemu-img convert -O qcow2 debian-unstable.img debian-unstable.qcow2

Thanks!

cheers, josch

--===============1404969632504829129==
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Description: signature
Content-Type: application/pgp-signature; name="signature.asc"; charset="us-ascii"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEElFhU6KL81LF4wVq58sulx4+9g+EFAlx7skQACgkQ8sulx4+9
g+F+Yw/6AkWpp1ZJZbsKYGmz4fmlnW2x2X10IS7WxuiFByvzoaUdkel3jOEt8o/h
uno1FM6w7uGP3Io/C90cDmqjH3dEeA9xu4HQjMv/SSuWLNdCkTHNTtcNcUfZWsVV
8Du1l93zIcSAP0A5d3L/d0bJuzvupvAtZGbw94NqsAte0dP+yCXwdSyLrgru3Rk+
firxwPd+GoTZ6Nqj+eBSkFCilkena9WPVoBYg6Jzqy7WntR/SsaJ5RIklVyL1WUb
8FJp8zozH9ueyHut5/BmCxwrCYFbmIE+2QcgvwpZJuLvLDTySWVDVzodPenAqBFU
V2vcODvscUtJBeb1r6g2iLjoZoBB2qAt9qVAr53LHqB7VhEA8HVQDrNRLzRklYv/
GSzsPh8/QwHLYyib6K9YRXVNjkzceKOCEJToBBmIdsrx6YU/bZNo98Xp4yCRthrk
xnec66fqSFQRd6zetBZ4G7xBKbmsTrxW3HfO8REEEYMeaNXfSQOtjg8P71pLY2+w
GiGwARJiqZfk1DTusgkXj9c/62+onHFdVSpdDhfS0l0LrSQMMT3/BEmodDY1Qfxo
DYAzJP6hw3aVSYZ4kSAMNF5vBLfBrGBnr/fPYKPIeSWStnQ8GJ67iZBxjTzOD3fC
dLAlf1ebjmnDtvMTxFlszhRZazoxFRNpR3/T/LK1NbcdwrCnJ0U=
=lzqx
-----END PGP SIGNATURE-----

--===============1404969632504829129==--