Jump to content

How to build my own image or kernel?


Recommended Posts

Preparation

 

Supported build environment is Ubuntu Focal 20.04 x64 (minimal iso image).

 

  • a guest inside a VirtualBox or other virtualization software,
  • a guest managed by Vagrant . This uses Virtualbox (as above) but does so in an easily repeatable way. Please check the Armbian with Vagrant README for a quick start HOWTO,
  • inside a Docker ,  systemd-nspawn  or other container environments (example),
  • running natively on a dedicated PC or a server (not recommended),
  • 20GB disk space or more and 2GB RAM or more available for the VM, container or native OS,
  • superuser rights (configured  sudo  or root access).
     
Execution
apt-get -y install git
git clone https://github.com/armbian/build
cd build
./compile.sh

This will download all necessary sources, execute compilation and/or build a boot-able image. Most of things will be cached so next run will be extremely faster!


Real time examples:
 

 

 

 

 

Link to comment
Share on other sites

Hi Igor!

Great thank for your jobs!

I have Banana pi,which sucseefully use mini home server with jessie .

Recently i ll get Cubieboard 4 -A80 ,and try to upgrade kernel on DebianServer to desctop,because it not possible set up any Gui on it, ask ubgrade kernel.

Can you advice me?Is it any specific function on processor A-80 ?

Sorry for english...

Link to comment
Share on other sites

Cubieboard 4 / Allwinner A80 is in general poorly supported. By manufacturer and community. There is only one old development kernel source (from Android?) to work with and some basic support in mainline kernel.

 

My progress with CB4 is minor so can't support.

 

For now.

 

The best what I saw on CB4 is this image:

http://dl.cubieboard.org/model/cc-a80/Image/ubuntu-linaro/ubuntu-linaro-v1.0/

Link to comment
Share on other sites

Hi

 

Thank you so much for this work! It helped me a lot for building my system with the Udoo. The original image was simply bad.

I am using the next 4.0 kernel from patrykk which works fine.

 

I got lost in your scripts when I tried modifying them to compile patrykk's 3.18.3 kernel.

Where do I have to change what to compile/checkout a specific tag (e.g. v3.18.3) instead of using the newest master, 4.0 branch?

 

The kernel tag in the compile.sh script does not work for the next option (as you mention in the comment).

 

cheers!

Link to comment
Share on other sites

You need to use one of the exiting tags.

https://github.com/patrykk/linux-udoo

 

Go to branch, select TAGS and you'll see what are possible tags.

v3.18.3 does not exist, but v3.18.13, v4.0.0., ..

 

If setting doesn't work trough my script, do it manually. I can check / fix later in the evening / tomorrow morning. 

 

Cheers.  :beer:

Link to comment
Share on other sites

Yep, that is what I did (my example above was incorrect). Here the adapted config from the compile script:

# method
KERNEL_ONLY="yes"                            # build kernel only
SOURCE_COMPILE="yes"                        # force source compilation
KERNEL_CONFIGURE="yes"                       # change default configuration
KERNEL_CLEAN="yes"                          # MAKE clean before compilation
USEALLCORES="yes"                           # Use all CPU cores
BUILD_DESKTOP="yes"                          # desktop with hw acceleration for some boards 

# user 
DEST_LANG="en_US.UTF-8"                     # sl_SI.UTF-8, en_US.UTF-8
CONSOLE_CHAR="UTF-8"                        # console charset
TZDATA="Europe/Berlin"                   # time zone
ROOTPWD="1234"                              # forced to change @first login
SDSIZE="1500"                               # SD image size in MB
AFTERINSTALL=""                             # command before closing image 
MAINTAINER="Igor Pecovnik"                  # deb signature
MAINTAINERMAIL="igor.pecovnik@****l.com"    # deb signature
GPG_PASS=""                                 # set GPG password for non-interactive packing

# advanced
KERNELTAG="v3.18.13"                         # kernel TAG - valid only for mainline
UBOOTTAG="v2015.04"                         # kernel TAG - valid for all sunxi
FBTFT="yes"                                 # https://github.com/notro/fbtft 
EXTERNAL="yes"                              # compile extra drivers
FORCE="yes"                                 # ignore manual changes to source

