CrossCompile bsdiff - C++ or Other Android Development Languages

I want compile bsdiff for android but i have some issue.
- I have download bsdiff source from here http://www.daemonology.net/bsdiff/bsdiff-4.3.tar.gz
- I use this command to compile under Ubuntu
Code:
arm-linux-gnueabi-cpp bsdiff.c -o bsdiff -lbz2
and
Code:
arm-linux-gnueabi-cpp -static -march=armv7 bsdiff.c -o bsdiff -lbz2
but the result file is a text and not a binary, the shell does not output errors.
Thanks

avoid using `arm-*-linux-gnueabi-` or `arm-linux-gnueabi-` related toolchain with default sysroot they will for shared library even after adding `-static` flag to it as your are targeting for `armv7` you can use linaro toolchain they works well for android
anyway correct way for doing this is
HTML:
arm-none-linux-gnueabi-gcc -static -march=armv7 bsdiff.c -o bsdiff -lbz2

Related

Add su and busybox to my aosp 4.0.3

Hello
i've built AOSP from source with no issues for my Maguro. bumped all the proprietary binaries for GPS, BlueTooth, Camera. Everything is working but i am having trouble to add su and busybox.
this is what i am doing in order to add su and busybox
1. git cloned SuperUser in $TOP
Code:
git clone git://github.com/ChainsDD/Superuser.git packages/apps/Superuser
2. copied su and busybox binaries from apex ROM and put them in $TOP/device/samsung/maguro/prebuilt/xbin
3. edited $TOP/device/samsung/maguro/full_maguro.mk
Code:
[email protected]:~$ cat $TOP/device/samsung/maguro/full_maguro.mk
# Copyright (C) 2011 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This file is the build configuration for a full Android
# build for maguro hardware. This cleanly combines a set of
# device-specific aspects (drivers) with a device-agnostic
# product configuration (apps). Except for a few implementation
# details, it only fundamentally contains two inherit-product
# lines, full and maguro, hence its name.
#
# Get the long list of APNs
PRODUCT_COPY_FILES := device/sample/etc/apns-full-conf.xml:system/etc/apns-conf.xml
# Camera
PRODUCT_PACKAGES := \
Camera
# Tell compiler where our prebuilt folder is
DEVICE_PREBUILT := device/samsung/maguro/prebuilt
# Tell compiler to build Superuser.apk
PRODUCT_PACKAGES := \
Superuser
# Include busybox and su binaries
PRODUCT_COPY_FILES += \
$(DEVICE_PREBUILT)/xbin/busybox:system/xbin/busybox \
$(DEVICE_PREBUILT)/xbin/su:system/xbin/su
# This is a script to automatically symlink busybox and su binaries on boot (the code for 91-busybox_linkage.sh is below)
PRODUCT_COPY_FILES += \
$(DEVICE_PREBUILT)/etc/init.d/91-busybox_linkage.sh:system/etc/inti.d/91-busybox_linkage.sh
# Inherit from those products. Most specific first.
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base_telephony.mk)
# This is where we'd set a backup provider if we had one
#$(call inherit-product, device/sample/products/backup_overlay.mk)
# Inherit from maguro device
$(call inherit-product, device/samsung/maguro/device.mk)
# Set those variables here to overwrite the inherited values.
PRODUCT_NAME := full_maguro
PRODUCT_DEVICE := maguro
PRODUCT_BRAND := Android
PRODUCT_MODEL := Full AOSP on Maguro
4. created 91-busybox_linkage.sh in $TOP/device/samsung/maguro/prebuilt/etc/init.d
Code:
[email protected]:~$ cat $TOP/device/samsung/maguro/prebuilt/etc/init.d/91-busybox_linkage.sh
for cmd in $(busybox --list);do ln -s /system/xbin/$cmd $cmd; done; ln -s /system/xbin/su su;
5. set permissions for 91-busybix_linkage.sh
Code:
[email protected]:~/myAOSP/device/samsung/maguro/prebuilt/etc/init.d$ ls -l
total 4 -rwxrwxrwx 1 rascarlo rascarlo 94 2012-02-14 13:52 91-busybox_linkage.sh
6. added https://github.com/C...eruser.x509.pem and https://github.com/C...y/superuser.pk8 in $TOP/build/target/product/security
then i make installclean, make clean, make clobber and then i run make otapackage -j8
but it won't build. i get this as last line in terminal:
Code:
'out/target/common/obj/APPS/Settings_intermediates/classes.dex' as 'classes.dex'...
[email protected]:~/myAOSP$
and scrolling up in terminal i see this error :
Code:
make: *** [out/target/product/maguro/obj/APPS/Superuser_intermediates/package.apk] Error 1
where am i wrong?
can anybody help?
thank you
quite interested in this, as I have a maguro also
Greets!
Maybe you should compile the build first.....then use dsixda's Android Kitchen to add root
Herpderp Defy.
EmoBoiix3 said:
Maybe you should compile the build first.....then use dsixda's Android Kitchen to add root
Herpderp Defy.
Click to expand...
Click to collapse
i compiled the buiild just fine and i would like to not use the kitchen
You need to add the source to packages/apps, then add it to either build/target/product/core.mk or device/*/*/device.mk
would be device/samsung/tuna/device_base.mk for u (yes i know u r building for maguro)
You also need to add the su binary sources to system/su
And for busybox, you might add busybox to external and the compile it
thank you for your reply. let me see i am getting this right.
cdesai said:
You need to add the source to packages/apps....
Click to expand...
Click to collapse
that is
Code:
cd $TOP
git clone git://github.com/ChainsDD/Superuser.git packages/apps/Superuser
... then add it to either build/target/product/core.mk or device/*/*/device.mk
Click to expand...
Click to collapse
that for me would mean add to device/samsung/maguro/device.mk this text?
Code:
# Tell compiler to build Superuser.apk
PRODUCT_PACKAGES := \
Superuser
would be device/samsung/tuna/device_base.mk for u (yes i know u r building for maguro)
Click to expand...
Click to collapse
i have not such file in device/samsung/tuna. and why if i am compiling for maguro?
You also need to add the su binary sources to system/su
Click to expand...
Click to collapse
that is
Code:
cd $TOP
git clone https://github.com/ChainsDD/su-binary.git system/su
And for busybox, you might add busybox to external and the compile it
Click to expand...
Click to collapse
Ok. The su in system/extras gives compile errors so I had to delete it. Superuser.apk compiled without any problems but su isn't in the xbin folder. I think this is giving it errors
LOCAL_MODULE_TAGS := debug, eng
Can anyone help me out?
unstable. Forced Close on a lot of apps.

