Skip to content

Commit

Permalink
Commit inicial da imagem Caipirinha-OS
Browse files Browse the repository at this point in the history
  • Loading branch information
LeandroTE committed Jun 27, 2023
1 parent 2b4a564 commit 9948f0c
Show file tree
Hide file tree
Showing 10 changed files with 404 additions and 4 deletions.
86 changes: 86 additions & 0 deletions .config.caipirinha
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
CONFIG_TARGET_bcm27xx=y
CONFIG_TARGET_bcm27xx_bcm2710=y
CONFIG_TARGET_bcm27xx_bcm2710_DEVICE_rpi-3=y
CONFIG_ALL_KMODS=y
CONFIG_ALL_NONSHARED=y
CONFIG_DEVEL=y
CONFIG_AUTOREMOVE=y
CONFIG_BPF_TOOLCHAIN_BUILD_LLVM=y
# CONFIG_BPF_TOOLCHAIN_NONE is not set
CONFIG_BUILDBOT=y
CONFIG_COLLECT_KERNEL_DEBUG=y
CONFIG_HAS_BPF_TOOLCHAIN=y
CONFIG_IB=y
CONFIG_IMAGEOPT=y
CONFIG_KERNEL_BUILD_DOMAIN="buildhost"
CONFIG_KERNEL_BUILD_USER="builder"
# CONFIG_KERNEL_KALLSYMS is not set
CONFIG_MAKE_TOOLCHAIN=y
CONFIG_PACKAGE_brcmfmac-firmware-usb=m
CONFIG_PACKAGE_cgi-io=y
CONFIG_PACKAGE_cypress-firmware-43430-sdio=m
CONFIG_PACKAGE_cypress-firmware-43455-sdio=m
CONFIG_PACKAGE_cypress-nvram-43430-sdio-rpi-3b=m
CONFIG_PACKAGE_cypress-nvram-43455-sdio-rpi-3b-plus=m
CONFIG_PACKAGE_hostapd-common=m
CONFIG_PACKAGE_iw=m
CONFIG_PACKAGE_iwinfo=m
CONFIG_PACKAGE_kmod-brcmfmac=m
CONFIG_PACKAGE_kmod-brcmutil=m
CONFIG_PACKAGE_kmod-cfg80211=m
CONFIG_PACKAGE_kmod-mmc=m
CONFIG_PACKAGE_libbpf=m
CONFIG_PACKAGE_libelf=m
CONFIG_PACKAGE_libiwinfo-lua=y
CONFIG_PACKAGE_liblua=y
CONFIG_PACKAGE_liblucihttp=y
CONFIG_PACKAGE_liblucihttp-lua=y
CONFIG_PACKAGE_libubus-lua=y
CONFIG_PACKAGE_lua=y
CONFIG_PACKAGE_luci=y
CONFIG_PACKAGE_luci-app-firewall=y
CONFIG_PACKAGE_luci-app-opkg=y
CONFIG_PACKAGE_luci-base=y
CONFIG_PACKAGE_luci-lib-base=y
CONFIG_PACKAGE_luci-lib-ip=y
CONFIG_PACKAGE_luci-lib-jsonc=y
CONFIG_PACKAGE_luci-lib-nixio=y
CONFIG_PACKAGE_luci-mod-admin-full=y
CONFIG_PACKAGE_luci-mod-network=y
CONFIG_PACKAGE_luci-mod-status=y
CONFIG_PACKAGE_luci-mod-system=y
CONFIG_PACKAGE_luci-proto-ipv6=y
CONFIG_PACKAGE_luci-proto-ppp=y
CONFIG_PACKAGE_luci-ssl=y
CONFIG_PACKAGE_luci-theme-bootstrap=y
CONFIG_PACKAGE_px5g-wolfssl=y
CONFIG_PACKAGE_qosify=m
CONFIG_PACKAGE_rpcd=y
CONFIG_PACKAGE_rpcd-mod-file=y
CONFIG_PACKAGE_rpcd-mod-iwinfo=y
CONFIG_PACKAGE_rpcd-mod-luci=y
CONFIG_PACKAGE_rpcd-mod-rrdns=y
CONFIG_PACKAGE_tc-full=m
CONFIG_PACKAGE_tc-mod-iptables=m
CONFIG_PACKAGE_uhttpd=y
CONFIG_PACKAGE_uhttpd-mod-ubus=y
CONFIG_PACKAGE_wireless-regdb=m
CONFIG_PACKAGE_wpad-basic-wolfssl=m
CONFIG_PACKAGE_zlib=m
CONFIG_REPRODUCIBLE_DEBUG_INFO=y
CONFIG_SDK=y
CONFIG_SDK_LLVM_BPF=y
CONFIG_USE_LLVM_BUILD=y
CONFIG_VERSIONOPT=y
CONFIG_VERSION_BUG_URL=""
CONFIG_VERSION_CODE="v0.1"
CONFIG_VERSION_DIST="Caipirinha-OS"
CONFIG_VERSION_FILENAMES=y
CONFIG_VERSION_HOME_URL=""
CONFIG_VERSION_HWREV=""
CONFIG_VERSION_MANUFACTURER=""
CONFIG_VERSION_MANUFACTURER_URL=""
CONFIG_VERSION_NUMBER=""
CONFIG_VERSION_PRODUCT=""
CONFIG_VERSION_REPO="https://downloads.openwrt.org/releases/22.03.5"
CONFIG_VERSION_SUPPORT_URL=""
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "openwrt"]
path = openwrt
url = https://github.com/openwrt/openwrt
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM debian:buster

