[Q] How to build linux-image?

Dear developers.

Could you please tell me how to build linux-image submodule?

I executed commands[/code] the following steps.
And got the following error.

Sincerely.

First clone build-iso and make iso image.

git clone git://github.com/vyos/build-iso.git

export PATH=/sbin:/usr/sbin:$PATH
autoreconf -i
./configure
sudo make iso

then update submodule

git submodule update --init pkgs/linux-image
cd pkgs/linux-image
# git branch helium --track origin/helium # I ignored this error
# fatal: A branch named 'helium' already exists. 
git checkout helium 
cd ../../

And make linux-image

make linux-image
dpkg-buildpackage -rfakeroot -D -us -uc -i -b -nc
dpkg-buildpackage: export CFLAGS from dpkg-buildflags (origin: vendor): -g -O2
dpkg-buildpackage: export CPPFLAGS from dpkg-buildflags (origin: vendor): 
dpkg-buildpackage: export CXXFLAGS from dpkg-buildflags (origin: vendor): -g -O2
dpkg-buildpackage: export FFLAGS from dpkg-buildflags (origin: vendor): -g -O2
dpkg-buildpackage: export LDFLAGS from dpkg-buildflags (origin: vendor): 
dpkg-buildpackage: source package linux-3.3
dpkg-buildpackage: source version 3.3.8-1+vyos1+helium1
dpkg-buildpackage: source changed by Daniil Baturin <daniil@baturin.org>
 dpkg-source -i --before-build linux-image
dpkg-buildpackage: host architecture amd64
dpkg-source: error: cannot read linux-image/debian/control: No such file or directory
dpkg-buildpackage: error: dpkg-source -i --before-build linux-image gave error exit status 2
debuild: fatal error at line 1325:
dpkg-buildpackage -rfakeroot -D -us -uc -i -b -nc failed
make: *** [linux-image] Error 29

Thank you, I solved the problem myself.

cd pkgs/linux-image/
debian/bin/build-flavour.sh amd64-vyos
...
This target is made to fail intentionally, to make sure
that it is NEVER run during the automated build. Please
ignore the following error, the debian/control file has
been generated SUCCESSFULLY.

exit 1
make[1]: *** [debian/control-real] Error 1
make[1]: Leaving directory `/home/arch/build-iso/pkgs/linux-image'
make: *** [debian/control] Error 2

Ignore last error.

Required kernel-package for build linux-image.

apt-get install kernel-package

And execute make

cd ${buid-iso_root}
make linux-image

We should add that to the howto.

Debian kernel package allows generating the control file dynamically for different kernel flavours. After cloning it, do this (inside linux-image source):

debian/rules debian/control

This will generate the control file and you will be able to build the packages with debuild (or “make linux-image” from the build-iso dir).

Also, the git branch error is normal now, all repos default to helium and when you clone them you are already on correct branch.

Hope this helps.

Thanks, however, I think debian/bin/build-flavour.sh is better.
Because when I build other flavor (eg. amd64-vyos-virt)

Maybe just execute

debian/bin/build-flavour.sh amd64-vyos-virt

It change define file like the following

cat debian/bin/build-flavour.sh

#!/bin/sh -e

# $1: kernel flavour to build
FLAV=$1
BARCH=$(dpkg-architecture -qDEB_BUILD_ARCH)
DEB_ARCH_DIR=$(pwd)/debian/arch/$BARCH

if [ ! -f "$DEB_ARCH_DIR/defines.$FLAV" ]; then
  echo "Invalid kernel flavour \"$FLAV\""
  exit 1
fi

cp -f "$DEB_ARCH_DIR/defines.$FLAV" "$DEB_ARCH_DIR/defines"

rm -f debian/{control,control.md5sum}
make -f debian/rules debian/control || true

Please tell me if you think debian/rules debian/control is better.

I’ll summarize this procedure.

Please review the following page.
Especially, English :slight_smile:

If It is OK, I’ll add VyOS Wiki.

I suggest
build-flavour.sh for generate
should be replaced with
build-flavour.sh to generate

Thanks for your effort

Hello fromport.

Thank you for your reply.

I created Rebuild VyOS kernel Step on Top page.