Skip to content

Instantly share code, notes, and snippets.

@keithel
Last active June 13, 2023 20:55
Show Gist options
  • Save keithel/5ba27546f506f3e2f3d82b3ea1e1b130 to your computer and use it in GitHub Desktop.
Save keithel/5ba27546f506f3e2f3d82b3ea1e1b130 to your computer and use it in GitHub Desktop.
Forking and updating a Qt debian package

https://launchpad.net/ubuntu/+source/qtbase-opensource-src
Fork it directly to your account
https://packaging.ubuntu.com/html/
https://www.debian.org/doc/debian-policy/ch-controlfields.html#version https://lintian.debian.org/tags/version-substvar-for-external-package https://help.launchpad.net/Packaging/PPA/Uploading
https://download.qt.io/official_releases/qt/5.15/5.15.9/submodules/
https://launchpad.net/~kamaji/+archive/ubuntu/focal-qt-5.15
https://packaging.ubuntu.com/html/fixing-a-bug.html
https://askubuntu.com/questions/265703/how-to-do-a-pbuilder-dist-build-with-dependencies-in-a-ppa

Instructions for bootstrapping Qt build from Dmitry Shachnev (Qt packages maintainer for Ubuntu/Debian): https://salsa.debian.org/qt-kde-team/qt/qtbase/-/blob/master/debian/README.source#L16

Fork Make sure that the source zip that the sources came from (Qt module) are present in the parent directory of the cloned forked launchpad git repo for the qt module.

  • Update the version number, following Debian guidelines
    EMAIL=keith.kyzivat@qt.io gbp dch --ignore-branch -N 5.15.9-0.1 -D focal
  • If you have not created a gpg keypair (RSA 4096bits recommended) do so now. Info about this here:
    https://wiki.debian.org/Keysigning
  • put DEBSIGN_KEYID=<your key ID> in ~/.devscripts - this will make sure to select your intended key for signing by debuild and any other debian packaging tools.
  • Build the source package files, skipping dependency checking (-d)
    git clean -xdf && git checkout . && debuild -d -S -sa
  • Add the PPA to the OTHERMIRROR setting of .pbuilderrc:
    Go to https://launchpad.net/~kamaji/+archive/ubuntu/focal-qt-5.15 (your launchpad config for your PPA), click Technical details about this PPA, and get the deb https://ppa.launchpadcontent.net line, and set it in the OTHERMIRROR variable set in your ~/.pbuilderrc file:
    OTHERMIRROR="deb htps://ppa.launchpadcontent.net/..."
  • Create pbuilder distribution chroot - This step only needs be done once:
    pushd ~/pbuilder
    sudo pbuilder create --distribution focal --basetgz focal-base.tgz --debootstrapopts --variant=buildd
    popd
  • Do the pbuilder-dist build for this arch (optional - dput will push it to launchpad which will also build it):
    pbuilder-dist focal build ../qtbase-opensource-src_5.15.9-0.1.dsc
  • This shouldn't be necessary, as debuild should do it for you.
    Sign the generated source.changes and dsc files:
    debsign -k C780F01CA9C39AD5 ../qtbase-opensource-src_5.15.9-0.1_source.changes
    debsign -k C780F01CA9C39AD5 ../qtbase-opensource-src_5.15.9-0.1.dsc
  • Put the package up on my ppa:
    dput ppa:kamaji/focal-qt-5.15 ../qtbase-opensource-src_5.15.9-0.1_source.changes
