[BPI-R2] Kernel Development

You need to set arch and your crosscompiler (which does build.sh to ubuntus linaro toolchain) and import defconfig before running make (modules/…)

export ARCH=arm;export CROSS_COMPILE='ccache arm-linux-gnueabihf-'
make mt7623n_evb_fwu_defconfig

I understand this, but I am following a different method cause I want to compile it along with package it to be directly installed using ‘pacman’ while making a bootable image.

I hope you understand. The method I have to follow is a bit different.

Even if I follow the method you have advised it will still ask all the questions before compiling, is that correct?

i understand that your process is different, but you need to set arch and your crosscompiler if you not compile on r2 directly or an armv7-machine (like in qemu,vbox,…)

and if you import the defconfig (make-line i’ve posted) you should not get any questions on “compile-make”, else you will not get the desired result

the generic flow is:

make clean/mrproper (optionally)
make <defconfig file> / make oldconfig (if you have valid .config for your device)
make menuconfig (optionally if you want to change options interactively)
make
make modules
make modules_install (maybe with modules-target set by env-variable)

Ok to make things clear, I am using spawn into the armv7 rootfs using qemu and compiling through it.

Spawn is similar to chroot.

Ok I will follow this on the spawn and see how it reacts. Maybe I am missing something here.

I will try adding ‘make .config’ before ‘make modules’ and report back to you.

Thanks for the quick replies

make .config does not make sense if your .config is wrong (actual configuration where you got asked)

Then how can I solve it ? I am bit confused now :frowning:

like i’ve posted above

this sets correct settings and activates all modules which are set in my prebuild kernels

Ok So I am using this as follows

cat "$(srcdir)/config" > ./.config 
make prepare
make mt7623n_evb_fwu_defconfig
make uImage modules dtbs

Hope I am doing it correct now?

imho only step 3 and 4 are needed…what does prepare?

This commands simply prepare the sources for compilation. It is there is all the Arch Linux Kernel Package PKGBUILD. I am just following the standard practice.

I think I understood it now. Thanks again for your patience and effort to help me understand the R2 build method.

Trying to test this now just will terminate it if it starts compiling without asking the questions. Will do it properly at night with proper cooling :stuck_out_tongue:

Edit: I am still getting the questions :frowning: here

inux-bpir2-5.4.0-0.1]$ makepkg -sc --noconfirm
==> Making package: linux-bpir2-5.4.0-0.1 5.4.0-0.1 (Fri Oct 18 13:39:08 2019)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Found BPI-R2-4.14-d82866fdb13cb0ff8997ea36b19b8967eb8268c7.tar.gz
  -> Found config
  -> Found linux.preset
  -> Found bpi-r2-sd-boot1m-2019.img
  -> Found 60-linux.hook
  -> Found 90-linux.hook
  -> Found 91-uInitrd.hook
==> Validating source files with md5sums...
    BPI-R2-4.14-d82866fdb13cb0ff8997ea36b19b8967eb8268c7.tar.gz ... Skipped
    config ... Skipped
    linux.preset ... Skipped
    bpi-r2-sd-boot1m-2019.img ... Skipped
    60-linux.hook ... Skipped
    90-linux.hook ... Skipped
    91-uInitrd.hook ... Skipped
==> Extracting sources...
  -> Extracting BPI-R2-4.14-d82866fdb13cb0ff8997ea36b19b8967eb8268c7.tar.gz with bsdtar
==> Starting prepare()...
==> Removing existing $pkgdir/ directory...
==> Starting build()...
scripts/kconfig/conf  --syncconfig Kconfig
*
* Restart config...
*
*
* General setup
*
Compile also drivers which will not load (COMPILE_TEST) [N/y/?] (NEW) n
Compile test headers that should be standalone compilable (HEADER_TEST) [N/y/?] (NEW) n
Local version - append to kernel release (LOCALVERSION) [-Arch-bpi-r2] -Arch-bpi-r2
Automatically append version information to the version string (LOCALVERSION_AUTO) [N/y/?] n
Build ID Salt (BUILD_SALT) [] (NEW) 
Kernel compression mode
> 1. Gzip (KERNEL_GZIP) (NEW)
  2. LZMA (KERNEL_LZMA) (NEW)
  3. XZ (KERNEL_XZ) (NEW)
  4. LZO (KERNEL_LZO) (NEW)
  5. LZ4 (KERNEL_LZ4) (NEW)
