Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix kernel compile problem for arm64 #137

Merged
merged 2 commits into from
May 30, 2020

Conversation

taocy001
Copy link
Contributor

@taocy001 taocy001 commented May 25, 2020

  1. generate .config files for armhf, arm64, amd64 in turn.
  2. Compile the kernel with the corresponding environment variable.
  3. rely on updates to the sonic-slave-buster, see PR Arm64 buster build sonic-buildimage#4639.

@lguohan
Copy link
Contributor

lguohan commented May 25, 2020

can you check the build failure?

@taocy001
Copy link
Contributor Author

can you check the build failure?

These changes rely on updates to the sonic-slave-buster.
in sonic-net/sonic-buildimage#4639
add:

# For march kernel compile
RUN apt-get install -y crossbuild-essential-amd64 \
        crossbuild-essential-arm64 \
        crossbuild-essential-armhf

@taocy001
Copy link
Contributor Author

retest this please

@lguohan
Copy link
Contributor

lguohan commented May 26, 2020

the build image pr has been merged. can you check the build failure?

@sonic-net sonic-net deleted a comment from taocy001 May 27, 2020
@lguohan
Copy link
Contributor

lguohan commented May 27, 2020

@antony-rheneus, can you take a look at this pr?

Makefile Outdated
@@ -52,6 +52,16 @@ DSC_FILE_URL = "http://security.debian.org/debian-security/pool/updates/main/l/l
DEBIAN_FILE_URL = "http://security.debian.org/debian-security/pool/updates/main/l/linux/linux_4.19.67-2+deb10u2.debian.tar.xz"
ORIG_FILE_URL = "http://security.debian.org/debian-security/pool/updates/main/l/linux/linux_4.19.67.orig.tar.xz"

define dpkg-architecture-armhf
$(shell dpkg-architecture -aarmhf) CROSS_COMPILE=arm-linux-gnueabihf-
Copy link
Contributor

@antony-rheneus antony-rheneus May 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need of cross compilation, as multi arch is enabled

Makefile Outdated
# fakeroot make -f debian/rules.gen setup_armhf_none_armmp
# fakeroot make -f debian/rules.gen setup_arm64_none
fakeroot make -f debian/rules.gen setup_amd64_none_amd64
$(call dpkg-architecture-armhf) fakeroot make -f debian/rules.gen setup_armhf_none_armmp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The one mentioned in this comment also does the job
#121 (comment)

Makefile Outdated
ifeq ($(CONFIGURED_ARCH), armhf)
fakeroot make -f debian/rules.gen -j $(shell nproc) binary-arch_$(CONFIGURED_ARCH)_none_armmp
$(call dpkg-architecture-armhf) DO_DOCS=False fakeroot make -f debian/rules -j $(shell nproc) binary-indep
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can reduce multiple/else by.

  •   DO_DOCS=False ARCH=$(CONFIGURED_ARCH) DEB_HOST_ARCH=$(CONFIGURED_ARCH)  fakeroot make -f debian/rules -j $(shell nproc) binary-indep
    

Makefile Outdated
else
ifeq ($(CONFIGURED_ARCH), arm64)
$(call dpkg-architecture-arm64) DO_DOCS=False fakeroot make -f debian/rules -j $(shell nproc) binary-indep
$(call dpkg-architecture-arm64) fakeroot make -f debian/rules.gen -j $(shell nproc) binary-arch_$(CONFIGURED_ARCH)_none
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can reduce arch check if else by,
ARCH=$(CONFIGURED_ARCH) DEB_HOST_ARCH=$(CONFIGURED_ARCH) fakeroot make -f debian/rules.gen -j $(shell nproc) binary-arch_$(CONFIGURED_ARCH)_none

@antony-rheneus
Copy link
Contributor

can you check the build failure?

These changes rely on updates to the sonic-slave-buster.
in Azure/sonic-buildimage#4639
add:

# For march kernel compile
RUN apt-get install -y crossbuild-essential-amd64 \
        crossbuild-essential-arm64 \
        crossbuild-essential-armhf

multi-arch docker usage is to get rid of cross compilation. without cross building multi-arch uses native(ARM) (not the host) gcc tools

@antony-rheneus
Copy link
Contributor

I would rather propose below change.

@@ -74,13 +74,13 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
        debian/bin/gencontrol.py

        # generate linux build file for amd64_none_amd64
-       # fakeroot make -f debian/rules.gen setup_armhf_none_armmp
-       # fakeroot make -f debian/rules.gen setup_arm64_none
-       fakeroot make -f debian/rules.gen setup_amd64_none_amd64
+       fakeroot make -f debian/rules.gen DEB_HOST_ARCH=armhf setup_armhf_none_armmp
+       fakeroot make -f debian/rules.gen DEB_HOST_ARCH=arm64 setup_arm64_none
+       fakeroot make -f debian/rules.gen DEB_HOST_ARCH=amd64 setup_amd64_none_amd64

        # Applying patches and configuration changes
