Skip to content

Commit

Permalink
Make whole setup less device/soc dependent AND add work-in-progress s…
Browse files Browse the repository at this point in the history
…upport for kevin
  • Loading branch information
Maccraft123 committed Dec 11, 2020
1 parent 195bf28 commit 08e049d
Show file tree
Hide file tree
Showing 7 changed files with 10,005 additions and 6,329 deletions.
2 changes: 1 addition & 1 deletion config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/false

# Target device
# One of: duet
# One of: duet, kevin
TARGET=duet

# Whether to build the kernel or not
Expand Down
30 changes: 20 additions & 10 deletions fs/build
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
CADMIUMROOT=$1
TARGET=$2
PART=$3

set -e
set -v

source $CADMIUMROOT/config

cd $CADMIUMROOT/tmp
mkdir -p root
Expand All @@ -14,32 +14,42 @@ mount $PART root
# if we are on arm64 machine, don't use qemu to execute arm64 code
if [ "$(uname -m)" = "aarch64" ]; then
debootstrap --arch=arm64 sid root/ https://deb.debian.org/debian/ || true
echo "Running on ARM64 machine"
else
cp $(which qemu-aarch64-static) root/
qemu-debootstrap --arch=arm64 sid root/ https://deb.debian.org/debian/ || true
qemu=/qemu-aarch64-static
echo "Running on not-ARM64 machine"
fi

echo $TARGET > root/etc/hostname # set default hostname in kernel?

# remove root password, this is install medium so it's ok
chroot root/ $qemu /bin/passwd -d root

# copy ath10k firmware, qca6174 doesn't like upstream
mkdir -p root/lib/firmware/ath10k/QCA6174/hw3.0/
cp $CADMIUMROOT/fs/firmware/qcom/* root/lib/firmware/ath10k/QCA6174/hw3.0/
cp $CADMIUMROOT/fs/firmware/scp.img root/lib/firmware/
# board-specific setup

case "$TARGET" in
duet)
# qca6174 doesn't like upstream
mkdir -p root/lib/firmware/ath10k/QCA6174/hw3.0/
cp $CADMIUMROOT/fs/firmware/qcom/* root/lib/firmware/ath10k/QCA6174/hw3.0/
cp $CADMIUMROOT/fs/firmware/scp.img root/lib/firmware/

# copy libinput config
mkdir -p root/etc/libinput
cp $CADMIUMROOT/fs/local-overrides-duet.quirks root/etc/libinput/local-overrides.quirks
;;
esac

# copy installation scripts, double root is not a typo
cp $CADMIUMROOT/fs/install-* root/root/
chmod a+x root/root/install-*

# copy libinput config
mkdir -p root/etc/libinput
cp $CADMIUMROOT/fs/local-overrides-$TARGET.quirks root/etc/libinput/local-overrides.quirks


# preinstall packages
chroot root/ $qemu /bin/apt update
chroot root/ $qemu /bin/apt install -y vim vboot-utils network-manager debootstrap

#umount root
#umount root # done elsewhere
41 changes: 26 additions & 15 deletions kernel/build
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CADMIUMROOT=$1
set -e
set -v

source $CADMIUMROOT/config

# set env vars
export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
Expand All @@ -16,34 +18,43 @@ cd $CADMIUMROOT/tmp

# check if kernel has been downloaded this week, if not download/update it
if [ "$(date +'%V%y')" != "$(cat kern-dl-date || true)" ]; then
if [ -d "$CADMIUMROOT/tmp/linux" ]; then
cd linux
git pull
echo $(date +'%V%y') > kern-dl-date
else
git clone https://github.com/Maccraft123/linux-duet -b panfrost/duet linux
case $TARGET in
duet)
if [ -d "$CADMIUMROOT/tmp/linux" ]; then
cd linux
git pull
echo $(date +'%V%y') > kern-dl-date
else
git clone https://github.com/Maccraft123/linux-duet -b panfrost/duet linux
echo $(date +'%V%y') > kern-dl-date
cd linux
fi
;;
*)
rm -rf linux
curl -L "$(curl -sL https://www.kernel.org/ | grep "Download complete tarball" | head -n1 | tr '"' ' ' | awk '{print $3}')" -o Linux-archive
mkdir linux
bsdtar xf Linux-archive --strip-components=1 -C linux
echo $(date +'%V%y') > kern-dl-date
cd linux
fi
esac
fi

cd linux

cp $CADMIUMROOT/kernel/config-duet .config
cp $CADMIUMROOT/kernel/kernel.its kernel.its
cp $CADMIUMROOT/kernel/config-$TARGET .config
cp $CADMIUMROOT/kernel/kernel-$TARGET.its kernel.its
cp $CADMIUMROOT/kernel/cmdline cmdline
cp $CADMIUMROOT/kernel/cmdline.mmc cmdline.mmc

#for x in $(ls $CADMIUMROOT/kernel/patches/); do
# patch -p1 < $CADMIUMROOT/kernel/patches/$x
#done

#make nconfig # if you want to customize config just uncomment this
make nconfig # if you want to customize config just uncomment this

# backup old config if it's different, and copy new custom config
if [ "$(sha1sum $CADMIUMROOT/kernel/config-duet)" = "$(sha1sum .config)" ]; then
cp $CADMIUMROOT/kernel/config-duet $CADMIUMROOT/kernel/config-duet.old
cp .config $CADMIUMROOT/kernel/config-duet
if [ "$(sha1sum $CADMIUMROOT/kernel/config-$TARGET)" = "$(sha1sum .config)" ]; then
cp $CADMIUMROOT/kernel/config-$TARGET $CADMIUMROOT/kernel/config-$TARGET.old
cp .config $CADMIUMROOT/kernel/config-$TARGET
fi

echo Bulding in $(pwd) with $(nproc) threads
Expand Down
Loading

0 comments on commit 08e049d

Please sign in to comment.