This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compiling Tinkerboard's Android
#61
I think you should only start this command once. This part '> buildlog.log 2> & 1 &' redirects all output to buildlog.log file.
But now you have started the compile process three times.
Best is you close this terminal window hard and start again with step 3. But don't use -j28, better -j4 as you don't have so much processors on a virtual machine. And you can leave this buildlog also, then you will have a lot of output in the terminal window. You don't need to compile again kernel and u-boot.
Code:
source build/envsetup.sh
lunch rk3288-userdebug
make -j4
[-] The following 1 user Likes lobo's post:
  • kbungo
Reply
#62
I got that by typing your code:


Code:
out/target/common/obj/previous_gen_java_config.mk:140: *** missing separator.
build/core/ninja.mk:163 : la recette pour la cible « out/build-rk3288.ninja » a échouée
make: *** [out/build-rk3288.ninja] Erreur 1

#### make failed to build some targets (21 seconds) ####

root@leskriim-VirtualBox:/home/leskriim/WORKING_DIRECTORY#

I tried again i had that:

Code:
including ./vendor/rockchip/common/tools/log_capture/log-watch/Android.mk ...
including ./vendor/rockchip/common/tools/log_capture/log_service/Android.mk ...
including ./vendor/rockchip/common/tools/log_capture/logcatext/Android.mk ...
including ./vendor/rockchip/common/tools/log_capture/parse_stack/Android.mk ...
including ./vendor/rockchip/common/vpu/Android.mk ...
out/target/common/obj/previous_gen_java_config.mk:140: *** missing separator.
build/core/ninja.mk:163 : la recette pour la cible « out/build-rk3288.ninja » a échouée
make: *** [out/build-rk3288.ninja] Erreur 1
[1]+  Termine 2               make -j4 > buildlog.log 2>&1

#### make failed to build some targets (21 seconds) ####

root@leskriim-VirtualBox:/home/leskriim/WORKING_DIRECTORY#

Help
French

Reply
#63
(09-12-2018, 07:27 PM)kbungo Wrote: Hello everyone!

The information on how to compile Tinkerboard's Android source code seems to be scattered across some WIKI pages and many other sources, so I figured I would compose a guide here as well as provide a place where people can ask questions and post their compilation errors.

I will skip the introductions and fun and get straight to the instructions  Wink
DISCLAIMER: I am not associated with ASUS.

Preparation:
  • You will need an Ubuntu machine. Google still reccomends Ubuntu 14 and Ubuntu 16, but I am using Ubuntu 18 and it seems fine (with some minor bugs).
  • Install openjdk-8
    Code:
    sudo apt-get install openjdk-8-jdk
  • Install various other packages
    Code:
    sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip
  • You will want to setup CCACHE. trust me, it's worth it it can take 50 minute builds down to 20 minute builds. See here: https://askubuntu.com/questions/470545/h...-up-ccache
  • Be aware, that compiling Android is a place where you want to be generous with your disk space. you should be prepared to download 60+GB of source code ALONE, and you should expect that to increase by an additional 50% when you include compiled files. All said and done I would recommend a minimum of 100GB of space with ccache, compiled code, source code all considered. You can definitely get away with less than this, but you should have plenty of room prepared.
1, download repo.
"repo" is a tool created by google to handle the downloading/updating/uploading of the massive number of git repositories that compose Android. repo uses a manifest to instruct it on things like what remote to use, what branch to look at and even what exact commit to checkout. It is very powerful and is a great way to manage a large number of projects that are all inter-connected.

My instructions are basically stolen from Google's repo install Instructions, with minor adjustments:
Open a terminal and execute:

Code:
curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/bin/repo
chmod a+x /usr/bin/repo


ensure that /usr/bin is in your $PATH. if it is not, add it
Code:
export PATH=$PATH:/usr/bin

2, prepare your working directory.
Great, so now choose somewhere you want to put the source. I put my source in /home/kbungo/projects/firmware/asus/android-7.1.2/, which I will now refer to as {croot}. You can put it wherever you like, just make sure it's a reasonable permission space (do not choose / it probably won't be fun.)
go to {croot}, and execute the following:
Code:
repo init -u https://bitbucket.org/TinkerBoard_Android/manifest.git -b /sbc/tinkerboard/asus/Android-7.1.2 -m android_20180817_v14.1.2.50.xml

