mirror of
				https://github.com/brain-hackers/buildbrain
				synced 2025-11-04 06:18:34 +09:00 
			
		
		
		
	Add files
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
env
 | 
			
		||||
							
								
								
									
										5
									
								
								LICENSE
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								LICENSE
									
									
									
									
									
								
							@@ -1,6 +1,9 @@
 | 
			
		||||
# The copyright notice and the license agreement is applied to all portions
 | 
			
		||||
# in this repository except the ones in submodules.
 | 
			
		||||
 | 
			
		||||
MIT License
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2020 Takumi Sueda
 | 
			
		||||
Copyright (c) 2020 Takumi Sueda <puhitaku@gmail.com>
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										59
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,59 @@
 | 
			
		||||
export ARCH=arm
 | 
			
		||||
export CROSS_COMPILE=arm-linux-gnueabi-
 | 
			
		||||
 | 
			
		||||
.PHONY:
 | 
			
		||||
setup:
 | 
			
		||||
	@echo "Updating submodules"
 | 
			
		||||
	@git submodule update --init --recursive
 | 
			
		||||
	@echo "Creating venv"
 | 
			
		||||
	@python3 -m venv env
 | 
			
		||||
	@echo "Installing r3build"
 | 
			
		||||
	@. ./env/bin/activate; \
 | 
			
		||||
	pip install r3build
 | 
			
		||||
 | 
			
		||||
.PHONY:
 | 
			
		||||
watch:
 | 
			
		||||
	@echo "Watching changes in linux-brain and u-boot-brain"
 | 
			
		||||
	@. ./env/bin/activate; \
 | 
			
		||||
	@python3 -m r3build
 | 
			
		||||
 | 
			
		||||
.PHONY:
 | 
			
		||||
udefconfig:
 | 
			
		||||
	make -C ./u-boot-brain mx28evk_defconfig
 | 
			
		||||
 | 
			
		||||
.PHONY:
 | 
			
		||||
umenuconfig:
 | 
			
		||||
	make -C ./u-boot-brain menuconfig
 | 
			
		||||
 | 
			
		||||
.PHONY:
 | 
			
		||||
ubuild:
 | 
			
		||||
	make -j12 -C ./u-boot-brain u-boot.sb
 | 
			
		||||
 | 
			
		||||
.PHONY:
 | 
			
		||||
ldefconfig:
 | 
			
		||||
	make -C ./linux-brain mxs_defconfig
 | 
			
		||||
 | 
			
		||||
.PHONY:
 | 
			
		||||
lmenuconfig:
 | 
			
		||||
	make -C ./linux-brain menuconfig
 | 
			
		||||
 | 
			
		||||
.PHONY:
 | 
			
		||||
lsavedefconfig:
 | 
			
		||||
	make -C ./linux-brain savedefconfig
 | 
			
		||||
	cp ./linux-brain/defconfig ./linux-brain/arch/arm/configs/mxs_defconfig
 | 
			
		||||
 | 
			
		||||
.PHONY:
 | 
			
		||||
lbuild:
 | 
			
		||||
	make -C ./linux-brain -j12
 | 
			
		||||
 | 
			
		||||
.PHONY:
 | 
			
		||||
uuu:
 | 
			
		||||
	sudo uuu ./u-boot-brain/u-boot.sb
 | 
			
		||||
 | 
			
		||||
debian:
 | 
			
		||||
	mkdir debian
 | 
			
		||||
	sudo debootstrap --arch=armel --foreign buster debian/
 | 
			
		||||
	sudo cp /usr/bin/qemu-arm-static debian/usr/bin/
 | 
			
		||||
	sudo cp setup_debian.sh debian/
 | 
			
		||||
	sudo chroot debian /setup_debian.sh
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										70
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										70
									
								
								README.md
									
									
									
									
									
								
							@@ -1 +1,69 @@
 | 
			
		||||
# buildbrain
 | 
			
		||||