#!/bin/bash
# https://developer.ridgerun.com/wiki/index.php/Yocto_Support_for_NVIDIA_Jetson_Platforms_-_Flashing_the_Jetson_Platform
# Script was not really that useful for me because I realized I don't want to do an eMMC boot - as this has an SD Card, not EMMC.
# Regardless, it has a lot of script improvements by me to add guards, check for tools, provide usage, etc..
set -e -u
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
function print_usage () {
echo "$0 <IMAGE> <MACHINE>"
echo
echo " <IMAGE> - The bitbake image target invoked to build the image."
echo " e.g. 'core-image-sato-dev'"
echo " <MACHINE> - Machine specified in local.conf"
echo " e.g. 'jetson-nano-devkit'"
}
if [[ $# -lt 2 ]]; then
echo >&2 "Not enough arguments."
print_usage
elif [[ $# -gt 2 ]]; then
echo >&2 "Too many arguments."
print_usage
fi
# Check for the existence of required tools
set +e
dtc --version >/dev/null 2>&1
dtc_ret=$?
python --version >/dev/null 2>&1
python_ret=$?
set -e
if [[ $dtc_ret -ne 0 ]];then
echo >&2 "Could not find required tool 'dtc'. Please install it."
echo >&2 "On debian-based distributions:"
echo >&2 " $ sudo apt-get install device-tree-compiler"
exit 1
fi
if [[ $python_ret -ne 0 ]];then
echo >&2 "Could not find a python interpreter in the PATH. Please install one."
exit 1
fi
# Make sure we have sudo access by -v validating it, as this is required for flashing.
sudo -v
image=$1
machine=$2
deployfile=${image}-${machine}.tegraflash.tar.gz
tmpdir="$PWD/$(mktemp -d yocto_deploy.XXXX)"
#trap "echo 'Removing temp directory $tmpdir'; rm -Rf $tmpdir" EXIT
echo "Using temporary directory $tmpdir"
cd $tmpdir
cp $scriptdir/build/tmp/deploy/images/${machine}/$deployfile .
tar -xf $deployfile
echo "Executing doflash.sh from ${deployfile}"
sudo ./doflash.sh
#!/bin/bash
# https://developer.ridgerun.com/wiki/index.php/Yocto_Support_for_NVIDIA_Jetson_Platforms_-_Flashing_the_Jetson_Platform
set -e -u
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
function print_usage () {
echo "$0 <IMAGE> <MACHINE> <SDCARD_DEVICE>"
echo
echo " <IMAGE> - The bitbake image target invoked to build the image."
echo " e.g. 'core-image-sato-dev'"
echo " <MACHINE> - Machine specified in local.conf"
echo " e.g. 'jetson-nano-devkit'"
echo " <SDCARD_DEV> - The sd card device to write."
echo " e.g. '/dev/sdb'"
echo
echo " Please validate that the sdcard device is correct. This script will print out"
echo " a dump of the partitions using fdisk for you to verify against."
}
if [[ $# -lt 3 ]]; then
echo >&2 "Not enough arguments."
print_usage
exit 1
elif [[ $# -gt 3 ]]; then
echo >&2 "Too many arguments."
print_usage
exit 1
fi
# Check for the existence of required tools
set +e
dtc --version >/dev/null 2>&1
dtc_ret=$?
python --version >/dev/null 2>&1
python_ret=$?
set -e
if [[ $dtc_ret -ne 0 ]];then
echo >&2 "Could not find required tool 'dtc'. Please install it."
echo >&2 "On debian-based distributions:"
echo >&2 " $ sudo apt-get install device-tree-compiler"
exit 1
fi
if [[ $python_ret -ne 0 ]];then
echo >&2 "Could not find a python interpreter in the PATH. Please install one."
exit 1
fi
# Make sure we have sudo access by -v validating it, as this is required for flashing.
sudo -v
image=$1
machine=$2
sd_dev=$3
deployfile=${image}-${machine}.tegraflash.tar.gz
tmpdir="$PWD/$(mktemp -d yocto_deploy.XXXX)"
trap "echo 'Removing temp directory $tmpdir'; rm -Rf $tmpdir" EXIT
echo "Using temporary directory $tmpdir"
cd $tmpdir
cp $scriptdir/build/tmp/deploy/images/${machine}/$deployfile .
tar -xf $deployfile
echo
echo "Please verify that $sd_dev is the correct device by looking at the fdisk dump and"
echo "verifying that the size and partitions look correct to be overwriting. For instance,"
echo "if the disk is more than 128GB, be suspicious that this may be one of your internal"
echo "drives. The next step is irreversable, and any data on $sd_dev will be lost forever."
echo
sudo fdisk -l $sd_dev
read -p "Ok to overwrite ${sd_dev}? " -n 1 -t 20 overwrite_sd
if [[ "$overwrite_sd" == "y" || "$overwrite_sd" == "Y" ]]; then
echo "Executing 'dosdcard.sh ${sd_dev}' from ${deployfile}"
sudo ./dosdcard.sh ${sd_dev}
fi
Some tips from @blsmit5728 Brandon Ingress: ABeerSlayer in Ingress Tech chat (Telegram)
Who does a significant amount of Yocto work:
https://developer.ridgerun.com/wiki/index.php/Yocto_Support_for_NVIDIA_Jetson_Platforms_-_Setting_up_Yocto
https://developer.ridgerun.com/wiki/index.php/Setting_up_Yocto_for_Jetpack_4.4
Keith Kyzivat (Keithel 📦74), [5/26/23 11:10 AM]
I've been trying to do Debian package recipe upgrades using Launchpad for the past 3/4 day (half of yesterday).. Man is it a pain.
Brandon Ingress: ABeerSlayer, [5/26/23 11:11 AM]
using the debian folder stuff?
Brandon Ingress: ABeerSlayer, [5/26/23 11:12 AM]
we do a ton of that here and we have a "we accidentally uploaded it to github but it's okay" helper script if your interested
Brandon Ingress: ABeerSlayer, [5/26/23 11:12 AM]
it will auto build anything with cmake, make, autotools, python setup
Keith Kyzivat (Keithel 📦74), [5/26/23 11:13 AM]
This is glorious.
Brandon Ingress: ABeerSlayer, [5/26/23 11:13 AM]
hahahaha right!?
Keith Kyzivat (Keithel 📦74), [5/26/23 11:13 AM]
Yes - making sure that the copyrights are all in check stuff that is not kosher is removed, etc etc.
Brandon Ingress: ABeerSlayer, [5/26/23 11:14 AM]
https://github.com/CyberRadio/gr-cyberradio/blob/maint-3.8/makedebpy3
Keith Kyzivat (Keithel 📦74), [5/26/23 11:14 AM]
I'm trying to create a backported Qt 5.15 package for Ubuntu Focal aarch64.
Keith Kyzivat (Keithel 📦74), [5/26/23 11:14 AM]
and later one for Qt 6.5.1
Brandon Ingress: ABeerSlayer, [5/26/23 11:15 AM]
👀 yocto with target board and you could get an RPM pretty quickly.
Keith Kyzivat (Keithel 📦74), [5/26/23 11:16 AM]
Customer is using Jetson Xavier, but they want to use JetPack (NVidia's Ubuntu/debian derivative distro)
Keith Kyzivat (Keithel 📦74), [5/26/23 11:16 AM]
It would be much easier if they just were to be ok building their own distro using Yocto.
Brandon Ingress: ABeerSlayer, [5/26/23 11:16 AM]
https://github.com/meta-qt5/meta-qt5
Keith Kyzivat (Keithel 📦74), [5/26/23 11:16 AM]
Oh yeah, I'm def familiar with meta-qt5.
Keith Kyzivat (Keithel 📦74), [5/26/23 11:17 AM]
Also Boot2Qt — some layers atop of that.
Brandon Ingress: ABeerSlayer, [5/26/23 11:17 AM]
oh okay, I bet yocto has a target board for aarch64
Brandon Ingress: ABeerSlayer, [5/26/23 11:17 AM]
or you could just cmake it with the aarch compiler
Brandon Ingress: ABeerSlayer, [5/26/23 11:17 AM]
if you have a sysroots
Keith Kyzivat (Keithel 📦74), [5/26/23 11:18 AM]
I don't have the target board — just a Jetson Nano of my own, and compiles are horridly slow.
Brandon Ingress: ABeerSlayer, [5/26/23 11:18 AM]
oh dude...
Brandon Ingress: ABeerSlayer, [5/26/23 11:18 AM]
gimme a min....
Keith Kyzivat (Keithel 📦74), [5/26/23 11:19 AM]
I've got like 4 different paths I'm taking — qemu, cross compile x86_64->aarch64, docker, and right now just building on my home Ubuntu Lunar machine using debian recipes, uploading to Launchpad to get it to do the aarch64 package build.
Brandon Ingress: ABeerSlayer, [5/26/23 11:19 AM]
https://developer.ridgerun.com/wiki/index.php/Yocto_Support_for_NVIDIA_Jetson_Platforms_-_Setting_up_Yocto
Keith Kyzivat (Keithel 📦74), [5/26/23 11:21 AM]
Can this get a yocto env set up with the same environment that JetPack w/ focal/20.04 (can't remmber the jetpack version #) provides, so that any generated .debs will just install properly on their JetPack environment?
Keith Kyzivat (Keithel 📦74), [5/26/23 11:21 AM]
Nice - I will add this to my toolchest.
Brandon Ingress: ABeerSlayer, [5/26/23 11:21 AM]
I'm looking for that last piece..
Keith Kyzivat (Keithel 📦74), [5/26/23 11:22 AM]
The biggest gotcha is making sure that glibc versions match.
Brandon Ingress: ABeerSlayer, [5/26/23 11:22 AM]
https://developer.ridgerun.com/wiki/index.php/Setting_up_Yocto_for_Jetpack_4.4
Keith Kyzivat (Keithel 📦74), [5/26/23 11:22 AM]
ooh perfect!
Brandon Ingress: ABeerSlayer, [5/26/23 11:22 AM]
hehehe dude Yocto is the bomb when trying to cross, it makes life SOOO much easier
Brandon Ingress: ABeerSlayer, [5/26/23 11:22 AM]
once you learn the "how it works" you can cross compile almost anyhting
Brandon Ingress: ABeerSlayer, [5/26/23 11:23 AM]
I couldn't get pistache to cross, wrote our own layer and recipe. one patch and I was good.
Keith Kyzivat (Keithel 📦74), [5/26/23 11:23 AM]
It's been about 5 years since I last used Yocto in earnest.. It was great even back then. Though trying to convince the rest of the group to adopt it was challenging.
Brandon Ingress: ABeerSlayer, [5/26/23 11:25 AM]
we have our own meta layer internally
Brandon Ingress: ABeerSlayer, [5/26/23 11:25 AM]
that's how we build our app for the Xilinx Zynq parts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment