This repository has been archived by the owner on Jun 15, 2021. It is now read-only.
forked from scele/tegra-scripts
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathprepare-rootfs
executable file
·59 lines (46 loc) · 1.61 KB
/
prepare-rootfs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
set -e
. scripts/env.sh
# Run a command into the chrooted target FS using qemu and proot
run_in_qemu()
{
PROOT_NO_SECCOMP=1 proot -0 -r $SYSROOT -q $TOP/out/host/qemu/qemu-$ARCH-static -b /etc/resolv.conf -b /etc/mtab -b /proc -b /sys $*
}
if [ ! -e $SYSROOT ]; then
error "Directory $SYSROOT does not exist. Run ./scripts/download-rootfs to download a fresh image."
exit 1
fi
status "Setting current user as owner of target FS..."
sudo chown -R $USER $SYSROOT/*
######## ROOTFS OWNED BY USER
. scripts/distro/prepare-$DISTRO
mkdir -p $SYSROOT/$NV_PREFIX
mkdir -p $SYSROOT/boot
mkdir -p $SYSROOT/lib/modules
mkdir -p $SYSROOT/lib/firmware
status "Adding environment to /etc/profile.d/nouveau.sh"
cat <<EOF |tee $SYSROOT/etc/profile.d/nouveau.sh >/dev/null
export PATH="$NV_PREFIX/bin:\$PATH"
export PKG_CONFIG_PATH="$NV_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
EOF
status "Adding ld.so.conf.d entry for $NV_PREFIX/lib"
cat <<EOF |tee $SYSROOT/etc/ld.so.conf.d/nouveau.conf >/dev/null
$NV_PREFIX/lib
EOF
status "Enabling Xwayland in Weston configuration"
mkdir -p $SYSROOT/etc/xdg/weston
cat <<EOF >$SYSROOT/etc/xdg/weston/weston.ini
[core]
modules=xwayland.so
[xwayland]
path=/opt/nouveau/bin/Xwayland
EOF
######## ROOTFS OWNED BY ROOT
status "Setting back root as owner of target FS"
status "Setting current user as owner of /boot, /lib/modules and /lib/firmware"
sudo -s -- <<EOF
chown -R root:root $SYSROOT/*
chown -R 1000:1000 $SYSROOT/home/alarm
chown -R $USER $SYSROOT/$NV_PREFIX $SYSROOT/boot $SYSROOT/lib/modules $SYSROOT/lib/firmware
EOF
status "Target FS ready to compile the open graphics stack!"