If I did not mess around somewhere else, this does not work and the tag is ignored. I get a 4.0 kernel being checked out.

Link to comment
Share on other sites

Unfortunately no. A31 has only one kernel which needs a lot of re-work to become standard which is necessary for my script. Even if this is done the end result will be poor. Kernel is old and buggy, A31 hardware is abandoned and not many people work on the kernel if any.

There is basic support in mainline kernel (kernel.org, I think 3.19 and newer). I could boot it but not even SD card was operational ... so I abandon the project and maybe in the autumn I'll try again and rework the board configuration, together with H3 and A80.

Link to comment
Share on other sites

H3 is in the same position.

 

There is no community support (yet) for kernel 3.4.x which means you need to use previously mentioned (Official) Allwinner SDK. Current result is poor so I don't want to build images using that kernel. Way too much bugs for a single person or a small group to fix and support.

 

For mainline kernel (kernel.org) there are some patches for basic functionality but haven't got time to test.
https://patchwork.ozlabs.org/project/devicetree-bindings/list/?submitter=65627

Link to comment
Share on other sites

Igor.

 

What is the way CSI camers is supported?

Is it the kernel module or userspace driver?

 

Do I have to rebuild kernel for my device to use CSI camera and use CedarX video encoder accelerator?

Thank you.

Yaroslav.

Link to comment
Share on other sites

If you are asking for OrangePi+ ... no idea.

 

For others.

 

No need to rebuild kernel, many camera modules are build as modules at least with kernel 3.4.x 

I was playing a little with Bananas CSI camera but that's about it. Not my field of interest.

 

http://wiki.lemaker.org/BananaPro/Pi:Camera_Module

 

Results was average.

Link to comment
Share on other sites

Igor. Thank you for the build script.

I've got this error when starting the compile.sh script for OrangePI:

[ ok ] Downloading u-boot
Cloning into '/home/user/output/u-boot'...
fatal: unable to connect to git.denx.de:
git.denx.de[0: 85.214.87.163]: errno=Connection refused

while http://git.denx.de/u-boot.git is seen in the browser

git clone git://git.denx.de/u-boot.git doesn't work either
What could be wrong here?
 
I was also asked about
modified gmac driver for Bananapi (GMAC_FOR_BANANAPI) [N/y/?] (NEW)
Preclaim OSS device numbers (SOUND_OSS_CORE_PRECLAIM) [Y/n/?] (NEW)

and some other questions related to SOUND, MIDI etc. Shoul I always answer with default values to have same functionality as your OrangePI image have?

 
 
Link to comment
Share on other sites

fatal: unable to connect to git.denx.de:

git.denx.de[0: 85.214.87.163]: errno=Connection refused

 

It looks like an (rear) server issue. I'll add some extra security checks here to prevent this happen.

modified gmac driver for Bananapi (GMAC_FOR_BANANAPI)

This is mandatory to enable for BananaPi, R1 and Orange.

 

The rest leave default / ignore.

Link to comment
Share on other sites

That's defined in the script armhwinfo located in /etc/init.d

 

Source location:

scripts/armhwinfo

 

It's possible that it's not working perfectly yet.

Link to comment
Share on other sites

Not exactly this way ... you need to select Orange Pi in menu to get a proper board configuration and u-boot. Specially if you need a wifi to be operational. If you don't need wifi a bananapi configuration and image works without a problem.

 

But, motd is independent - it reads various hw data and determine the board.

Link to comment
Share on other sites

Ahaa.

https://github.com/igorpecovnik/BananaPI-Debian

 

This page should look like this - only links to proper one:

https://github.com/igorpecovnik/Cubox-i-Debian

 

This configuration is (almost) deprecated. I am clearing this those days but I am temporally on super bad internet connection ...

 

But if you don't specify the board you will be prompted to choose.

 

Use this; 

https://github.com/igorpecovnik/lib

 

I also wrote a manual two days ago. :rolleyes:

Link to comment
Share on other sites

Thank you, will try this soon.

 

I expected that the Banana Pi build script passed the board variable somehow and I could manipulate that. I will use your all in one solution so I can just pick the board from the nice little menu :)

