Jump to content

going

Members
  • Posts

    781
  • Joined

  • Last visited

Everything posted by going

  1. In a sense, it is a build server for the target architecture in the target operating system environment. I have not come up with a simpler and more correct way at the moment. I am building a library and an application using kernel sources in a chroot environment by mounting them in the following way. From 29990c7edb920a7c5be3b898716f48d8bbc29dec Mon Sep 17 00:00:00 2001 From: The-going <48602507+The-going@users.noreply.github.com> Date: Fri, 13 May 2022 21:31:51 +0300 Subject: [PATCH] Mount bind linux source if necessary --- lib/chroot-buildpackages.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/chroot-buildpackages.sh b/lib/chroot-buildpackages.sh index 9471ee3a3..b4b52fc18 100644 --- a/lib/chroot-buildpackages.sh +++ b/lib/chroot-buildpackages.sh @@ -258,7 +258,7 @@ chroot_build_packages() for plugin in $config_for_packages; do unset package_name package_repo package_ref package_builddeps package_install_chroot package_install_target \ - package_upstream_version needs_building plugin_target_dir package_component "package_builddeps_${release}" + package_upstream_version needs_building plugin_target_dir package_component "package_builddeps_${release}" mount_linux_src source "${plugin}" # check build condition @@ -312,11 +312,19 @@ chroot_build_packages() fetch_from_repo "$package_repo" "extra/$package_name" "$package_ref" + if [ "$mount_linux_src" == "yes" ];then + mkdir -p $target_dir/root/linux + linuxsrc=$(realpath "${SRC}"/cache/sources/${LINUXSOURCEDIR}) + # redefine mount_linux_src + mount_linux_src="--bind-ro ${linuxsrc}/:/root/linux" + fi + eval systemd-nspawn -a -q \ --capability=CAP_MKNOD -D "${target_dir}" \ --tmpfs=/root/build \ --tmpfs=/tmp:mode=777 \ --bind-ro "$(dirname $plugin)"/:/root/overlay \ + $mount_linux_src \ --bind-ro "${SRC}"/cache/sources/extra/:/root/sources /bin/bash -c "/root/build.sh" 2>&1 \ ${PROGRESS_LOG_TO_FILE:+' | tee -a $DEST/${LOG_SUBPATH}/buildpkg.log'} -- 2.35.3
  2. This is a very beautiful example - usbip. If I understood correctly after reading this description: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/usb/usbip/README?h=v5.19 we need to build a kernel module, a user-space utility, and write udev rules for loading the module and starting the server. We need to pack all this into one or two packages and prescribe dependencies on a specific kernel. In this case, the utility will have dependencies on system libraries. That is, it must be collected in the environment in which it will be used. In order for this to become an easy way, we need to do the following: 1) Build packages from kernel sources without using the built-in mechanism (mkdebian, builddeb). Instead, we have to generate files in the debian directory ourselves from our own templates. During this process, handle some differences from the kernel version and writing all the necessary variables to files. 2) Collect packages for focal in this OS, packages for jammy in the jammy environment.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines