# Use the Ubuntu 20.04 minimal image as the base
FROM ubuntu:20.04

# Set environment variable to prevent tzdata asking for geographic area
ENV DEBIAN_FRONTEND=noninteractive

# Install any dependencies or packages required by your application
RUN apt-get -y update

# install dependencies
RUN apt-get install -y build-essential subversion git libncurses5-dev zlib1g-dev gawk flex bison quilt libssl-dev xsltproc libxml-parser-perl mercurial bzr ecj cvs unzip lsof python3 python2 python3-dev android-tools-mkbootimg python2 libpython3-dev

# add i386 architecture
RUN dpkg --add-architecture i386
RUN apt-get update
RUN apt-get install -y gcc-multilib 
RUN apt-get install -y libc6:i386 libstdc++6:i386 lib32z1

# Install Repo tool
RUN curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo
RUN chmod a+x /usr/local/bin/repo

# Start to set up the tina-v853 SDK
RUN mkdir /tina-v853-open
WORKDIR /tina-v853-open

# # set up git credential
RUN git config --global credential.helper store

RUN git config --global user.name "名字"
RUN git config --global user.email "邮箱"

# Add credentials to credential store
RUN echo "https://aw-ol的用户名:aw-ol的密码@sdk.aw-ol.com" > ~/.git-credentials

ENV REPO_COLOR=0

#initialize the repo
RUN repo init -u https://sdk.aw-ol.com/git_repo/V853Tina_Open/manifest.git -b master -m tina-v853-open.xml

#sync the repo, took about 30 minutes in midnight
RUN repo sync

#start SDK
RUN repo start devboard-v853-tina-for-awol --all

RUN curl -LO https://github.com/YuzukiHD/TinyVision/releases/download/tina.0.0.2/tina-bsp-tinyvision.tar.gz

RUN tar xvf tina-bsp-tinyvision.tar.gz

#init SDK

# Use bash to run commands
RUN apt-get install -y python wget rsync vim bc u-boot-tools cpio busybox

#RUN ls openwrt/package/allwinner/vision/libAWIspApi/machinfo/v851se/
#make sure it exists
RUN cat openwrt/package/allwinner/vision/libAWIspApi/machinfo/v851se/build.mk

#root can compile
ENV FORCE_UNSAFE_CONFIGURE=1