Link to comment
Share on other sites

hi Igor,

 

I am a hardware engineer and a complete newbie to embedded development in linux. I need some help to create a custom version of the board/compile option to use with my A20 board (from China) . This board is not one of the popular ones such as Orange, Lamobo, etc. However, from a hardware standpoint, it is closest to the Cubieboard 2 design. I have a customized .fex file for the board I am using. In your github/lib, i saw a file "boards.h" which i believe is the customization file for different versions of the A20 (and other processor based) boards. Please let me know how I can create a new entry (or edit an existing entry) of A20 board types and add ny .fex file to customize the build to suit my hardware.

 

Regards,

Raj

Link to comment
Share on other sites

Hey,

 

There different levels of customizations.

 

http://linux-sunxi.org/Fex_Guide

A FEX file defines various aspects of how the SoC works. It configures the GPIO pins and sets up DRAM, Display, etc parameters.

 

Having a fex file is usually good enough to boot the board - with kernel 3.4.x. For new (4.x) you will probably need to construct your own device tree. If it's close to Cubieboard 2 than you start with it's source. It might just work out of the box. The same states for u-boot.

 

Board customizations among my script are on system level - firmware loading, extra modules loading, custom repository, custom applications, ...

 

Roughly, if you want to add a new board:

 

1. Add to menu and choose a dedicated name: (Myboard A20)

https://github.com/igorpecovnik/lib/blob/next/main.sh#L27

 

2. Add an entry to configuration - copy paste cubieboard and use a previously chosen board name

https://github.com/igorpecovnik/lib/blob/next/configuration.sh

 

3. Copy your fex file to lib/config/Myboard.fex

 

------

 

From this point - if you can't boot - you need to tweak U-boot configuration and add exceptions - if necessary - to: https://github.com/igorpecovnik/lib/blob/next/boards.sh and to board configuration if you need some special module.

 

If you have any questions just post it here.

Link to comment
Share on other sites

Hi is it possible to add 

 

the csc patch to the kernel at the next image ?

 

https://github.com/rellla/linux-sunxi/commit/c92d32e1adc7ee2fcf014a9abf35039b59478bf3

 

drivers/video/sunxi/disp/de_fe.c

@@ -1382,10 +1382,10 @@ __s32 DE_SCAL_Set_CSC_Coef_Enhance(__u8 sel, __u8 in_csc_mode,
 	__u32 i;
 	__s32 sinv, cosv; /* sin_tab: 7 bit fractional */
 
-	bright = bright * 64 / 100;
-	bright = saturation * 64 / 100;
-	bright = contrast * 64 / 100;
-	bright = hue * 64 / 100;
+	bright = DIV_ROUND_CLOSEST((clamp(bright, 0, 100) * 63), 100);
+	saturation = DIV_ROUND_CLOSEST((clamp(saturation, 0, 100) * 63), 100);
+	contrast = DIV_ROUND_CLOSEST((clamp(contrast, 0, 100) * 63), 100);
+	hue = DIV_ROUND_CLOSEST((clamp(hue, 0, 100) * 63), 100);
 
 	sinv = image_enhance_tab[8 * 12 + (hue & 0x3f)];
 	cosv = image_enhance_tab[8 * 12 + 8 * 8 + (hue & 0x3f)];

it's required for the newer sunxi-vdpau revisions to fix the mostly dark image.

Link to comment
Share on other sites

Hi Igor,

 

I am working with the hummingboard and I am trying to use the g_mass_storage gadget by modprobing the driver. However, it seems like the Debian wheezy raw image I got from here does not have the USB OTG port configured in device mode. I saw from this post that we are able to change the id pin by changing the device tree file.

 

My question is can I configure the USB OTG port to device mode on the fly or do I need to modify the device tree and recompile the kernel and uboot image myself. If so, what should I change from your scripts?

 

Thanks,

 

Kam

Link to comment
Share on other sites

No, you don't need to recompile kernel, u-boot or download anything. You need to de-compile device tree blob (/boot/imx6q-hummingboard.dtb or /boot/imx6dl-hummingboard.dtb), edit / add, compile back. DTC compiler is within the image.

 

@Moorviper

Patches are added to the source.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines