-
Notifications
You must be signed in to change notification settings - Fork 13
Adding new package rule
This tutorial will guide you in the process of creating and adding a new package to GLUED OS. We will use the x264 package as an example. In order to configure and build the new package we will need a valid toolchain in place, in this tutorial we are going to use the system lctr-rpi4.
- In the folder "rules" create a folder with the name of the package we want to create.
mkdir rules/x264
- Create a configuration file with the name
"default.bash"
. This file will have the settings for the cross-compile of the package for the system. - Inside the configuration file we have: (x264 example)
version=\
(
"20121125-2245-stable"
)
url=\
(
"ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-$version.tar.bz2"
)
md5=\
(
"285f6d498574a31857e06af75b6ea594"
)
configure()
{
"../x264-snapshot-$version/configure" \
--sysroot="${cfg_dir_toolchain_sysroot}" \
--cross-prefix="${cmd_target_prefix}" \
--host="$cfg_target_canonical" \
--prefix="${cfg_dir_toolchain_sysroot}/usr"
}
build()
{
$cmd_make
}
host_install()
{
$cmd_make install
}
target_install()
{
$cmd_cp "$cfg_dir_toolchain_sysroot/usr/bin/x264" "$cfg_dir_rootfs/usr/bin"
}
*Description of the fields:
version - Defines the name/version of the "source" package to use
url - Defines the address from which to download the "source"
md5 - Value that will have to match the md5 calculated, after downloading the "source". In this way it is possible to check if the downloaded "source" is corrupted or if the "original".
configure - Where pre-configuration is done for compiling the package. In some packages this step may not be necessary.
build - Section for compiling the source, with the respective flags existing in the system configuration file, generated initially (lctr-rpi4/template.bash)
host_install - Section to install the package on the system's cross-compile toolchain. In some packages this step may not be necessary.
target_install - Section to install the package on the system's rootfs. In some packages this step may not be necessary.
- In order to add the rule to the system to be created (For this example)
Go to the
systems/lctr-rpi4
folder
Open file template.cfg
Add
x264
to sectioncfg_packages
-> cfg_packages="$cfg_packages gdb rpi4cfs/5uart opencv/v4.xx264
"
Create the system configuration file again.
Create a valid system toolchain
Create a system toolchain (Compile GLUED for a system)
./mkconfig.bash template
./mksystem.bash lctr-rpi4/template.bash
./pkrootfs.bash lctr-rpi4/template.bash `Create OS for system (sysroot)`
./pktoolchain.bash lctr-rpi4/template.bash `Create toolchain for cross-compile system`