in this example, I have selected: Android 7, current release. -b is for branch, as you can see in the linked repo. -m is for what manifest file to use, which defaults to default.xml. you have options though! here are the approximate commands for different things you may want to be making.
  • Android 6, most recent release:
    Code:
    repo init -u https://bitbucket.org/TinkerBoard_Android/manifest.git -b /sbc/tinkerboard/asus/Android-6.0.1 -m android_20180712_v13.14.0.95.xml
  • Android 6, development build:
    Code:
    repo init -u https://bitbucket.org/TinkerBoard_Android/manifest.git -b /sbc/tinkerboard/asus/Android-6.0.1
  • Android 7, development build:
    Code:
    repo init -u https://bitbucket.org/TinkerBoard_Android/manifest.git -b /sbc/tinkerboard/asus/Android-7.1.2

repo might ask you to confirm your name and email address. please do so. it should then tell you success. Your directory will still appear empty, but there is a .repo folder there with some info.

a couple CURL failures to obtain some sort of bundle are completely normal.

One user, lobo, provides a fix I have paraphrased below. Click the green arrow on this quote to see the full comment.
(09-13-2018, 05:38 PM)lobo Wrote: If you receive an error with initilization, such as the following:
Code:
fatal: cannot obtain manifest https://bitbucket.org/TinkerBoard_Android/manifest.git

Please try the following command instead. (The url includes a git user).
Code:
repo init -u https://git@bitbucket.org/TinkerBoard_Android/manifest.git -b sbc/tinkerboard/asus/Android-7.1.2
This fix should be applicable with all urls provided, just change https://bitbucket.org to https://git@bitbucket.org and you should be good to go Smile

3, Downloading source or Updating existing source.
this is simple. if you already have the source, downloading from new and updating existing source is the same.
Code:
repo sync -j4 -c -q
repo sync is the command.
-j4 specifies 4 download tasks at a time. I took down a corporate network running -j8 so please be careful.
-c specifices "do not sync other branches." if i am looking for the 6.0 source code, do not also get the branch information for Android 7. This keeps the git info cleaner and speeds the sync up a little.
-q is quiet... otherwise you'll get your console window destroyed with output and it's really hard to tell what your progress is.

This is a slow process. When doing a new project, i usually let it run over the weekend or overnight. It will take many hours depending on your internet speed. be patient. If it keeps failing, try -j1 so you can see what project is failing and we can troubleshoot from there.


Instructions from here forward are for Android-7.1.2. There are slightly different compile commands for u-boot and kernel for Android-6.0.1. To be certain, these commands are taken from {croot}/RKDocs/, where you can find an SOP document (hopefully). If it's desired I do a guide on Android 6, i will do that as well in the future.



4, Compiling source
congratulations, you have the Tinkerboard Source Code! you are ready to compile. There are three primary things you need to compile, the kernel, u-boot, system image. Lets talk about that.

In this section, all -j flags should be decided based on the number of cores you have on your build machine. If you have a user laptop instead of a server, please decide accordingly. I use VERY HIGH -j values when compiling because I compile on a professional server dedicated to firmware work... it has something like 32 cores I can play with.

Before you do anything with source code, you should ALWAYS do the following:
Code:
cd {croot}
source build/envsetup.sh
lunch rk3288-userdebug
this adds some handy tools to your arsenal. you can find more on those elsewhere, mostly it adds some environment variables and initializes some stuff.

  1. Compiling the kernel. (~8 minutes at -j8)
    Code:
    cd {croot}/kernel
    make ARCH=arm rockchip_defconfig
    make ARCH=arm rk3288-miniarm.img -j8
  2. Compiling u-boot (-1.5 minutes at -j8)
    Code:
    cd {croot}/u-boot
    make rk3288_secure_defconfig
    make -j8
  3. Compiling system image (~50 minutes at -j28)
    Code:
    cd {croot}
    make -j28 > buildlog.log 2>&1 &
Note about step 3: "> buildlog.log 2>&1 &" pipes all output to a file, buildlog.log, and puts the process in the background. This unblocks your shell and ensures you have a log of the build. If you do not do this, you will likely lose build information as it throws a lot of data at the screen. also note that it takes 50 minutes at -j28 for a fresh build. be prepared to wait hours for this to complete.

A lot of people start getting failures at this point. That's okay, don't be discouraged! just ask.

5, Building a single image.
So we've got a kernel, u-boot, and a system image... what now?

Code:
cd {croot}
./mkimage.sh
cd {croot}/RKTools/linux/Linux_Pack_Firmware/rockdev
./collectImages.sh && ./mkupdate.sh

Easy. You now have a file, {croot}/RKTools/linux/Linux_Pack_Firmware/rockdev/update.img. This is almost your flashable image! you're really close, i promise.
On windows, please go to the following link and download the SPI Image Tool, place it in a folder on your desktop or somewhere you can easily find it.
lobo Wrote:https://github.com/rockchip-linux/tools/..._v1.36.zip

  1. Run the program you just downloaded. yes. it's in chinese. If you don't read Chinese, that's okay.
  2. Just click the top button. it'll pop open a file select dialog, select your update.img you brought over.
  3. Now click the bottom button and watch the blue progress bar ping-pong for a while. This can take a while (10+ minutes sometimes).
  4. Come back when a chinese dialog popups and hit okay. the folder you placed the executable in should now have 3 .img files: boot0.bin, boot1.bin and data.bin.
  5. Grab data.bin.

