[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Guix on the MNT Reform
From: |
Fredrik Salomonsson |
Subject: |
Re: Guix on the MNT Reform |
Date: |
Mon, 06 Sep 2021 19:37:28 +0000 |
Christine Lemmer-Webber <cwebber@dustycloud.org> writes:
>> Cool! Hope it gets up and running soon.
Thanks, I got it running somewhat. My batteries are still a bit messed
up after I accidentally let it drain them too low. I ordered a battery
charger so hopefully I can get them in great shape again.
>> In the meanwhile, some local notes...
>>
>> It looks like the relevant info to get going is here:
>>
>> https://mntre.com/reform2/handbook/advanced.html#system-boot
>>
>> There's a script to compile a custom u-boot:
>>
>>
>> https://source.mnt.re/reform/reform-system-image/-/blob/main/reform2-imx8mq/mkuboot.sh
>>
>> #+BEGIN_SRC bash
>> if [ ! -d u-boot ]
>> then
>> echo "Cloning U-Boot..."
>> git clone --depth 1 https://source.mnt.re/reform/reform-boundary-uboot.git
>> u-boot
>> fi
>>
>> cd u-boot
>> cp mntreform-config .config
>>
>> export CROSS_COMPILE=aarch64-linux-gnu-
>> export ARCH=arm
>>
>> # build rescue u-boot first (loads kernel from eMMC)
>> make -j$(nproc) flash.bin KCPPFLAGS='-DMNTREFORM_BOOT_EMMC'
>> cp flash.bin flash-rescue.bin
>>
>> # build normal u-boot second (loads kernel from SD card)
>> make -j$(nproc) flash.bin
>>
>> cd ..
>> #+END_SRC
>>
>> So that doesn't look to complicated.
>>
>> Here's the custom u-boot:
>>
>> https://source.mnt.re/reform/reform-boundary-uboot
>>
>> It says:
>>
>> "Fork of the vendor (Boundary Devices) u-boot for Reform 2, with
>> minor tweaks. The goal is to migrate to mainstream u-boot or barebox
>> ASAP. The main impediment so far is the 4GB RAM config."
>>
>> So we probably want to make a u-boot-mnt-reform in
>> gnu/packages/bootloaders.scm
>>
>> So we probably want to use "guix system image" and then add:
>>
>> gnu/system/images/mnt-reform.scm
>>
>> Ideally in the end we should be able to do:
>>
>> guix system image --image-type=mnt-reform my-os.scm
>>
>> So yeah, the rest of the pieces to figuring it out seem to be all here:
>>
>> https://mntre.com/reform2/handbook/advanced.html#system-boot
>>
>> It *seems* like this should all be possible...
>>
>> - Christine
Thanks for the notes! I've just been poking around in the guix source
code to get a grasp how it works plus reading the Guix on an ARM Board
by Julien Lepiller [0]
[0] https://guix.gnu.org/blog/2019/guix-on-an-arm-board/
>
> Here's the progress I've made so far:
>
> #+BEGIN_SRC diff
> diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
> index 2889a90d54..17a7abc657 100644
> --- a/gnu/packages/bootloaders.scm
> +++ b/gnu/packages/bootloaders.scm
> @@ -953,6 +953,38 @@ to Novena upstream, does not load u-boot.img from the
> first partition.")
> `(("firmware" ,arm-trusted-firmware-rk3399)
> ,@(package-native-inputs base))))))
>
> +(define-public u-boot-mnt-reform2
> + (let ((base (make-u-boot-package "mnt-reform2" "aarch64-linux-gnu"))
> + (commit "bdcdce7434b9db19aabd59181014f24d66af0db8"))
> + (package
> + (inherit base)
> + (version "2021.06")
> + (name "u-boot-mnt-reform2")
> + (source (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url
> "https://source.mnt.re/reform/reform-boundary-uboot.git")
> + (commit commit)))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32
> + "1pwmcaaxx5zvn26gznwz4rjki4w3wwfzdnipxfr7d8067fmwgjp3"))))
> + (arguments
> + (substitute-keyword-arguments (package-arguments base)
> + ((#:phases phases)
> + `(modify-phases ,phases
> + (replace 'configure
> + (lambda _
> + (copy-file "mntreform-config" ".config")))
> +
> + ;; Phases do not succeed on the bl31 ELF.
> + #;(delete 'strip)
> + #;(delete 'validate-runpath)))))
> + #;(native-inputs
> + `(("firmware" ,arm-trusted-firmware-rk3399)
> + ,@(package-native-inputs base))))
> + ))
> +
> (define-public vboot-utils
> (package
> (name "vboot-utils")
> #+END_SRC
>
> However, I hit this error when trying to compile:
>
> #+BEGIN_VERBATIM
> starting phase `build'
> HOSTCC scripts/basic/fixdep
> In file included from
> /gnu/store/dj05znzsk7fq43zj5r719ll8ldgh9xxi-u-boot-mnt-reform2-2021.06-checkout/include/stdlib.h:9:0,
> from scripts/basic/fixdep.c:112:
> /gnu/store/dj05znzsk7fq43zj5r719ll8ldgh9xxi-u-boot-mnt-reform2-2021.06-checkout/include/malloc.h:875:22:
> error: missing binary operator before token "("
> #if CONFIG_IS_ENABLED(SYS_MALLOC_SIMPLE)
> ^
> In file included from scripts/basic/fixdep.c:113:0:
> /gnu/store/dj05znzsk7fq43zj5r719ll8ldgh9xxi-u-boot-mnt-reform2-2021.06-checkout/include/stdio.h:18:14:
> error: expected declaration specifiers or '...' before numeric constant
> int __printf(1, 2) printf(const char *fmt, ...);
> ^
> /gnu/store/dj05znzsk7fq43zj5r719ll8ldgh9xxi-u-boot-mnt-reform2-2021.06-checkout/include/stdio.h:18:17:
> error: expected declaration specifiers or '...' before numeric constant
> int __printf(1, 2) printf(const char *fmt, ...);
> ^
> /gnu/store/dj05znzsk7fq43zj5r719ll8ldgh9xxi-u-boot-mnt-reform2-2021.06-checkout/include/stdio.h:53:14:
> error: expected declaration specifiers or '...' before numeric constant
> int __printf(2, 3) fprintf(int file, const char *fmt, ...);
> ^
> /gnu/store/dj05znzsk7fq43zj5r719ll8ldgh9xxi-u-boot-mnt-reform2-2021.06-checkout/include/stdio.h:53:17:
> error: expected declaration specifiers or '...' before numeric constant
> int __printf(2, 3) fprintf(int file, const char *fmt, ...);
> ^
> scripts/basic/fixdep.c: In function 'usage':
> scripts/basic/fixdep.c:130:2: warning: implicit declaration of function
> 'fprintf' [-Wimplicit-function-declaration]
> fprintf(stderr, "Usage: fixdep <depfile> <target> <cmdline>\n");
> ^~~~~~~
> scripts/basic/fixdep.c:130:2: warning: incompatible implicit declaration of
> built-in function 'fprintf'
> scripts/basic/fixdep.c:130:2: note: include '<stdio.h>' or provide a
> declaration of 'fprintf'
> scripts/basic/fixdep.c:130:10: warning: passing argument 1 of 'fprintf' makes
> pointer from integer without a cast [-Wint-conversion]
> fprintf(stderr, "Usage: fixdep <depfile> <target> <cmdline>\n");
> ^~~~~~
> scripts/basic/fixdep.c:130:10: note: expected 'void *' but argument is of
> type 'int'
> scripts/basic/fixdep.c:131:2: warning: implicit declaration of function
> 'exit' [-Wimplicit-function-declaration]
> exit(1);
> ^~~~
> scripts/basic/fixdep.c:131:2: warning: incompatible implicit declaration of
> built-in function 'exit'
> scripts/basic/fixdep.c:131:2: note: include '<stdlib.h>' or provide a
> declaration of 'exit'
> scripts/basic/fixdep.c: In function 'print_cmdline':
> scripts/basic/fixdep.c:139:2: warning: implicit declaration of function
> 'printf' [-Wimplicit-function-declaration]
> printf("cmd_%s := %s\n\n", target, cmdline);
> ^~~~~~
> scripts/basic/fixdep.c:139:2: warning: incompatible implicit declaration of
> built-in function 'printf'
> scripts/basic/fixdep.c:139:2: note: include '<stdio.h>' or provide a
> declaration of 'printf'
> scripts/basic/fixdep.c: In function 'define_config':
> scripts/basic/fixdep.c:185:3: warning: implicit declaration of function
> 'perror'; did you mean 'strerror'? [-Wimplicit-function-declaration]
> perror("fixdep:malloc");
> ^~~~~~
> strerror
> scripts/basic/fixdep.c:186:3: warning: incompatible implicit declaration of
> built-in function 'exit'
> exit(1);
> ^~~~
> scripts/basic/fixdep.c:186:3: note: include '<stdlib.h>' or provide a
> declaration of 'exit'
> scripts/basic/fixdep.c: In function 'use_config':
> scripts/basic/fixdep.c:208:2: warning: incompatible implicit declaration of
> built-in function 'printf'
> printf(" $(wildcard include/config/");
> ^~~~~~
> scripts/basic/fixdep.c:208:2: note: include '<stdio.h>' or provide a
> declaration of 'printf'
> scripts/basic/fixdep.c:215:3: warning: implicit declaration of function
> 'putchar' [-Wimplicit-function-declaration]
> putchar(c);
> ^~~~~~~
> scripts/basic/fixdep.c: In function 'do_config_file':
> scripts/basic/fixdep.c:302:3: warning: incompatible implicit declaration of
> built-in function 'fprintf'
> fprintf(stderr, "fixdep: error opening config file: ");
> ^~~~~~~
> scripts/basic/fixdep.c:302:3: note: include '<stdio.h>' or provide a
> declaration of 'fprintf'
> scripts/basic/fixdep.c:302:11: warning: passing argument 1 of 'fprintf' makes
> pointer from integer without a cast [-Wint-conversion]
> fprintf(stderr, "fixdep: error opening config file: ");
> ^~~~~~
> scripts/basic/fixdep.c:302:11: note: expected 'void *' but argument is of
> type 'int'
> scripts/basic/fixdep.c:304:3: warning: incompatible implicit declaration of
> built-in function 'exit'
> exit(2);
> ^~~~
> scripts/basic/fixdep.c:304:3: note: include '<stdlib.h>' or provide a
> declaration of 'exit'
> scripts/basic/fixdep.c:307:3: warning: incompatible implicit declaration of
> built-in function 'fprintf'
> fprintf(stderr, "fixdep: error fstat'ing config file: ");
> ^~~~~~~
> scripts/basic/fixdep.c:307:3: note: include '<stdio.h>' or provide a
> declaration of 'fprintf'
> scripts/basic/fixdep.c:307:11: warning: passing argument 1 of 'fprintf' makes
> pointer from integer without a cast [-Wint-conversion]
> fprintf(stderr, "fixdep: error fstat'ing config file: ");
> ^~~~~~
> scripts/basic/fixdep.c:307:11: note: expected 'void *' but argument is of
> type 'int'
> scripts/basic/fixdep.c:309:3: warning: incompatible implicit declaration of
> built-in function 'exit'
> exit(2);
> ^~~~
> scripts/basic/fixdep.c:309:3: note: include '<stdlib.h>' or provide a
> declaration of 'exit'
> scripts/basic/fixdep.c: In function 'parse_dep_file':
> scripts/basic/fixdep.c:387:7: warning: incompatible implicit declaration of
> built-in function 'printf'
> printf("source_%s := %s\n\n",
> ^~~~~~
> scripts/basic/fixdep.c:387:7: note: include '<stdio.h>' or provide a
> declaration of 'printf'
> scripts/basic/fixdep.c:394:6: warning: incompatible implicit declaration of
> built-in function 'printf'
> printf(" %s \\\n", s);
> ^~~~~~
> scripts/basic/fixdep.c:394:6: note: include '<stdio.h>' or provide a
> declaration of 'printf'
> scripts/basic/fixdep.c:406:3: warning: incompatible implicit declaration of
> built-in function 'fprintf'
> fprintf(stderr, "fixdep: parse error; no targets found\n");
> ^~~~~~~
> scripts/basic/fixdep.c:406:3: note: include '<stdio.h>' or provide a
> declaration of 'fprintf'
> scripts/basic/fixdep.c:406:11: warning: passing argument 1 of 'fprintf' makes
> pointer from integer without a cast [-Wint-conversion]
> fprintf(stderr, "fixdep: parse error; no targets found\n");
> ^~~~~~
> scripts/basic/fixdep.c:406:11: note: expected 'void *' but argument is of
> type 'int'
> scripts/basic/fixdep.c:407:3: warning: incompatible implicit declaration of
> built-in function 'exit'
> exit(1);
> ^~~~
> scripts/basic/fixdep.c:407:3: note: include '<stdlib.h>' or provide a
> declaration of 'exit'
> scripts/basic/fixdep.c:410:2: warning: incompatible implicit declaration of
> built-in function 'printf'
> printf("\n%s: $(deps_%s)\n\n", target, target);
> ^~~~~~
> scripts/basic/fixdep.c:410:2: note: include '<stdio.h>' or provide a
> declaration of 'printf'
> scripts/basic/fixdep.c: In function 'print_deps':
> scripts/basic/fixdep.c:422:3: warning: incompatible implicit declaration of
> built-in function 'fprintf'
> fprintf(stderr, "fixdep: error opening depfile: ");
> ^~~~~~~
> scripts/basic/fixdep.c:422:3: note: include '<stdio.h>' or provide a
> declaration of 'fprintf'
> scripts/basic/fixdep.c:422:11: warning: passing argument 1 of 'fprintf' makes
> pointer from integer without a cast [-Wint-conversion]
> fprintf(stderr, "fixdep: error opening depfile: ");
> ^~~~~~
> scripts/basic/fixdep.c:422:11: note: expected 'void *' but argument is of
> type 'int'
> scripts/basic/fixdep.c:424:3: warning: incompatible implicit declaration of
> built-in function 'exit'
> exit(2);
> ^~~~
> scripts/basic/fixdep.c:424:3: note: include '<stdlib.h>' or provide a
> declaration of 'exit'
> scripts/basic/fixdep.c:427:3: warning: incompatible implicit declaration of
> built-in function 'fprintf'
> fprintf(stderr, "fixdep: error fstat'ing depfile: ");
> ^~~~~~~
> scripts/basic/fixdep.c:427:3: note: include '<stdio.h>' or provide a
> declaration of 'fprintf'
> scripts/basic/fixdep.c:427:11: warning: passing argument 1 of 'fprintf' makes
> pointer from integer without a cast [-Wint-conversion]
> fprintf(stderr, "fixdep: error fstat'ing depfile: ");
> ^~~~~~
> scripts/basic/fixdep.c:427:11: note: expected 'void *' but argument is of
> type 'int'
> scripts/basic/fixdep.c:429:3: warning: incompatible implicit declaration of
> built-in function 'exit'
> exit(2);
> ^~~~
> scripts/basic/fixdep.c:429:3: note: include '<stdlib.h>' or provide a
> declaration of 'exit'
> scripts/basic/fixdep.c:432:3: warning: incompatible implicit declaration of
> built-in function 'fprintf'
> fprintf(stderr,"fixdep: %s is empty\n",depfile);
> ^~~~~~~
> scripts/basic/fixdep.c:432:3: note: include '<stdio.h>' or provide a
> declaration of 'fprintf'
> scripts/basic/fixdep.c:432:11: warning: passing argument 1 of 'fprintf' makes
> pointer from integer without a cast [-Wint-conversion]
> fprintf(stderr,"fixdep: %s is empty\n",depfile);
> ^~~~~~
> scripts/basic/fixdep.c:432:11: note: expected 'void *' but argument is of
> type 'int'
> scripts/basic/fixdep.c: In function 'traps':
> scripts/basic/fixdep.c:456:3: warning: incompatible implicit declaration of
> built-in function 'fprintf'
> fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianness? %#x\n",
> ^~~~~~~
> scripts/basic/fixdep.c:456:3: note: include '<stdio.h>' or provide a
> declaration of 'fprintf'
> scripts/basic/fixdep.c:456:11: warning: passing argument 1 of 'fprintf' makes
> pointer from integer without a cast [-Wint-conversion]
> fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianness? %#x\n",
> ^~~~~~
> scripts/basic/fixdep.c:456:11: note: expected 'void *' but argument is of
> type 'int'
> scripts/basic/fixdep.c:458:3: warning: incompatible implicit declaration of
> built-in function 'exit'
> exit(2);
> ^~~~
> scripts/basic/fixdep.c:458:3: note: include '<stdlib.h>' or provide a
> declaration of 'exit'
> make[2]: *** [scripts/Makefile.host:97: scripts/basic/fixdep] Error 1
> make[1]: *** [Makefile:411: scripts_basic] Error 2
> make: *** No rule to make target 'include/config/auto.conf', needed by
> 'include/config/uboot.release'. Stop.
> command "make" "-j" "8" "HOSTCC=gcc" "CROSS_COMPILE=aarch64-linux-gnu-"
> failed with status 2
> note: keeping build directory
> `/tmp/guix-build-u-boot-mnt-reform2-2021.06.drv-1'
> builder for
> `/gnu/store/ahqnc7qa9mam5k6ycc61jw8df10af19m-u-boot-mnt-reform2-2021.06.drv'
> failed with exit code 1
> build of
> /gnu/store/ahqnc7qa9mam5k6ycc61jw8df10af19m-u-boot-mnt-reform2-2021.06.drv
> failed
> View build log at
> '/var/log/guix/drvs/ah/qnc7qa9mam5k6ycc61jw8df10af19m-u-boot-mnt-reform2-2021.06.drv.bz2'.
> guix build: error: build of
> `/gnu/store/ahqnc7qa9mam5k6ycc61jw8df10af19m-u-boot-mnt-reform2-2021.06.drv'
> failed
> #+END_VERBATIM
>
> I guess here's where my lack of knowledge of C-land is failing me.
>
> Any thoughts or ideas?
>
> - Christine
Sounds like the error:
> /gnu/store/dj05znzsk7fq43zj5r719ll8ldgh9xxi-u-boot-mnt-reform2-2021.06-checkout/include/malloc.h:875:22:
> error: missing binary operator before token "("
> #if CONFIG_IS_ENABLED(SYS_MALLOC_SIMPLE)
> ^
is due to the =CONFIG_IS_ENABLED= not being defined and causing the
preprocessor to error out.
And the second error:
> make: *** No rule to make target 'include/config/auto.conf', needed by
> 'include/config/uboot.release'. Stop.
might be a side effect from the first error.
I've applied your patch and get the same error so I'll do some digging
and see what I can find.
--
s/Fred[re]+i[ck]+/Fredrik/g
Re: Guix on the MNT Reform, Denis 'GNUtoo' Carikli, 2021/09/07
- Re: Guix on the MNT Reform, Christine Lemmer-Webber, 2021/09/07
- Re: Guix on the MNT Reform, Denis 'GNUtoo' Carikli, 2021/09/07
- Re: Guix on the MNT Reform, Christine Lemmer-Webber, 2021/09/08
- Re: Guix on the MNT Reform, Vagrant Cascadian, 2021/09/08
- Re: Guix on the MNT Reform, Christine Lemmer-Webber, 2021/09/08
- Re: Guix on the MNT Reform, Denis 'GNUtoo' Carikli, 2021/09/09