unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* How to run guix on replicant / android with linux 3.0?
@ 2019-02-16 21:51 Alex Vong
  2019-02-17  7:37 ` Julien Lepiller
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Vong @ 2019-02-16 21:51 UTC (permalink / raw)
  To: help-guix; +Cc: alexvong1995

[-- Attachment #1: Type: text/plain, Size: 3680 bytes --]

Hello,

I've a phone with replicant installed. It runs linux 3.0.x which is too
old for guix glibc (which requires linux 3.2.x). Using the hint at the
bottom of 'cross-base.scm', I successfully build cross-gcc with
cross-glibc 2.23 (configured with '--enable-kernel=3.0.0') for
armhf. Using them, I can cross-compile a statically linked hello world.

Is there an easy way to make relocatable guix pack with glibc 2.23
(configured with '--enable-kernel=3.0.0') for armhf? (My phone doesn't
connect to the internet, so I can't use 'guix pull' and 'guix
manifest'.) Right now, I have to manually set the '-B', '-I', '-L' and
'-sysroot' paths to cross-gcc to make it build hello world (which is
wrong and very tedious).

The snippet is copied below for reference, but please don't use it, it's
only a proof-of-concept. Thanks for help!

Cheers,
Alex


(use-modules (guix packages)
             (guix utils)
             (gnu packages)
             (gnu packages base)
             (gnu packages cross-base))


(let* ((triplet "arm-linux-gnueabihf")

       (cross-linux (@@ (gnu packages cross-base) cross-kernel-headers))
       (cross-linux* (cross-linux triplet))

       (cross-binutils* (cross-binutils triplet))
       
       (cross-glibc (cross-libc triplet))
       (cross-glibc-version "2.23")

       (cross-glibc*
        (package
          (inherit cross-glibc)
          (version cross-glibc-version)
          (source (origin
                    (inherit (package-source glibc))
                    (uri (string-append "mirror://gnu/glibc/glibc-"
                                        cross-glibc-version ".tar.xz"))
                    (sha256
                     (base32
                      "1s8krs3y2n6pzav7ic59dz41alqalphv7vww4138ag30wh0fpvwl"))
                    (patches
                     (search-patches "glibc-ldd-x86_64.patch"
                                     "glibc-versioned-locpath.patch"
                                     "glibc-vectorized-strcspn-guards.patch"
                                     "glibc-CVE-2015-5180.patch"
                                     "glibc-CVE-2016-3075.patch"
                                     "glibc-CVE-2016-3706.patch"
                                     "glibc-CVE-2016-4429.patch"
                                     "glibc-CVE-2017-1000366-pt1.patch"
                                     "glibc-CVE-2017-1000366-pt2.patch"
                                     "glibc-CVE-2017-1000366-pt3.patch"))
                    (modules '((guix build utils)))
                                  (snippet
                                   '(begin
                                      (substitute* "misc/regexp.c"
                                        (("char \\*loc1;")
                                         "char *loc1 __attribute__ ((nocommon));")
                                        (("char \\*loc2;")
                                         "char *loc2 __attribute__ ((nocommon));")
                                        (("char \\*locs;")
                                         "char *locs __attribute__ ((nocommon));"))
                                      #t))))
          (arguments
           (substitute-keyword-arguments
               (package-arguments cross-glibc)
             ((#:configure-flags flags)
              `(append ,flags (list "--enable-kernel=3.0.0")))))))

       (cross-gcc* (cross-gcc triplet
                              #:xbinutils (cross-binutils triplet)
                              #:libc cross-glibc*)))

  (list cross-linux* cross-binutils* cross-glibc* cross-gcc*))

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to run guix on replicant / android with linux 3.0?
  2019-02-16 21:51 How to run guix on replicant / android with linux 3.0? Alex Vong
@ 2019-02-17  7:37 ` Julien Lepiller
  2019-02-20 20:56   ` Alex Vong
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Lepiller @ 2019-02-17  7:37 UTC (permalink / raw)
  To: help-guix, Alex Vong

Le 16 février 2019 22:51:08 GMT+01:00, Alex Vong <alexvong1995@gmail.com> a écrit :
>Hello,
>
>I've a phone with replicant installed. It runs linux 3.0.x which is too
>old for guix glibc (which requires linux 3.2.x). Using the hint at the
>bottom of 'cross-base.scm', I successfully build cross-gcc with
>cross-glibc 2.23 (configured with '--enable-kernel=3.0.0') for
>armhf. Using them, I can cross-compile a statically linked hello world.
>
>Is there an easy way to make relocatable guix pack with glibc 2.23
>(configured with '--enable-kernel=3.0.0') for armhf? (My phone doesn't
>connect to the internet, so I can't use 'guix pull' and 'guix
>manifest'.) Right now, I have to manually set the '-B', '-I', '-L' and
>'-sysroot' paths to cross-gcc to make it build hello world (which is
>wrong and very tedious).
>
>The snippet is copied below for reference, but please don't use it,
>it's
>only a proof-of-concept. Thanks for help!
>
>Cheers,
>Alex
>
>
>(use-modules (guix packages)
>             (guix utils)
>             (gnu packages)
>             (gnu packages base)
>             (gnu packages cross-base))
>
>
>(let* ((triplet "arm-linux-gnueabihf")
>
>      (cross-linux (@@ (gnu packages cross-base) cross-kernel-headers))
>       (cross-linux* (cross-linux triplet))
>
>       (cross-binutils* (cross-binutils triplet))
>       
>       (cross-glibc (cross-libc triplet))
>       (cross-glibc-version "2.23")
>
>       (cross-glibc*
>        (package
>          (inherit cross-glibc)
>          (version cross-glibc-version)
>          (source (origin
>                    (inherit (package-source glibc))
>                    (uri (string-append "mirror://gnu/glibc/glibc-"
>                                        cross-glibc-version ".tar.xz"))
>                    (sha256
>                     (base32
>               "1s8krs3y2n6pzav7ic59dz41alqalphv7vww4138ag30wh0fpvwl"))
>                    (patches
>                     (search-patches "glibc-ldd-x86_64.patch"
>                                     "glibc-versioned-locpath.patch"
>                                "glibc-vectorized-strcspn-guards.patch"
>                                     "glibc-CVE-2015-5180.patch"
>                                     "glibc-CVE-2016-3075.patch"
>                                     "glibc-CVE-2016-3706.patch"
>                                     "glibc-CVE-2016-4429.patch"
>                                     "glibc-CVE-2017-1000366-pt1.patch"
>                                     "glibc-CVE-2017-1000366-pt2.patch"
>                                   "glibc-CVE-2017-1000366-pt3.patch"))
>                    (modules '((guix build utils)))
>                                  (snippet
>                                   '(begin
>                                      (substitute* "misc/regexp.c"
>                                        (("char \\*loc1;")
>                              "char *loc1 __attribute__ ((nocommon));")
>                                        (("char \\*loc2;")
>                              "char *loc2 __attribute__ ((nocommon));")
>                                        (("char \\*locs;")
>                             "char *locs __attribute__ ((nocommon));"))
>                                      #t))))
>          (arguments
>           (substitute-keyword-arguments
>               (package-arguments cross-glibc)
>             ((#:configure-flags flags)
>              `(append ,flags (list "--enable-kernel=3.0.0")))))))
>
>       (cross-gcc* (cross-gcc triplet
>                              #:xbinutils (cross-binutils triplet)
>                              #:libc cross-glibc*)))
>
>  (list cross-linux* cross-binutils* cross-glibc* cross-gcc*))

Hi,

I think I read somewhere (in the manual?) that you need a kernel 3.19 or greater to be able to use a relocatable guix pack. Since you're root on your phone though, you should be able to use a normal pack.

Maybe with inferiors you can use an older version of guix that works with your kernel?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to run guix on replicant / android with linux 3.0?
  2019-02-17  7:37 ` Julien Lepiller
@ 2019-02-20 20:56   ` Alex Vong
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Vong @ 2019-02-20 20:56 UTC (permalink / raw)
  To: Julien Lepiller; +Cc: help-guix, alexvong1995

[-- Attachment #1: Type: text/plain, Size: 876 bytes --]

Hello Julien,

Julien Lepiller <julien@lepiller.eu> writes:

[...]
>
> Hi,
>
> I think I read somewhere (in the manual?) that you need a kernel 3.19
> or greater to be able to use a relocatable guix pack. Since you're
> root on your phone though, you should be able to use a normal pack.
>
I've checked the manual, it says:
  Note: The ‘--container’ option requires Linux-libre 3.19 or newer.

I don't know how it's related to relocatable guix pack though.

> Maybe with inferiors you can use an older version of guix that works
> with your kernel?

I haven't tried inferiors before, will read the manual.

For the record, I find out that replicant maybe able to run the mainline
kernel in the future: <https://redmine.replicant.us/issues/1882>.
This should solve the 'FATAL: kernel too old' problem without me having
to cross-compile old glibc.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-20 20:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-16 21:51 How to run guix on replicant / android with linux 3.0? Alex Vong
2019-02-17  7:37 ` Julien Lepiller
2019-02-20 20:56   ` Alex Vong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).