ARG USER_ID
ARG GROUP_ID

RUN echo $USER_ID
RUN echo $GROUP_ID

RUN apt-get update &&\
apt-get install -y \
build-essential gawk gcc-multilib flex git gettext \
libncurses5 libncurses5-dev zlib1g-dev curl libsnmp-dev \
liblzma-dev sudo time git-core subversion g++ bash make \
libssl-dev patch wget unzip xz-utils python python-distutils-extra \
python3 python3-distutils python3-distutils-extra \
python3-setuptools libpam0g-dev cpio rsync && \
apt-get clean


RUN addgroup --gid $USER_ID user
RUN adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID user

VOLUME ['/usr/local/src/custom_firmware/']
WORKDIR /usr/local/src/custom_firmware/

USER user

# set dummy git config
RUN git config --global --add safe.directory '*'
86 changes: 82 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ Projeto aberto e colaborativo, estamos criando customizações para o OpenWRT, u

Grupo realiza encontro mensais para discutir sobre o projeto e suas futuras implementações.

# O Projeto está pausado. Iremos retornar com o projeto em março de 2023.
- Iremos realizar uma reunião para validar e definir pontos de desenvolvimento da versão do Caipirinha OS.


# Encontros [Pause]
- 27/janeiro/2022 - [OpenWRT-Capirinha-OS](https://meet.jit.si/capirinha-os)
- 27/maio/2021 - [OpenWRT- Demandas e compilados](https://discourse.lhc.net.br/t/29-04-2021-caipirinha-os-demandas-e-compilados/280)
Expand Down Expand Up @@ -48,3 +44,85 @@ Grupo realiza encontro mensais para discutir sobre o projeto e suas futuras impl
- Douglas Esteves
- Sicka
- Éliton
- Leandro Pereira

##
# Como preparar o contêiner de construção

A compilação é feita dentro de um contêiner docker.

Dentro deste repositório, execute:
``` bash
sudo env UID=$(id -u) GID=$(id -g) docker compose build
```

Certifique-se de inicializar os submódulos:
``` bash
atualização do submódulo git --init --recursive
```
Execute o contêiner

``` bash
sudo env UID=$(id -u) GID=$(id -g) docker compose run sindri
```

#
## Ambiente

Execute o script para preparar o ambiente (somente na primeira vez)
``` bash
./setup_build.sh
```

#
## Como compilar o firmware

Execute o contêiner:
``` bash
./build_image.sh -a caipirinha
```

## Opções avançadas:

Opcionalmente, limpe o conteúdo criado anteriormente:
``` bash
fazer distclean
```

Atualize os feeds:
``` bash
./scripts/feeds update -a
./scripts/feeds install -a
```

Gere o arquivo ```.config```:
``` bash
cp ../.config.caipirinha .config
fazer defconfig
```

Para criar uma nova configuração de diferenças
```
./scripts/diffconfig.sh > ../.config.caipirinha
```
### (Opcional) Ajustar configurações

``` bash
fazer menuconfig
```

### Construindo o Firmware
``` bash
fazer download
fazer -j4
```

Após a reclamação, as imagens podem ser encontradas na pasta **bin/targets/bcm27xx/bcm2710/**.
```openwrt-ath79-generic-comfast_cf-e5-squashfs-sysupgrade.bin```

### Como depurar se a compilação falhar?
``` bash
fazer download
fazer -j1 V=sc
```
Os comandos acima permitirão o detalhamento e a compilação em um único thread para obter uma visualização do erro durante a compilação.
126 changes: 126 additions & 0 deletions build_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
#!/usr/bin/env bash
#Build Arduino Yun Image for Dragino2. MS14, HE.

SFLAG=
AFLAG=
BFLAG=

APP="caipirinha"
IMAGE_SUFFIX=
BUILD_TIME=`date +%s`

REPO_PATH=$(pwd)
VERSION="22.03"
OPENWRT_PATH="openwrt"

while getopts 'a:p:sh' OPTION
do
case $OPTION in
a)
AFLAG=1
APP="$OPTARG"
;;
p) OPENWRT_PATH="$OPTARG"
;;

s) SFLAG=1
;;

h|?) printf "Build Image for Caipirinha\n\n"
printf "Usage: %s [-p <openwrt_source_path>] [-a <application>] [-s] \n" $(basename $0) >&2
printf " -a: application file to build\n"
printf " -s: build in singe thread\n"
printf "\n"
exit 1
;;
esac
done

shift $(($OPTIND - 1))


BUILD=$APP-$VERSION

BUILD_TIME="`date`"

ARCH="bcm27xx"

file_prefix="openwrt-caipirinha"
target_path="bin/targets/bcm27xx/bcm2710"

echo ""

echo "Remove custom files from last build"

rm -rf $OPENWRT_PATH/files

echo "***Copy general_files to OpenWrt***"
cp -r general_files $OPENWRT_PATH/files

echo "***.config.$APP to OpenWrt/.config***"
cp .config.$APP $OPENWRT_PATH/.config

cd $REPO_PATH

if [ -f .config.$APP ];then
echo ""
echo "***Find customized .config files***"
echo "Replace default .config file with .config.$APP"
echo ""
cp .config.$APP $OPENWRT_PATH/.config
else
echo ""
echo "***Can't find .config.$APP file***"
echo "Use default .config.$DEFAULT_APP"
echo ""
fi

echo ""

echo "***Entering build directory***"

cd $OPENWRT_PATH

make defconfig

#make sure fresh the luci-app on each build
#rm -rf build_dir/target-mips_24kc_musl/luci-app-*

echo ""

echo ""
echo "***Update build version and build date***"
echo "Build: $BUILD"
echo "Build time: $BUILD_TIME"
echo ""


[ -f ./$target_path/$file_prefix-squashfs-sysupgrade.bin ] && rm -rf ./$target_path/??*

echo ""
if [ ! -z $SFLAG ];then
echo "***Run make for single thread ***"
make -s V=99
else
echo "***Run make"
make -j $(($(nproc)+1)) download world
fi

if [ ! -f ./$target_path/$file_prefix-squashfs-sysupgrade.bin ];then
echo ""
echo "Build Fails, run below commands to build the image in single thread and check what is wrong"
echo "**************"
echo " ./build_image.sh -s V=99"
echo "**************"
exit 0
fi

echo "Copy Image"
echo "Set up new directory name with date"
DATE=`date +%Y%m%d-%H%M`
mkdir -p $REPO_PATH/image/$APP-build-v$VERSION
IMAGE_DIR=$REPO_PATH/image/$APP-build-v$VERSION

echo ""
echo "***Move files to ./image/$APP-build--v$VERSION***"
cp ./$target_path/$file_prefix-squashfs-sysupgrade.bin $IMAGE_DIR/caipirinha-$APP-squashfs-sysupgrade.bin
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: '3'
services:
sindri:
#user: "1001:1001" #"${UID}:${GID}"
build:
context: .
dockerfile: Dockerfile
args:
USER_ID: ${UID}
GROUP_ID: ${GID}
volumes:
- ./:/usr/local/src/custom_firmware/
ulimits:
nofile:
soft: 64000
hard: 64000


4 changes: 4 additions & 0 deletions feeds.caipirinha
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src-git-full packages https://git.openwrt.org/feed/packages.git^d057936acbefd76b033e7c365baa68b48ccb9166
src-git-full luci https://git.openwrt.org/project/luci.git^0b38d70fbd47b0c702d5001de623213eb301a6fe
src-git-full routing https://git.openwrt.org/feed/routing.git^1cc7676b9f32acc30ec47f15fcb70380d5d6ef01
src-git-full telephony https://git.openwrt.org/feed/telephony.git^36d9f2f962bd0aba2eef674eb265819609ea99ed
14 changes: 14 additions & 0 deletions general_files/etc/banner
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
______ _ _ _ __ ____ _____
/ ____/___ _(_)___ (_)____(_)___ / /_ ____ _ / __ \/ ___/
/ / / __ `/ / __ \/ / ___/ / __ \/ __ \/ __ `/_____/ / / /\__ \
/ /___/ /_/ / / /_/ / / / / / / / / / / / /_/ /_____/ /_/ /___/ /
\____/\__,_/_/ .___/_/_/ /_/_/ /_/_/ /_/\__,_/ \____//____/
/_/
W i F i, L i n u x, M C U, E m b e d d e d

OpenWRT 22.03
Version: VERSION
Build TIME

----------------------------------------------------

1 change: 1 addition & 0 deletions openwrt
Submodule openwrt added at 863f76
Loading

0 comments on commit 9948f0c

Please sign in to comment.