-       # git add debian/build/build_armhf_none_armmp/.config -f
-       # git add debian/build/build_arm64_none_arm64/.config -f
+       git add debian/build/build_armhf_none_armmp/.config -f
+       git add debian/build/build_arm64_none_arm64/.config -f
        git add debian/build/build_amd64_none_amd64/.config -f
        git add debian/config.defines.dump -f
        git add debian/control -f
@@ -93,9 +93,9 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
        stg import -s ../patch/series

        # Building a custom kernel from Debian kernel source
-       DO_DOCS=False fakeroot make -f debian/rules -j $(shell nproc) binary-indep
+       DO_DOCS=False ARCH=$(CONFIGURED_ARCH) DEB_HOST_ARCH=$(CONFIGURED_ARCH) fakeroot make -f debian/rules -j $(shell nproc) binary-indep
 ifeq ($(CONFIGURED_ARCH), armhf)
-       fakeroot make -f debian/rules.gen -j $(shell nproc) binary-arch_$(CONFIGURED_ARCH)_none_armmp
+       ARCH=$(CONFIGURED_ARCH) DEB_HOST_ARCH=$(CONFIGURED_ARCH) fakeroot make -f debian/rules.gen -j $(shell nproc) binary-arch_$(CONFIGURED_ARCH)_none_armmp
 else
-       fakeroot make -f debian/rules.gen -j $(shell nproc) binary-arch_$(CONFIGURED_ARCH)_none
+		ARCH=$(CONFIGURED_ARCH) DEB_HOST_ARCH=$(CONFIGURED_ARCH) fakeroot make -f debian/rules.gen -j $(shell nproc) binary-arch_$(CONFIGURED_ARCH)_none

 endif

@lguohan
Copy link
Contributor

lguohan commented May 27, 2020

@taocy001 , can you look at the suggestion from @antony-rheneus

@taocy001
Copy link
Contributor Author

I would rather propose below change.


@@ -74,13 +74,13 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :

        debian/bin/gencontrol.py



        # generate linux build file for amd64_none_amd64

-       # fakeroot make -f debian/rules.gen setup_armhf_none_armmp

-       # fakeroot make -f debian/rules.gen setup_arm64_none

-       fakeroot make -f debian/rules.gen setup_amd64_none_amd64

+       fakeroot make -f debian/rules.gen DEB_HOST_ARCH=armhf setup_armhf_none_armmp

+       fakeroot make -f debian/rules.gen DEB_HOST_ARCH=arm64 setup_arm64_none

+       fakeroot make -f debian/rules.gen DEB_HOST_ARCH=amd64 setup_amd64_none_amd64



        # Applying patches and configuration changes

-       # git add debian/build/build_armhf_none_armmp/.config -f

-       # git add debian/build/build_arm64_none_arm64/.config -f

+       git add debian/build/build_armhf_none_armmp/.config -f

+       git add debian/build/build_arm64_none_arm64/.config -f

        git add debian/build/build_amd64_none_amd64/.config -f

        git add debian/config.defines.dump -f

        git add debian/control -f

@@ -93,9 +93,9 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :

        stg import -s ../patch/series



        # Building a custom kernel from Debian kernel source

-       DO_DOCS=False fakeroot make -f debian/rules -j $(shell nproc) binary-indep

+       DO_DOCS=False ARCH=$(CONFIGURED_ARCH) DEB_HOST_ARCH=$(CONFIGURED_ARCH) fakeroot make -f debian/rules -j $(shell nproc) binary-indep

 ifeq ($(CONFIGURED_ARCH), armhf)

-       fakeroot make -f debian/rules.gen -j $(shell nproc) binary-arch_$(CONFIGURED_ARCH)_none_armmp

+       ARCH=$(CONFIGURED_ARCH) DEB_HOST_ARCH=$(CONFIGURED_ARCH) fakeroot make -f debian/rules.gen -j $(shell nproc) binary-arch_$(CONFIGURED_ARCH)_none_armmp

 else

-       fakeroot make -f debian/rules.gen -j $(shell nproc) binary-arch_$(CONFIGURED_ARCH)_none

+		ARCH=$(CONFIGURED_ARCH) DEB_HOST_ARCH=$(CONFIGURED_ARCH) fakeroot make -f debian/rules.gen -j $(shell nproc) binary-arch_$(CONFIGURED_ARCH)_none



 endif

This should be a better way to modify it.

@lguohan
Copy link
Contributor

lguohan commented May 27, 2020

thanks, can you update the pr then?

@taocy001
Copy link
Contributor Author

thanks, can you update the pr then?

Ok, I'll update the PR after reworking and testing.

@taocy001
Copy link
Contributor Author

@lguohan @antony-rheneus
updated, please review.

@lguohan lguohan merged commit f07f74f into sonic-net:master May 30, 2020
@taocy001 taocy001 deleted the arm64_buster_build branch June 3, 2020 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants