BESIP build system¶
We needed to add some packages for OpenWrt which were not in main tree. We use OpenWrt feeds for integration of our work. There is one strict rule which we want to accomplish:
We do not want to hack OpenWrt, we want to use clean and right way how to integrate our work inside OpenWrt. Today, we need some hacks and patches due to initial revision, but we are in contact with OpenWrt community and we try to get most of our work into OpenWrt tree.
We are in early stage of development. Most usual way how to get BESIP working is to use our svn mirror.
You can checkout the source from the BESIP Subversion repository with the help of the below listed command.
# svn co https://liptel.vsb.cz/svn/besip
In root directory with a working copy of our repository are branches and Trunk. Trunk contains the latest cutting-edge versions of applications and it's stage is under development.
Each branch contains Makefile which sets up complete OpenWrt buildroot and its prerequisities automatically and makes compiling whole BESIP OpenWrt image much easier. Those Makefiles groups up compiling procedures and provides much easier commands to make it work.
Versioning¶
BESIP version consist of two parts. First is version of BESIP (like 1.0, 1.1, 1.2alpha1) and the second one is OpenWrt version. Cutting-edge applications and features are available for Trunk version of BESIP and trunk version of OpenWrt. For older releases of OpenWrt (like kamikaze), we are trying to make most of our software features working too, but it is not possible so features are limited. Their primary purposes is for repository which we serve.
Build process¶
Autobuild¶
There is a set of scripts which uses procedures created in general Makefile.
By simply calling autobuild:
# ./autobuild.sh
you get following actions you can do with target and a list of targets:
Enter valid target name! (./autobuild.sh [actions] target [target] ...) actions can be (could be several actions separated by comma): build - build (default action) tst - only show what would be done. clean - clean target. dirclean - directory clean target (delete all compiled files except downloaded archives). update - update target from svn. prepare - prepare target tools and toolchain. config - only configure target. debug - make with verbose messages (single thread). unlock - remove lock file repo - Create repository from local builds repoclean - Clean repo Targets: (you may use 'all' to build all, 'pall' to paralel build all, 'tall' to paralel build with tmux) asuswl_500gp-brcm47xx-backfire asuswl_500gp-brcm47xx-trunk gigasx76x-lantiq-trunk tplink1043nd-ar71xx-backfire tplink1043nd-ar71xx-trunk tplink-wdr3600-ar71xx virtual-x86-attitude_adjustment virtual-x86-backfire virtual-x86-trunk Targets with debug info (only for BESIP development) asuswl_500gp-brcm47xx-backfire-dbg asuswl_500gp-brcm47xx-trunk-dbg gigasx76x-lantiq-trunk-dbg tplink1043nd-ar71xx-backfire-dbg tplink1043nd-ar71xx-trunk-dbg tplink-wdr3600-ar71xx-dbg virtual-x86-attitude_adjustment-dbg virtual-x86-backfire-dbg virtual-x86-trunk-dbg
To build a target you can call
./autobuild <name of target>
If you call autobuild only with a name of target, clean, update and build procedures are called. You can also call specific procedure
./autobuild build <name of target>
or you can do it by calling more procedures. e.g.:
./autobuild update,prepare,build <name of target>
You can also build more targets at once:
./autobuild build all # To build all targets (except dbg)
Target creation¶
Latest trunk branch contains directory cfg which consists of .mk files and directory owrt. Those .mk files are pre-made for hardware used in this project (TP-Link 1043ND, BESIP HW, and Asus Wl-500g). Image config is automaticaly generated from target config.
Our goal was to skip usage of image configuration files. Needed packages in image should be declared in variable BESIP_PACKAGES in *.mk file.
There is an example which describes target for virtual-x86-trunk:
# CPU of target TARGET_CPU=x86 #OpenWrt version OWRT_NAME=trunk # Result file name (without path!) TARGET_NAME=virtual_$(BESIP_VERSION)-owrt_$(OWRT_NAME) # Parameters used for qemu test TARGET_QEMU=i386 TARGET_QEMU_OPTS=-m 512 # OWRT images which are copied to BESIP images after creation. You can define only some of them or none if only repository is needed. # This has to be same names as OpenWrt buildroot generates. # Disk image OWRT_IMG_DISK_NAME=openwrt-$(TARGET_CPU)-generic-combined-squashfs.img # Kernel image OWRT_IMG_KERNEL_NAME=openwrt-$(TARGET_CPU)-generic-vmlinuz # Squashfs image #OWRT_IMG_SQUASHFS_NAME=openwrt-$(TARGET_CPU)-generic-squashfs # TRX for Asus wl-500gp #OWRT_IMG_TRX_NAME=some_name # BIN for Tplink #OWRT_IMG_BIN_NAME=some_name # Packages which will be embeded inside or whoch will be in repo # package=y means that it will be directly in image # package=m means it will not be in image, but it will be compiled and will be available in repository BESIP_PACKAGES=besip-lite=y besip-huge=y besip-dev=m \ kmod-usb-net=y \ kmod-ata-core=y kmod-libsas=y kmod-loop=y kmod-ide-core=y kmod-ata-nvidia-sata=y kmod-ata-piix=y kmod-ata-via-sata=y kmod-ata-ahci=y block-mount=y \ valgrind=m bash-completion=y bluez-utils=y swap-utils=y fdisk=y e2fsprogs=y resize2fs=y tune2fs=y kmod-fs-btrfs=y btrfs-progs=y kmod-fs-ext4=y kmod-crypto-core=y # OpenWrt Configuration settings specific for target OWRT_CONFIG_SET += TARGET_x86=y \ HAS_SUBTARGETS=y \ TARGET_BOARD="x86" \ TOOLCHAINOPTS=y SSP_SUPPORT=y TLS_SUPPORT=y \ MC_EDITOR=y MC_DIFF_VIEWER=y \ TARGET_IMAGES_PAD=y \ TARGET_KERNEL_PARTSIZE=100 TARGET_ROOTFS_PARTNAME=\"/dev/sda2\" TARGET_ROOTFS_PARTSIZE=150 TARGET_ROOTFS_MAXINODE=60000 \ EXTROOT_SETTLETIME=2 # Some configs which has to be unset OWRT_CONFIG_UNSET += MC_DISABLE_VFS # Files which should be embeded to image # Format src:dst (src relative to files/ directory, dst absolute path in embedded root) OWRT_ADDED_FILES += fstab.virtual:/etc/config/fstab # Modules which will be embedded into linux kernel. This is set of drivers, which has to be available BEFORE mounting rootfs EMBEDED_MODULES += SATA_AHCI SATA_AHCI_PLATFORM SATA_INIC162X SATA_ACARD_AHCI SATA_SIL24 ATA_SFF \ PARAVIRT_GUEST KVM_GUEST KVM_CLOCK PARAVIRT_TIME_ACCOUNTING VMWARE_BALLOON NETCONSOLE VMXNET3 VIRTIO_PCI VIRTIO_BALLOON VIRTIO_MMIO ACPI VIRTIO_BLK PARAVIRT \ NET_9P NET_9P_VIRTIO 9P_FS 9P_FS_POSIX_ACL
General usage of Makefile¶
Main Makefile in root directory of each branch contains commands which groups up more complex commands of OpenWrt buildroot into much simplier commands. All those parameters has to be passed to make command.
This is a list of all routines for make command:
- all: "make all" calls subroutines "make <info prereq besip-images besip-packages>". If no local CFG is specified then target of output OpenWrt BESIP image is target-x86 for BESIP hardware.
- quick: "make quick" calls subroutines "make <info asterisk kamailio3 besip-packages>".
- info: "make info" prints out target board, OpenWrt build directory, location of target images and "make" arguments.
- prereq-i686: "make prereq-i686" checks if build tools are installed on host machine for architecture i686. This commands uses dpkg to check if those apps are installed. Dpkg is an application that works with Debian package management system.
- prereq-x86_64: "make prereq-x86_64" checks if build tools are installed on host machine for architecture x86_64. This commands uses dpkg to check if those apps are installed.
- prereq: "make prereq" calls make prereq for target architecture.
- svn-co-owrt: Checks out working copy of OpenWrt SVN repository.
- update-feeds: It links packages-besip and packages directory into OpenWrt feeds resources. Then it updates OpenWrt feeds (feeds update -a)
- install-feeds: It installs OpenWrt feeds.
- clean: It reverts OpenWrt buildroot into its original state. It also deletes OpenWrt build dir.
- clean-stamp: it removes all stamps created by this Makefile. Those stamps determines if some commands were run.
- clean-image: it removes generated BESIP images and OpenWrt images.
- clean-feeds: it removes BESIP feeds from OpenWrt Buildroot.
- clean-besip: it removes generated BESIP images and calls make package/package/besip clean
- distclean: it removes OpenWrt build dir.
- fastdistclean: it removes OpenWrt build dir.
- clean-build: it removes OpenWrt build dir.
- update: removes svn stamps (feeds updated, feeds installed, svn updated), updates working copy of this project to the latest revision and creates stamp showing that OpenWrt buildroot is prepared.
- update-cleanstamp: removes stamps - feeds-updated, feeds-installed, svn-updated
- update-us: updates working copy of this project to the latest revision
- changes: shows changes against the latest checked out working copy of our repository
- svn-update-owrt: updates OpenWrt buildroot to the latest revision
- config-owrt: if TARGET_CFG exists then this procedure config-owrt copies this configuration file into .config-tmp1. Inner loops adds BESIP_PACKAGES and OWRT_CONFIG_SET packages into .config-tmp2. After that this configuration file is copied into .config file of OpenWrt buildroot and then make defconfig -C OPENWRT_BUILDROOT is called.
- prepare-owrt: creates stamp showing that OpenWrt Buildroot is prepared.
- prepare-kernel: it prepares OpenWrt kernel. If TARGET_CFG is specified, then submitted kernel config in TARGET_CFG is used (==copied into suitable directory)
- patch-owrt: it patches OpenWrt buildroot by calling apply.sh
- unpatch-owrt: it unpatches OpenWrt by calling apply.sh unpatch, it also removes PATCHED stamp
- revert-owrt: it reverts SVN working copy to its default state.
- owrt-image: it compiles and creates OpenWrt image
- download-nightly: it pushes created images onto BESIP_RSYNC mirror
- besip-image: It creates BESIP image and suitable md5sum
- besip-images:
- besip-packages: It copies BESIP packages into suitable image folder.
- copy-packages:
- kernel_menuconfig: Calls make kernel_menuconfig in OpenWrt buildroot
- kernel: compiles kernel by calling make target/linux/compile
- clean-kernel: cleans up kernel by calling make target/linux/clean. It removes whole kernel build_dir directory.
- test-kvm: This command is used for testing purposes - BESIP image is virtualized by KVM with nographic, serial is redirected into console output.
- test-qemu: This command is used for testing purposes - BESIP image is emulated by QEMU with nographic, serial is redirected into console output.
- index: It creates package index .
- showtargets: It prints out all selected packages.
Status of our OpenWrt patches¶
[[http://patchwork.midlink.org/bundle/bright/besip/?state=%2A&archive=both]]