CM10 maguro build fails on kernel?

If you get the error: selected processor does not support ARM mode `smc #0' when trying to compile kernel on OS X, please go to the scripts folder in the kernel source tree and change in Kbuild.include from:
Code:
/bin/echo -e "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3))
to:
Code:
printf "%s\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3))

Upstream arm64 kernel for Raspberry Pi 3

Hi all
If you just need Raspberry Pi 3 to run headless linux and unleash its full 64bit power then you can compile vanilla kernel (kernel.org) for Raspberry Pi 3 using this tutorial.
YOU NEED TO USE THIS WITH ARM64 LINUX DISTRIBUTION
I don't know if it's my custom distribution's fault or kernel fault but when I use arm64 kernel on Raspberry Pi's Github then it's panic because fs driver on heavy load.
This tutorial doesn't use u-boot for booting the kernel, instead I use the firmware as it is.
This tutorial has been tested on Ubuntu 16.10, 17.04 host and you just need to copy and paste, it will work.
First of all, you need to setup build environment by using command below (maybe not all of these are necessary but this is how I usually setup my Android build environment and it's work for kernel build too):
Code:
sudo apt update
sudo apt install -y bison bc build-essential flex git-core gperf libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libxml2 libxml2-utils lzop schedtool xsltproc zlib1g-dev g++-multilib gcc-multilib lib32ncurses5-dev lib32z1-dev
Now you need to get the aarch64 toolchain, here I'll use Linaro because it will somewhat improve performance but you can use the gcc-aarch64-linux-gnu if you want.
This code will download Linaro 6.3.1 and extract it to /opt/ for use later on:
Code:
wget http://releases.linaro.org/components/toolchain/binaries/latest/aarch64-linux-gnu/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz
sudo tar -xvf gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu.tar.xz -C /opt/
Now you need to clone kernel source code, this will takes some time on slow connection even though I did make it only clone the latest commit (shadow clone) but without clone the whole history:
Code:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git --depth=1 -b linux-4.10.y
You can change the linux-4.10.y to another branch if you want, this branch clone will give you the latest version of that particular kernel version (4.10).
Now start the compilation, here I'm using a build machine with 14 cores, you can replace -j14 with your CPU core number for faster build, don't set it to higher than your real CPU core or it will slow your machine down:
Code:
cd linux-stable
mkdir MODULES BOOT
#
# Export necessary variable
#
export CROSS_COMPILE=/opt/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
export ARCH=arm64
#
# Make arm64 default defconfig
#
make defconfig -j14
#
# You must enable FB_SIMPLE or it will not boot
#
sed -i 's/# CONFIG_FB_SIMPLE is not set/CONFIG_FB_SIMPLE=y/g' .config
#
# Here I enable ethernet driver as built-in because you'll need it in some situation like kernel module not loaded
#
sed -i 's/CONFIG_USB_USBNET=m/CONFIG_USB_USBNET=y/g' .config
sed -i 's/CONFIG_USB_NET_SMSC95XX=m/CONFIG_USB_NET_SMSC95XX=y/g' .config
#
# Disable these heavy module which we will not use it at all
#
sed -i 's/CONFIG_DRM_NOUVEAU=m/# CONFIG_DRM_NOUVEAU is not set/g' .config
sed -i 's/CONFIG_DRM_TEGRA=m/# CONFIG_DRM_TEGRA is not set/g' .config
#
# Making the modules, copy it to ./MODULES
#
make modules -j14
make modules_install -j14 INSTALL_MOD_PATH=MODULES/
#
# Making the kernel and dtbs
#
make Image dtbs -j14
#
# It's compiled, copy it to ./BOOT for easy to work with
#
cp ./arch/arm64/boot/Image ./BOOT/Image
cp ./arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dtb ./BOOT/
You should have all the necessary file from build kernel in 2 directory (BOOT, MODULES) if nothing wrong happens.
[INSTALL KERNEL]
Plug the MicroSDcard of Raspberry Pi 3 to your computer and copy ./BOOT/Image and ./BOOT/bcm2837-rpi-3-b.dtb to partition #1 (vfat)
Edit the config.txt and add lines below, edit if already exist, this will: active arm64 mode, use device_tree for boot kernel, use kernel named Image:
Code:
arm_control=0x200
device_tree=bcm2837-rpi-3-b.dtb
kernel=Image
[INSTALL MODULES]
Now you have to mount the Raspberry Pi 3 Linux OS partition (usually is partition #2) to your system to copy file into it
Make backup and delete every directory in /lib/modules/ of OS partition
Copy ./MODULES/lib/modules/* to /lib/modules/ of OS partition using root
Now it's basically done, unmount/safely eject the sdcard and plug it to your Raspberry Pi 3, boot it up.
Modules might not loaded automatically, run this command on Raspberry Pi 3 shell:
Code:
sudo find "/lib/modules" -mindepth 1 -maxdepth 1 -type d | while read DIR; do echo ${DIR}; BASEDIR=$(basename "${DIR}"); echo " *** depmod ${BASEDIR}"; depmod -b "/" -a "${BASEDIR}"; done
Now modules should be loaded and will be loaded automatically on next boot.
Disclaimer:
- Only Kernel 4.9 and above are supported Raspberry Pi 3 AArch64
- Wifi/Bluetooth will not work since driver still haven't implemented
- Other function might not work
Tested/working:
- USB
- Ethernet
- HDMI
- UART
- GPU acceleration

Chromium OS building

After building Chromium OS kernel 4.14.96 & my inability to figure out how to properly deploy it as an update to an existing Chromium OS installation like Arnoldthebat v72 (with Chrome OS Kernel 4.14.83)
efforts here -
https://forum.xda-developers.com/showpost.php?p=78830818&postcount=3
I will post here my efforts at building the full Chromium OS with the latest available Kernel - I will try & start with same version as arnoldthebat i.e. v72 which has now reached stable...
There will be a lot of editing here, as it's a learning curve to me...
First is to clone the Google Chrome OS repo -
I was given this link to learn how to do this -
https://chromium.googlesource.com/chromiumos/docs/+/master/developer_guide.md
As for building Kernel for ATB v72 - I will be keeping a log of instructions here...
I do the work from within a Ubuntu xenial 16.04.xx box as suggested by the documentation,
Preparation instructions:
Create a folder where the code will be stored (they suggest chromeos) I used code
from an ext4 partition/disk with plenty of space (mine 150 GB+)
$ mkdir code
input instructions to get to clone the repo later to reach here:
$ sudo apt-get install repo
$ sudo apt-get install git-core gitk git-gui curl lvm2 thin-provisioning-tools \
python-pkg-resources python-virtualenv python-oauth2client
Install depot_tools
$ git config --global user.name "John Doe"
$ git config --global user.email "[email protected]"
$ git config --global core.autocrlf false
$ git config --global core.filemode false
$ # and for fun!
$ git config --global color.ui true
Tweak your sudoers configuration
cd /tmp
cat > ./sudo_editor <<EOF
#!/bin/sh
echo Defaults \!tty_tickets > \$1 # Entering your password in one shell affects all shells
echo Defaults timestamp_timeout=180 >> \$1 # Time between re-requesting your password, in minutes
EOF
chmod +x ./sudo_editor
sudo EDITOR=./sudo_editor visudo -f /etc/sudoers.d/relax_requirements
Configure git
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
Verify that your default file permissions (umask) setting is correct
put the following line into your ~/.bashrc
umask 022
preparation for enough disk space
in folder code/
sudo dd if=/dev/zero of=swapfile bs=1024 count=$((1024*3000))
mkswap swapfile
sudo swapon swapfile
git config --global http.sslVerify false
git config --global http.postBuffer 1048576000
initialise the repo
$ repo init
$ repo init -u https://chromium.googlesource.com/chromiumos/manifest.git --repo-url https://chromium.googlesource.com/external/repo.git [-g minilayout]
get the source code
$ repo sync -j4
getting/syncing the source code took a long time as it kept failing...
I am now in this position with the source code in code/
I will fill in gaps of instructions I missed later...
Create a chroot
make sure depot_tools/ is inside the folder code/: code/depot_tools
temporary put depot_tools in the path
export PATH=$PATH:depot_tools
$ cros_sdk
... this will take some time...
NOTICE: Mounted .../code/chroot.img on chroot
NOTICE: Downloading SDK tarball..
All done
INFO cros_sdk:make_chroot: Elapsed time (make_chroot.sh): 74m37s
cros_sdk:make_chroot: All set up. To enter the chroot, run:
$ cros_sdk --enter
CAUTION: Do *NOT* rm -rf the chroot directory; if there are stale bind
mounts you may end up deleting your source tree too. To unmount and
delete the chroot cleanly, use:
$ cros_sdk --delete
(cr) ((c62d307...)) [email protected] ~/trunk/src/scripts $
now comes the real stuff...
Notes -
some extra commands might be needed to get this working:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install linux-generic
$ sudo apt-get install fakeroot build-essential crash kexec-tools makedumpfile kernel-wedge
$ sudo apt-get install git-core libncurses5 libncurses5-dev libelf-dev asciidoc binutils-dev
...
Hello, My guide should fill in the blanks for you (Specifically the Over The Air Upgrades) - https://kmyers.me/blog/chromeos/a-g...s-distribution-with-ota-updates-and-crostini/
could someone please tell me if there is a rpm file so chromium os could be installed on top of ubuntu using alien cause terminal too difficult for noobs to understand but rpm and alien super easy
ghostdogg49504 said:
could someone please tell me if there is a rpm file so chromium os could be installed on top of ubuntu using alien cause terminal too difficult for noobs to understand but rpm and alien super easy
Click to expand...
Click to collapse
No, ChromiumOS is a operating system that either replaces your default operating system or that you dual boot into. It is not simply a application that you can install. If you want to run it without installing it, you could in theory build it yourself and convert the image to a virtual machine image and run it in Qemu or VirtualBox.
KMyers said:
No, ChromiumOS is a operating system that either replaces your default operating system or that you dual boot into. It is not simply a application that you can install. If you want to run it without installing it, you could in theory build it yourself and convert the image to a virtual machine image and run it in Qemu or VirtualBox.
Click to expand...
Click to collapse
fydeos has a installer in fydeos store with dualboot option but its in chinese

[HOW TO] Extract DTS from running OS

Build dtc (Device Tree Compiler) from AOSP (external/dtc/)
- Get Android sources (AOSP., LineageOS, OmniRom or whatever you want)
- Modify external/dtc/Android.mk
- Replace
Code:
include $(BUILD_HOST_EXECUTABLE)
with
Code:
include $(BUILD_EXECUTABLE)
- . build/envsetup.sh && lunch aosp_yourdevice-userdebug
- mka dtc
Run dtc on your device
- Root your device
- Remount system
- push dtc binary to /system/bin/
Code:
adb root
adb shell
Code:
setenforce 0
dtc -I fs -O dts -o /sdcard/extracted.dts /proc/device-tree
exit
Code:
adb pull /sdcard/extracted.dts
Open extracted.dts with your favourite text editor.
Attached dtc binaries:
dtc.zip - Android P
dtc-n.zip - Android N

Categories

Resources