choice[1-5?]: 
Default hostname (DEFAULT_HOSTNAME) [(none)] (NEW) BPI-R2
Support for paging of anonymous memory (swap) (SWAP) [Y/n/?] (NEW) n
System V IPC (SYSVIPC) [Y/n/?] y
POSIX Message Queues (POSIX_MQUEUE) [Y/n/?] y
Enable process_vm_readv/writev syscalls (CROSS_MEMORY_ATTACH) [Y/n/?] (NEW) n
uselib syscall (USELIB) [N/y/?] (NEW) n
Auditing support (AUDIT) [N/y/?] (NEW) n
*
* IRQ subsystem
*
Expose irq internals in debugfs (GENERIC_IRQ_DEBUGFS) [N/y/?] (NEW) n
*
* Timers subsystem
*
Timer tick handling
  1. Periodic timer ticks (constant rate, no dynticks) (HZ_PERIODIC) (NEW)
> 2. Idle dynticks system (tickless idle) (NO_HZ_IDLE) (NEW)
  3. Full dynticks system (tickless) (NO_HZ_FULL) (NEW)
choice[1-3?]: 
Old Idle dynticks config (NO_HZ) [Y/n/?] y
High Resolution Timer Support (HIGH_RES_TIMERS) [Y/n/?] y
Preemption Model
> 1. No Forced Preemption (Server) (PREEMPT_NONE) (NEW)
  2. Voluntary Kernel Preemption (Desktop) (PREEMPT_VOLUNTARY) (NEW)
  3. Preemptible Kernel (Low-Latency Desktop) (PREEMPT) (NEW)
choice[1-3?]: 
*
* CPU/Task time and stats accounting
*
Cputime accounting
> 1. Simple tick based cputime accounting (TICK_CPU_ACCOUNTING) (NEW)
  2. Full dynticks CPU time accounting (VIRT_CPU_ACCOUNTING_GEN) (NEW)
choice[1-2?]: 
Fine granularity task level IRQ time accounting (IRQ_TIME_ACCOUNTING) [N/y/?] (NEW) n
BSD Process Accounting (BSD_PROCESS_ACCT) [N/y/?] (NEW) n
Export task/process statistics through netlink (TASKSTATS) [N/y/?] (NEW) n
Pressure stall information tracking (PSI) [N/y/?] (NEW) n
CPU isolation (CPU_ISOLATION) [Y/n/?] (NEW) y
*
* RCU Subsystem
*
Make expert-level adjustments to RCU configuration (RCU_EXPERT) [N/y/?] (NEW) 

What is the issue here?

defconfig is not imported…config starts from clean…

Well, I am using the defconfig file as config which is copied to ./.config Isnt it the right way ?

afair then you need to use make oldconfig…i prefer the “make defconfigfile” way

I tried make oldconfig and its still the same :frowning:

I am using

make clean/mrproper
make prepare
#make mt7623n_evb_fwu_defconfig
make oldconfig

But still the questions are coming

Why not using make defconfigfile? Or at least trying it?

I thought either make mt7623n_evb_fwu_defconfig or make oldconfig is needed so I commented it out. Ok I tried enabling it and still it restarts the config and I have to answer the questions.

I cant get what I am doing wrong in here.

is arch set right in your vm?

what if you try running it manually before building a script around?

echo $ARCH
make mt7623n_evb_fwu_defconfig
make
1 Like

I am using the Arch Linux for R2 in my SD Card, booted into R2 to complete the installation and plugged it back into my laptop and Spawned into, So I am sure I am on Armv7h

This runs fine without any issue, I will clean my script and see what I am doing wrong.

Thanks for the advice. I think it was the make prepare I commented it out and now its fine. I will put it to compile in next few hours. Also I am not going to compile it with Lima enabled as I don’t it to fail in my first try.

If you want me to try with lima then I can try after the first attempt.

Thanks.

you are on a armv7 machine that does not mean that ARCH-environment-variable is set right, and that may cause defconfig failes to import

but if it now works you can continue :slight_smile:

and yes lima should be tested by someone who knows lima/mesa (i’m not experienced in that)

I will try this for you.

I appreciate your patience and helping noob developers with their issues :smiley:, as I was going through the BPI R2 as router configuration on Linux thread. Thanks