buildbrain
 | 
			
		||||
==========
 | 
			
		||||
 | 
			
		||||
This repository includes:
 | 
			
		||||
 | 
			
		||||
 - linux-brain and u-boot-brain as submodules
 | 
			
		||||
 - Useful build targets in Makefile
 | 
			
		||||
 - r3build.toml to watch changes that occur in submodules
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Getting Started
 | 
			
		||||
---------------
 | 
			
		||||
 | 
			
		||||
1. Clone this repository with recursive clone enabled.
 | 
			
		||||
 | 
			
		||||
    ```
 | 
			
		||||
    $ git clone --recursive git@github.com:puhitaku/buildbrain.git
 | 
			
		||||
    ```
 | 
			
		||||
 | 
			
		||||
    - If you've cloned it without `--recursive`, run following command:
 | 
			
		||||
 | 
			
		||||
    ```
 | 
			
		||||
    $ git submodule update --init --recursive
 | 
			
		||||
    ```
 | 
			
		||||
 | 
			
		||||
2. Then run `make setup` to prepare an build environment. Namely;
 | 
			
		||||
 | 
			
		||||
    - Python 3 venv in `env`
 | 
			
		||||
    - r3build command in the env
 | 
			
		||||
 | 
			
		||||
3. Install uuu.
 | 
			
		||||
 | 
			
		||||
    - Follow [the instruction](https://github.com/NXPmicro/mfgtools#linux) and build `uuu` executable.
 | 
			
		||||
    - Put `uuu` where the PATH executable points to.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Build and inject U-Boot
 | 
			
		||||
-----------------------
 | 
			
		||||
 | 
			
		||||
1. Run `make udefconfig` to generate `.config`.
 | 
			
		||||
 | 
			
		||||
2. Run `make ubuild` to build whole repository and generate `u-boot.sb`.
 | 
			
		||||
 | 
			
		||||
    - i.MX283 loads a packed U-Boot executable called `u-boot.sb`.
 | 
			
		||||
 | 
			
		||||
3. To inject the executable into i.MX283 in recovery mode, run `make uuu`.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Build Linux
 | 
			
		||||
-----------
 | 
			
		||||
 | 
			
		||||
1. Run `make ldefconfig` to generate `.config`.
 | 
			
		||||
 | 
			
		||||
1. Run `make lbuild` to generate `zImage`.
 | 
			
		||||
 | 
			
		||||
1. Confirm that `linux-brain/arch/arm/boot/zImage` exists.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Watch changes in submodules & auto-build
 | 
			
		||||
----------------------------------------
 | 
			
		||||
 | 
			
		||||
1. Run `r3build`. It'll detect the changes you make and builds the corresponding executable automatically.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
What's r3build?
 | 
			
		||||
---------------
 | 
			
		||||
 | 
			
		||||
[r3build](https://github.com/puhitaku/r3build) is a smart file watcher that aims to provide hot-reloading feature like Web frontend development.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										38
									
								
								r3build.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								r3build.toml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
[log]
 | 
			
		||||
  time = true
 | 
			
		||||
 | 
			
		||||
[[job]]
 | 
			
		||||
  name = "U-Boot"
 | 
			
		||||
  path = './u-boot-brain'
 | 
			
		||||
 | 
			
		||||
  type = "make"
 | 
			
		||||
  directory = "u-boot-brain"
 | 
			
		||||
  target = "u-boot.sb"
 | 
			
		||||
 | 
			
		||||
  when = "modified"
 | 
			
		||||
  glob = [
 | 
			
		||||
    './u-boot-brain/*.c',
 | 
			
		||||
    './u-boot-brain/*.h',
 | 
			
		||||
    './u-boot-brain/*.dts',
 | 
			
		||||
    './u-boot-brain/*config',
 | 
			
		||||
  ]
 | 
			
		||||
 | 
			
		||||
  environment.ARCH = "arm"
 | 
			
		||||
  environment.CROSS_COMPILE = "arm-linux-gnueabi-"
 | 
			
		||||
 | 
			
		||||
[[job]]
 | 
			
		||||
  name = "Linux"
 | 
			
		||||
  path = "./linux-brain"
 | 
			
		||||
 | 
			
		||||
  type = "make"
 | 
			
		||||
  target = "lbuild"
 | 
			
		||||
 | 
			
		||||
  when = "modified"
 | 
			
		||||
  regex = [
 | 
			
		||||
    './linux-brain/.+\.[ch]$',
 | 
			
		||||
    './linux-brain/.+\.dts$',
 | 
			
		||||
  ]
 | 
			
		||||
 | 
			
		||||
  environment.ARCH = "arm"
 | 
			
		||||
  environment.CROSS_COMPILE = "arm-linux-gnueabi-"
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										51
									
								
								scripts/setup_debian.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										51
									
								
								scripts/setup_debian.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,51 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
TIMEZONE="Asia/Tokyo"
 | 
			
		||||
 | 
			
		||||
/debootstrap/debootstrap --second-stage
 | 
			
		||||
 | 
			
		||||
cat <<EOF > /etc/apt/sources.list
 | 
			
		||||
deb http://ftp.jaist.ac.jp/debian buster main contrib non-free
 | 
			
		||||
deb-src http://ftp.jaist.ac.jp/debian buster main contrib non-free
 | 
			
		||||
deb http://ftp.jaist.ac.jp/debian buster-updates main contrib non-free
 | 
			
		||||
deb-src http://ftp.jaist.ac.jp/debian buster-updates main contrib non-free
 | 
			
		||||
deb http://security.debian.org/debian-security buster/updates main contrib non-free
 | 
			
		||||
deb-src http://security.debian.org/debian-security buster/updates main contrib non-free
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
cat <<EOF > /etc/apt/apt.conf.d/90-norecommend
 | 
			
		||||
APT::Install-Recommends "0";
 | 
			
		||||
APT::Install-Suggests "0";
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
apt update -y
 | 
			
		||||
apt install -y locales
 | 
			
		||||
 | 
			
		||||
echo "$TIMEZONE" > /etc/timezone && \
 | 
			
		||||
    dpkg-reconfigure -f noninteractive tzdata && \
 | 
			
		||||
    sed -i -e 's/# en_US.UTF-8 UTF-8/en_us.UTF-8 UTF-8/' /etc/locale.gen && \
 | 
			
		||||
    echo 'LANG="en_US.UTF-8"' > /etc/default/locale && \
 | 
			
		||||
    dpkg-reconfigure -f noninteractive locales && \
 | 
			
		||||
    update-locale LANG=en_US.UTF-8
 | 
			
		||||
 | 
			
		||||
echo "brain" > /etc/hostname
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
echo root:root | chpasswd
 | 
			
		||||
 | 
			
		||||
cat <<EOF >> /etc/securetty
 | 
			
		||||
ttymxc0
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
DEBIAN_FRONTEND=noninteractive \
 | 
			
		||||
    apt install -y dialog sudo \
 | 
			
		||||
                   libjpeg-dev libfreetype6 libfreetype6-dev zlib1g-dev \
 | 
			
		||||
                   xserver-xorg xserver-xorg-video-fbdev xserver-xorg-dev xorg-dev x11-apps \
 | 
			
		||||
                   openbox obconf obmenu \
 | 
			
		||||
                   weston xwayland \
 | 
			
		||||
                   bash tmux vim htop \
 | 
			
		||||
                   midori pcmanfm lxterminal xterm gnome-terminal fonts-noto-cjk \
 | 
			
		||||
                   dbus udev build-essential flex bison pkg-config autotools-dev libtool autoconf automake \
 | 
			
		||||
                   python3 python3-dev python3-setuptools python3-wheel python3-pip \
 | 
			
		||||
                   resolvconf net-tools ssh openssh-client avahi-daemon
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user