Browse Source

Rough backport of ccsdisk support

RISCi_ATOM 5 years ago
parent
commit
d42955b2d0
7 changed files with 186 additions and 2 deletions
  1. 2 0
      Config.in
  2. 2 0
      Makefile
  3. 23 0
      docs/ccs.md
  4. 3 2
      target/Makefile
  5. 21 0
      target/ccsdisk/Config.in
  6. 41 0
      target/ccsdisk/Makefile
  7. 94 0
      target/ccsdisk/files/README

+ 2 - 0
Config.in

@@ -31,4 +31,6 @@ source "target/sdk/Config.in"
 
 source "target/toolchain/Config.in"
 
+source "target/ccsdisk/Config.in"
+
 source "tmp/.config-package.in"

+ 2 - 0
Makefile

@@ -87,6 +87,8 @@ prereq: $(target/stamp-prereq) tmp/.prereq_packages
 checksum: FORCE
 	$(call sha256sums,$(BIN_DIR))
 
+ccsdisk: $(target/ccsdisk/install)
+
 diffconfig: FORCE
 	mkdir -p $(BIN_DIR)
 	$(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.seed

+ 23 - 0
docs/ccs.md

@@ -0,0 +1,23 @@
+# CCS (Complete Corresponding Source) Requirements
+
+As a Free Software project, libreCMC works to go above and
+beyond its license obligations to be a good neighbor and to
+promote the ideals of Free Software. The project was founded
+on the idea that everyone should have the *freedom* to control
+the hardware they own, which means being able to fully control
+what it does and what runs on it. To ensure that everyone continues
+to have this freedom, a mechanism was added to the build system [1]
+to generate a CCS disk which OEMs and others would be able to
+distribute with devices for compliance and to push the idea that
+sources should be provided with a device at the time of sale.
+
+## `make ccsdisk`
+
+A new target was created to build a CCS disk based upon the option of upstream
+sources or to use a local checkout. As it stands, this includes everything except
+for u-boot sources for a given target. In the near future, the libreCMC project
+will start including versions of u-boot for all offically supported targets and
+going forward a requirement for offical hardware support will be u-boot in libreCMC.
+
+
+[1] libreCMC is a fork of OpenWrt, which both use a fork of [Buildroot](https://buildroot.org).

+ 3 - 2
target/Makefile

@@ -6,12 +6,13 @@
 #
 curdir:=target
 
-$(curdir)/builddirs:=linux sdk imagebuilder toolchain
+$(curdir)/builddirs:=linux sdk imagebuilder toolchain ccsdisk
 $(curdir)/builddirs-default:=linux
-$(curdir)/builddirs-install:=linux $(if $(CONFIG_SDK),sdk) $(if $(CONFIG_IB),imagebuilder) $(if $(CONFIG_MAKE_TOOLCHAIN),toolchain)
+$(curdir)/builddirs-install:=linux $(if $(CONFIG_SDK),sdk) $(if $(CONFIG_IB),imagebuilder) $(if $(CONFIG_MAKE_TOOLCHAIN),toolchain) $(if $(CONFIG_CCS),ccsdisk)
 
 $(curdir)/sdk/install:=$(curdir)/linux/install
 $(curdir)/imagebuilder/install:=$(curdir)/linux/install
+$(curdir)/ccsdisk/install:=$(curdir)/ccsdisk/install
 
 $(eval $(call stampfile,$(curdir),target,prereq,.config))
 $(eval $(call stampfile,$(curdir),target,compile,$(TMP_DIR)/.build))

+ 21 - 0
target/ccsdisk/Config.in

@@ -0,0 +1,21 @@
+menuconfig CCS
+        bool "Build the libreCMC CCS (Complete Corresponding Source) Disk"
+        depends on !EXTERNAL_TOOLCHAIN
+        default BUILDBOT
+        help
+          This generates a CCS disk for distribution with devices that ship
+	  with libreCMC. Note that this may omit some components, ex. u-boot
+	  for a given target, which should be part of the CCS. Please see /docs/ccs.md
+
+	config CCS_GIT_UPSTREAM
+		string "Enter git repository to clone" if CCS
+		default "https://gogs.librecmc.org/librecmc" if !CCS_GIT_TOPDIR
+
+	config CCS_GIT_TOPDIR
+		bool "Use local checkout for sources" if CCS
+		help
+		  If using this option, make sure that all changes have been
+		  properly checked in.
+
+
+

+ 41 - 0
target/ccsdisk/Makefile

@@ -0,0 +1,41 @@
+#
+# Copyright (C) 2019 Robert Call <bob@bobcall.me>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+include $(INCLUDE_DIR)/version.mk
+
+override MAKEFLAGS=
+
+CCS_NAME:=$(VERSION_DIST_SANITIZED)-$(VERSION_NUMBER)-src
+CCS_BUILD_DIR:=$(BUILD_DIR)/$(CCS_NAME)
+ISO_BUILD_DIR:=$(CCS_BUILD_DIR)/iso
+
+all: install
+
+$(BIN_DIR)/$(CCS_NAME).tar.gz:
+	mkdir -p $(BIN_DIR)
+	mkdir -p $(CCS_BUILD_DIR)
+	$(if $(CONFIG_CCS_GIT_TOPDIR),(cd $(CCS_BUILD_DIR); git clone $(TOPDIR) librecmc),(cd $(CCS_BUILD_DIR); git clone $(CONFIG_CCS_GIT_UPSTREAM) librecmc))
+	$(CP) $(TOPDIR)/.config $(CCS_BUILD_DIR)/librecmc
+	$(CP) -r $(TOPDIR)/dl $(CCS_BUILD_DIR)/librecmc/
+
+createiso:
+	mkdir -p $(ISO_BUILD_DIR)/bin/$(BOARD)
+	(cd $(CCS_BUILD_DIR); $(TAR) -czf $(ISO_BUILD_DIR)/$(CCS_NAME).tar.gz librecmc)
+	$(CP) ./files/README $(ISO_BUILD_DIR)
+	$(CP) $(BIN_DIR) $(ISO_BUILD_DIR)/bin/$(BOARD)
+	$(VERSION_SED_SCRIPT) $(ISO_BUILD_DIR)/README
+	genisoimage -J -joliet-long -r -o $(BIN_DIR)/$(CCS_NAME).iso $(ISO_BUILD_DIR)
+
+download:
+compile:
+install: clean $(BIN_DIR)/$(CCS_NAME).tar.gz createiso
+
+
+clean:
+	rm -rf $(CCS_BUILD_DIR) $(BIN_DIR)/$(CCS_NAME).tar.gz $(BIN_DIR)/$(CCS_NAME)-src.iso

+ 94 - 0
target/ccsdisk/files/README

@@ -0,0 +1,94 @@
+                    ____  _____	 ____  
+  _ _ _            |  __||     ||  __| 
+ | (_) |__ _ _ ___ | |   | | | || |    
+ | | | '_ \ '_/ -_)| |__ | | | || |__  
+ |_|_|_.__/_| \___||____||_|_|_||____| 
+ -----------------------------------------
+  The libre embedded GNU/Linux distro.
+
+This compact disk contains the source code and firmware images
+for the %T line of routers.
+
+
+Disk Layout:
+============================
+
+/bin/%T/*				: Contains firmware images for %T family of routers
+
+ 
+libreCMC-%V-src.tar.gz		: The full libreCMC source code w/ original configuration.
+
+
+Building libreCMC image from source:
+============================
+
+To build your own firmware, you need to have access to a GNU/Linux system
+(case-sensitive filesystem required) with the following installed :
+
+gcc, binutils, bzip2, flex, python, perl, make, find,
+grep, diff, unzip, gawk, getopt, libssl-dev (openssl-devel), libz-dev and libc headers.
+
+References to this and other documentation use : "$LIBRECMC_SRC" , which
+is the directory where the libreCMC source code resides.
+
+Before starting, please extract : libreCMC-%V.tar.gz
+
+tar fxv librecmc-%V.tar.gz
+
+cd libreCMC/
+
+Within the libreCMC src. directory (in this case, trunk), please use "make menuconfig" to create your 
+desired configuration for the toolchain and firmware. Please note that the default configuration is 
+what was used to build the firmware image for your router. It is advised that you use this configuration. If
+you need to restore the default configuration, copy librecmc_config to libreCMC/trunk/.config
+
+Simply running "make" will build your firmware. The build system will extract all included sources, 
+build the cross-compile toolchain, the kernel and all chosen applications. If there is an issue, please run:
+
+make V=s
+
+This will show debugging output and give a clue as to why the build failed.
+
+When the build completes without any issues, the resulting librecmc-ar71xx-generic-tpe-r1100-squashfs-sysupgrade.bin image will 
+be found in : $SRC_ROOT/bin/targets/ar71xx/
+
+Flashing The libreCMC firmware
+============================
+
+1) Open a web browser and go to : https://192.168.10.1
+
+2) You will see a security warning because SSL cert is self-
+signed. Click the "understand the risks" and then "add exception" buttons.
+
+3) Enter the admin password for the router (stock password is : none )
+
+4) The backup / flash utility is under "System -> Backup / Flash Firmware".
+
+5) Make sure to backup your configuration (if you are upgrading to a new release)
+by clicking the "Generate archive" button. This will download a file named 
+backup-libreCMC-$(DATE).tar.gz
+
+6) Upload the new firmware by clicking the "browse" button under "Flash new firmware image".
+If you wish to keep your current settings, make sure that the "Keep Settings" checkbox is
+checked. If the file name is correct, make sure to click the "Flash Image" button.
+
+7) Wait a about 1 - 2.5 min. The router will restart itself then the page should refresh, bringing
+you back to the login page. 
+
+
+Final Words
+============================
+
+We would like to thank you for supporting the libreCMC project. If you find any 
+software in this release that is non-free software, please report it to info@librecmc.org. 
+We will review the offending piece of software and devise a workaround or patch. 
+libreCMC aims to always be a 100% libre Free Software project.
+
+
+Happy Hacking,
+
+	Your libreCMC Project
+	http://librecmc.org
+	info@librecmc.org
+
+