[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Control Debian image size



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=apt \
> >     --dpkgopt='path-exclude=/usr/share/man/*' \
> >     --dpkgopt='path-include=/usr/share/man/man[1-9]/*' \
> >     --dpkgopt='path-exclude=/usr/share/locale/*' \
> >     --dpkgopt='path-include=/usr/share/locale/locale.alias' \
> >     --dpkgopt='path-exclude=/usr/share/doc/*' \
> >     --dpkgopt='path-include=/usr/share/doc/*/copyright' \
> >     --dpkgopt='path-include=/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 smaller 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.
> 
> 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 can
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=apt --include=linux-image-amd64 unstable debian-unstable.tar
    $ cat << END > extlinux.conf
    > default linux
    > timeout 0
    >
    > label linux
    > kernel /vmlinuz
    > append initrd=/initrd.img root=/dev/sda1 rw console=ttyS0
    END
    $ guestfish -N debian-unstable.img=disk: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

Attachment: signature.asc
Description: signature


Reply to: