Skip to content

Instantly share code, notes, and snippets.

Created May 19, 2019 02:56
Show Gist options
  • Save MitchRatquest/6fa56af5ffd97c869144b6cd481c7ff8 to your computer and use it in GitHub Desktop.
Save MitchRatquest/6fa56af5ffd97c869144b6cd481c7ff8 to your computer and use it in GitHub Desktop.
cdebootstrap script for armhf
#build kernel as debian package
mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
tar xvf linux-${MAJ}.${MIN}.${VER}.tar.gz
cd linux-${MAJ}.${MIN}.${VER}
patch -p1 < ${PATCH_DIR}/*.patch
make -j$(cat /proc/cpuinfo | grep -c processor) deb-pkg
#install rootfs in a dir
if [ $UID != 0 ]; then echo "please run as root"; exit 1; fi
mkdir -p "{$DEST_DIR}"
sudo cdebootstrap --arch=armhf --flavour="${FLAVOUR}" Debian/stretch "${DEST_DIR}" --include="${EXTRAS}"
cp ${KERNEL_DIR}/*.deb "${DEST_DIR}/root/"
#chroot on target system
mount /dev/mmcblk0p3 /mnt
for i in /sys /proc /run /dev; do mount --bind "$i" "/mnt$i"; done
chroot /mnt
#if packages not already installed via cdebootstrap
cd /var/cache/bootstrap
packages="multiarch-support tar perl-base init-system-helpers sensible-utils debianutils dash diffutils coreutils mawk base-files bash libaudit-common debconf libsemanage-common libpam-modules-bin passwd util-linux sysvinit-utils gzip sed bsdutils e2fsprogs libc-bin mount findutils grep hostname libpam-runtime login ncurses-bin ncurses-base sensible-utils ncurses-base libsemanage-common libaudit-common libc-bin diffutils debianutils hostname multiarch-support mawk base-files findutils ncurses-bin sed coreutils tar perl-base grep debconf gzip bsdutils dash init-system-helpers libpam-modules-bin bash libpam-runtime passwd login mount util-linux e2fsprogs sysvinit-utils adduser gpgv debian-archive-keyring apt lsb-base procps systemd dmsetup init libestr0 udev liblocale-gettext-perl tzdata apt-utils bsdmainutils cpio libtext-iconv-perl libtext-charwidth-perl libtext-wrapi18n-perl debconf-i18n dmidecode pinentry-curses readline-common gnupg-agent gnupg iproute2 ifupdown iptables iputils-ping libisc-export160 libdns-export162 isc-dhcp-client isc-dhcp-common kmod logrotate nano netbase rsyslog xxd vim-common vim-tiny wget whiptail vim-runtime vim readline-common cpio kmod libestr0 libisc-export160 xxd isc-dhcp-common dmidecode apt-utils tzdata init nano udev libtext-iconv-perl vim-common liblocale-gettext-perl vim-runtime libtext-charwidth-perl bsdmainutils cron logrotate rsyslog netbase iputils-ping vim-tiny vim libdns-export162 iproute2 isc-dhcp-client iptables libtext-wrapi18n-perl pinentry-curses gnupg-agent ifupdown debconf-i18n whiptail gnupg wget"
for i in ${packages}; do dpkg -i $package*; done
#install kernel packages
cd /root
dpkg -i *.deb
echo "ok done now"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment