Difference between revisions of "Create Debian sysroots"
(→See also) |
(→See also) |
||
Line 38: | Line 38: | ||
* [https://wiki.debian.org/Debootstrap debootstrap] | * [https://wiki.debian.org/Debootstrap debootstrap] | ||
+ | * [https://www.debian.org/ports Debian ports] |
Revision as of 14:10, 24 November 2019
Contents
Introduction
We'll create Debian sysroots suitable for a GCC cross compiler.
Debootstrap machine
Everything below runs on the debootstrap machine as root:
sudo -i
Prerequisites
Debian or Ubuntu or any system that can run debootstrap.
Install debootstrap
apt install -y debootstrap
Run debootstrap
mkdir -p /tmp/sysroots cd /tmp/sysroots arches="amd64,x86_64-linux-gnu arm64,aarch64-linux-gnu mips,mips-linux-gnu mips64el,mips64el-linux-gnuabi64 ppc64el,powerpc64le-linux-gnu" for arch in $arches; do IFS=","; set $arch; debootstrap --arch $1 --variant=buildd stable $2 http://deb.debian.org/debian; unset IFS; done
Fix symlinks
Debootstrap will create absolute symlinks, fix absolute symlinks to refer to the sysroot dir by changing them into relative symlinks.
for arch in $arches; do IFS=","; set $arch; find "$2" -type l -lname '/*' -exec sh -c 'file="$0"; dir=$(dirname "$file"); target=$(readlink "$0"); prefix=$(dirname "$dir" | sed 's@[^/]*@\.\.@g'); newtarget="$prefix$target"; ln -snf $newtarget $file' {} \; ; unset IFS; done