Thank you again to lobo for providing an easier source for the SpiImagetool!

6, Flashing the image.
For the sake of cross-platform instructions, I will not be using win32diskimager as the instructions suggest. I will use etcher. You can use whatever you want to flash data.bin onto the image.

  1. Open etcher.
  2. Click "Select Image". It'll warn you it's not bootable. that's okay, Continue.
  3. Select your flashing device. You can flash an SD card or the Tinkerboard S directly if you're using one.
  4. Click flash and wait for it to complete.
All done, you now should be able to boot into android on your device! If you really want some fun, to into Settings->About Device and look at the kernel version. It'll have your build machine's name in the description! Show it to all of your friends so they think you understand the kernel when you're secretly scared of touching it.

Happy Tinkering!

Advice from experience:
  • Things will fail. Things will break. Things will not boot. That's okay. Keep a log of what you changed, and just undo changes until it works again!
  • There are 600+ projects in the Android Tinkerboard build. You don't need to know what they all do. You just need to learn the organization and get an idea of where things are.
  • android has a special version of sgrep that lets you search all the android source easily. if you're looking for something, find a some characters that seem unique to your problem (some UI text or something) and use sgrep to find it.
  • avoid changing the /frameworks projects as much as possible. If you have to, you have to, but that's the core underpinnings of how android works. Some apps may no longer act correctly if you change too much.
  • Choose one thing to change at a time and test it like crazy. Don't be afraid to make changes, but always test small changes.
  • You do not need to know what you're doing. you need to know what you did. Always remember how to undo your changes.





Hi

I have successfully build the android image through following steps and finally got an update.img of 2.24GB size but my tinker is not booting up with that image.

Please help Angel
Reply
#64
Hello,
you need SpiImageTools
please can you send me the images (update.img) via drive or other cloud
Reply
#65
Hey @Kbungo

Thanks for this guide. I have successfully built upto update.img. It took the make around 4 hrs using -j2.
I have two questions though:
1) What does the SPI image tool do?
2) If I make some changes, do I remake the u-boot, kernel and the system image?
Reply
#66
(07-04-2019, 02:44 PM)vivekb Wrote: 1) What does the SPI image tool do?
2) If I make some changes, do I remake the u-boot, kernel and the system image?

1. I'm not entirely sure to be honest. I think it maps the partial/compressed android OTA image into a fully flashable image. Flashable images are going to need to have the kernel and uboot mapped into the correct bytes in memory. The OTA image is going to the smaller and will likely not have the full and correct mappings since it's built with a map that says where to copy things. I digress about OTAs tho. IT does some black magic. I've looked for source and never found any so yeah.
2. No matter what you've gotta recompile the system image. It shouldn't take so long since android will only compile what it needs to. If you make a change in kernel or uboot: recompile the one you changed and then recompile the android system image.

Hope this helps
Reply
#67
(07-10-2019, 12:30 AM)kbungo Wrote:
(07-04-2019, 02:44 PM)vivekb Wrote: 1) What does the SPI image tool do?
2) If I make some changes, do I remake the u-boot, kernel and the system image?

1. I'm not entirely sure to be honest. I think it maps the partial/compressed android OTA image into a fully flashable image. Flashable images are going to need to have the kernel and uboot mapped into the correct bytes in memory. The OTA image is going to the smaller and will likely not have the full and correct mappings since it's built with a map that says where to copy things. I digress about OTAs tho. IT does some black magic. I've looked for source and never found any so yeah.
2. No matter what you've gotta recompile the system image. It shouldn't take so long since android will only compile what it needs to. If you make a change in kernel or uboot: recompile the one you changed and then recompile the android system image.

Hope this helps

hi, i'm still blocking at the last step
French

Reply
#68
(07-10-2019, 06:51 AM)Leskriim Wrote: hi, i'm still blocking at the last step

You're using the data.bin file generated from the SPI Image tool, correct?
Please check your kernel/uboot configuration were done correctly.
Reply
#69
i am trying myself in compiling. are there android pie files in repo? should mean can i change the bitbucket link in 9.0.0 or simmilar?
Reply
#70
I block at this stage:

Compilation of the system image (~ 50 minutes to -j28)


Code:
cd {croot}

make -j28> buildlog.log 2> & 1 &
French

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)