Difference between revisions of "Create Debian sysroots"
(→Run debootstrap) |
(→Run debootstrap) |
||
Line 23: | Line 23: | ||
cd /tmp/sysroots | cd /tmp/sysroots | ||
for arch in amd64 arm64 mips mips64el ppc64el; do debootstrap --arch $arch --variant=buildd stable debian-$arch http://deb.debian.org/debian; done</nowiki> | for arch in amd64 arm64 mips mips64el ppc64el; do debootstrap --arch $arch --variant=buildd stable debian-$arch http://deb.debian.org/debian; done</nowiki> | ||
+ | |||
+ | == 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 amd64 arm64 mips mips64el ppc64el; do find debian-$arch -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' {} \; ; done | ||
== See also == | == See also == | ||
* [https://wiki.debian.org/Debootstrap debootstrap] | * [https://wiki.debian.org/Debootstrap debootstrap] |
Revision as of 13:51, 24 November 2019
Contents
Introduction
We'll create Debian sysroots suitable for a GCC cross compiler.
Prerequisites
Debian or Ubuntu or any system that can run debootstrap.
Everything below runs as root:
sudo -i
Install debootstrap
apt install -y debootstrap
Run debootstrap
mkdir -p /tmp/sysroots cd /tmp/sysroots for arch in amd64 arm64 mips mips64el ppc64el; do debootstrap --arch $arch --variant=buildd stable debian-$arch http://deb.debian.org/debian; 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 amd64 arm64 mips mips64el ppc64el; do find debian-$arch -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' {} \; ; done