Compare commits
1 Commits
master
...
mes-x86_64
Author | SHA1 | Date |
---|---|---|
Andrius Štikonas | 7fe5cd2ae5 |
|
@ -12,8 +12,8 @@ on:
|
|||
- master
|
||||
|
||||
jobs:
|
||||
pass1:
|
||||
name: Run up to Linux build under bubblewrap
|
||||
run:
|
||||
name: Run under bubblewrap
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install bubblewrap
|
||||
|
@ -30,8 +30,9 @@ jobs:
|
|||
uses: actions/cache/restore@v3
|
||||
with:
|
||||
path: |
|
||||
distfiles
|
||||
key: cache-${{ hashFiles('steps/*/sources') }}
|
||||
sysa/distfiles
|
||||
sysc/distfiles
|
||||
key: cache-${{ hashFiles('sys*/*/sources') }}
|
||||
- name: Get sources
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: ./download-distfiles.sh
|
||||
|
@ -40,119 +41,15 @@ jobs:
|
|||
uses: actions/cache/save@v3
|
||||
with:
|
||||
path: |
|
||||
distfiles
|
||||
key: cache-${{ hashFiles('steps/*/sources') }}
|
||||
sysa/distfiles
|
||||
sysc/distfiles
|
||||
key: cache-${{ hashFiles('sys*/*/sources') }}
|
||||
- name: Run bootstrap
|
||||
run: ./rootfs.py --bwrap --external-sources --build-kernels --cores 2 --internal-ci pass1
|
||||
id: bootstrap
|
||||
run: ./rootfs.py --bwrap --external-sources --build-kernels --preserve --cores 2
|
||||
- name: Archive created packages
|
||||
if: failure() # archive failed builds progress
|
||||
if: always() # archive failed builds
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: packages
|
||||
path: target/external/repo/**
|
||||
- name: Tar pass1 image
|
||||
run: tar -cf pass1_image.tar target
|
||||
- name: Archive pass1_image
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: internal_pass1_image
|
||||
path: pass1_image.tar
|
||||
|
||||
pass2:
|
||||
name: Run up to Python bootstrap under bubblewrap
|
||||
needs: pass1
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install bubblewrap
|
||||
run: sudo apt install bubblewrap
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
# There is a strange bug(?) in nongnu, when you clone a git repository
|
||||
# against a commit != HEAD with depth=1, it errors out.
|
||||
fetch-depth: 0
|
||||
- name: Get pass1_image
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: internal_pass1_image
|
||||
- name: Extract pass1_image
|
||||
run: tar -xf pass1_image.tar
|
||||
- name: Query cache for sources
|
||||
id: cache
|
||||
uses: actions/cache/restore@v3
|
||||
with:
|
||||
path: |
|
||||
distfiles
|
||||
key: cache-${{ hashFiles('steps/*/sources') }}
|
||||
- name: Get sources
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: ./download-distfiles.sh
|
||||
- name: Cache sources
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@v3
|
||||
with:
|
||||
path: |
|
||||
distfiles
|
||||
key: cache-${{ hashFiles('steps/*/sources') }}
|
||||
- name: Run bootstrap
|
||||
run: ./rootfs.py --bwrap --external-sources --build-kernels --cores 2 --internal-ci pass2
|
||||
- name: Archive created packages
|
||||
if: failure() # archive failed builds progress
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: internal_packages_pass2
|
||||
path: target/external/repo/**
|
||||
- name: Tar pass2 image
|
||||
run: tar -cf pass2_image.tar target
|
||||
- name: Archive pass2_image
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: internal_pass2_image
|
||||
path: pass2_image.tar
|
||||
|
||||
pass3:
|
||||
name: Run remaining builds under bubblewrap
|
||||
needs: pass2
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install bubblewrap
|
||||
run: sudo apt install bubblewrap
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
# There is a strange bug(?) in nongnu, when you clone a git repository
|
||||
# against a commit != HEAD with depth=1, it errors out.
|
||||
fetch-depth: 0
|
||||
- name: Get pass2_image
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: internal_pass2_image
|
||||
- name: Extract pass2_image
|
||||
run: tar -xf pass2_image.tar
|
||||
- name: Query cache for sources
|
||||
id: cache
|
||||
uses: actions/cache/restore@v3
|
||||
with:
|
||||
path: |
|
||||
distfiles
|
||||
key: cache-${{ hashFiles('steps/*/sources') }}
|
||||
- name: Get sources
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: ./download-distfiles.sh
|
||||
- name: Cache sources
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@v3
|
||||
with:
|
||||
path: |
|
||||
distfiles
|
||||
key: cache-${{ hashFiles('steps/*/sources') }}
|
||||
- name: Run bootstrap
|
||||
run: ./rootfs.py --bwrap --external-sources --build-kernels --cores 2 --internal-ci pass3
|
||||
- name: Archive created packages
|
||||
if: always() # archive both failed and successful builds
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: packages
|
||||
path: target/external/repo/**
|
||||
path: tmp/sysa/sysc_image/usr/src/repo/**
|
||||
|
|
|
@ -21,7 +21,7 @@ jobs:
|
|||
- name: Install pylint
|
||||
run: sudo pip3 install pylint
|
||||
- name: pylint
|
||||
run: pylint rootfs.py lib/utils.py lib/generator.py lib/target.py check_substitutes.py --disable=duplicate-code
|
||||
run: pylint rootfs.py sysa.py sysc.py lib/utils.py lib/sysgeneral.py lib/tmpdir.py --disable=duplicate-code
|
||||
|
||||
shellcheck:
|
||||
name: Lint shell files
|
||||
|
@ -30,7 +30,7 @@ jobs:
|
|||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
- name: shellcheck
|
||||
run: shellcheck steps/helpers.sh download-distfiles.sh
|
||||
run: shellcheck sysa/run.sh sysa/run2.sh sysb/init sysb/run.sh sysc/init sysc/run.sh sysa/helpers.sh download-distfiles.sh
|
||||
|
||||
reuse:
|
||||
name: Lint reuse information
|
||||
|
@ -42,12 +42,3 @@ jobs:
|
|||
run: sudo pip3 install reuse
|
||||
- name: reuse
|
||||
run: reuse lint
|
||||
|
||||
substitutes:
|
||||
name: Check validity of substituted tarballs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
- name: Check validity of substitutes
|
||||
run: ./check_substitutes.py
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
target/
|
||||
tmp/
|
||||
kernel
|
||||
distfiles/
|
||||
sysa/distfiles/
|
||||
sysc/distfiles/
|
||||
__pycache__
|
||||
steps/bootstrap.cfg
|
||||
sysa/bootstrap.cfg
|
||||
|
|
|
@ -2,10 +2,7 @@
|
|||
# SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
[submodule "seed/stage0-posix"]
|
||||
path = seed/stage0-posix
|
||||
url = https://github.com/oriansj/stage0-posix
|
||||
|
||||
[submodule "builder-hex0"]
|
||||
path = builder-hex0
|
||||
url = https://github.com/ironmeld/builder-hex0
|
||||
[submodule "sysa/stage0-posix/src"]
|
||||
path = sysa/stage0-posix/src
|
||||
url = https://github.com/oriansj/stage0-posix/
|
||||
|
|
|
@ -9,6 +9,6 @@ Source: https://github.com/fosslinux/live-bootstrap
|
|||
# Copyright: $YEAR $NAME <$CONTACT>
|
||||
# License: ...
|
||||
|
||||
Files: steps/*/sources steps/*/*.checksums steps/SHA256SUMS.pkgs steps/*/simple-patches/* seed/*.checksums
|
||||
Files: sys*/*/sources sys*/SHA256SUMS.sources sysa/checksum-transcriber.*.SHA256SUM sysa/pre-sha.sha256sums sysa/*/*.checksums sysa/SHA256SUMS.pkgs sysc/musl-1.2.3/ld-musl-i386.path sysa/*/simple-patches/*
|
||||
Copyright: none
|
||||
License: MIT
|
||||
|
|
60
DEVEL.md
60
DEVEL.md
|
@ -14,40 +14,31 @@ and that a full build completes.
|
|||
|
||||
## Structure
|
||||
|
||||
```
|
||||
seed
|
||||
├── seed.kaem
|
||||
├── script-generator.c
|
||||
├── ...
|
||||
└── stage0-posix
|
||||
Each system corresponds to a reboot of the live environment. There is only one
|
||||
appropriate structure as shown below (eg for sysa):
|
||||
|
||||
steps
|
||||
├── manifest
|
||||
├── any-global-files
|
||||
├── jump
|
||||
│ └── linux.sh
|
||||
├── improve
|
||||
│ └── x.sh
|
||||
```
|
||||
sysa
|
||||
├── any-global-files.sh
|
||||
├── somepackage-version
|
||||
│ ├── pass1.kaem
|
||||
│ ├── pass2.sh
|
||||
│ ├── somepackage-version.kaem (or .sh)
|
||||
│ ├── files
|
||||
│ ├── simple-patches
|
||||
│ ├── mk
|
||||
│ └── patches
|
||||
└── tmp
|
||||
```
|
||||
|
||||
The `seed` directory contains everything required for `script-generator` to be
|
||||
run.
|
||||
Global scripts that drive the entire system go directly under `sysx`. `tmp`
|
||||
contains the temporary system used for QEMU or a chroot.
|
||||
|
||||
In the `steps` directory, the bootstrap process is defined in `manifest`.
|
||||
Each package to be built is named `package-version`.
|
||||
Each subsequent build of a package is the nth pass. Scripts are named
|
||||
accordingly; eg, the first build would be called `pass1.sh`, the second would be
|
||||
`pass2.sh`, etc.
|
||||
Scripts run in kaem era should be denoted as such in their filename;
|
||||
`pass1.kaem`, for example. Pass numbers do not reset after kaem, ie, you cannot
|
||||
have both `pass1.kaem` and `pass1.sh`.
|
||||
Then, each package is in its own specific directory, named `package-version`.
|
||||
It then diverges based upon which driver is being used:
|
||||
|
||||
- `kaem`: A file named `package-version.kaem` is called by the master script.
|
||||
- `bash`: The `build` function from helper.sh is called from the master script.
|
||||
There are default functions run which can be overridden by an optional script
|
||||
`package-version.sh` within the package-specific directory.
|
||||
|
||||
In this folder, there are other folders/files. `*.checksums` are
|
||||
required for early packages that are build with kaem, others are optional.
|
||||
|
@ -60,16 +51,21 @@ Permissible folders/files:
|
|||
- `simple-patches`: patches for the source that use the before/after convention of simple-patch.c
|
||||
- `*.checksums`: files containing the checksums for the resulting binaries and
|
||||
libraries that are compiled and installed.
|
||||
- Otherwise, the package's checksum is in SHA256SUMS.pkgs.
|
||||
- compilation script(s)
|
||||
- Up to and including `coreutils-6.10`, `sha256sum` from `stage0-posix`
|
||||
is used for the checksumming. Later we switch to GNU version.
|
||||
- To extract checksums of the binaries, use of qemu mode is recommended
|
||||
(i.e. `./rootfs.py -q -qk $kernel --update-checksums`).
|
||||
- compilation script
|
||||
|
||||
The directory m2-functions is used for M2-Planet functions (currently).
|
||||
|
||||
## Conventions
|
||||
|
||||
- **Patches:**
|
||||
- all patches are `-p0`
|
||||
- all patches begin with a patch header
|
||||
- **parts.rst:**
|
||||
- all packages are explained in `parts.rst`
|
||||
- **README:**
|
||||
- all stages are explained in README
|
||||
- **General:**
|
||||
- Where possible, all blocks of text should be limited to a length of 80
|
||||
characters.
|
||||
|
@ -83,3 +79,9 @@ libraries that are compiled and installed.
|
|||
- Patches are licensed under the license of the project which they are
|
||||
patching.
|
||||
- All files (excluding files within submodules) must comply with REUSE v3.0.
|
||||
|
||||
## git
|
||||
|
||||
All changes must be submitted as PRs. Pushing to master is disallowed, even if
|
||||
push access is granted to a user. Only pushes to master should be merging of
|
||||
patches into master.
|
||||
|
|
|
@ -1,121 +0,0 @@
|
|||
Creative Commons Legal Code
|
||||
|
||||
CC0 1.0 Universal
|
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||
HEREUNDER.
|
||||
|
||||
Statement of Purpose
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer
|
||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||
authorship and/or a database (each, a "Work").
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for
|
||||
the purpose of contributing to a commons of creative, cultural and
|
||||
scientific works ("Commons") that the public can reliably and without fear
|
||||
of later claims of infringement build upon, modify, incorporate in other
|
||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||
and for any purposes, including without limitation commercial purposes.
|
||||
These owners may contribute to the Commons to promote the ideal of a free
|
||||
culture and the further production of creative, cultural and scientific
|
||||
works, or to gain reputation or greater distribution for their Work in
|
||||
part through the use and efforts of others.
|
||||
|
||||
For these and/or other purposes and motivations, and without any
|
||||
expectation of additional consideration or compensation, the person
|
||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||
protected by copyright and related or neighboring rights ("Copyright and
|
||||
Related Rights"). Copyright and Related Rights include, but are not
|
||||
limited to, the following:
|
||||
|
||||
i. the right to reproduce, adapt, distribute, perform, display,
|
||||
communicate, and translate a Work;
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
iii. publicity and privacy rights pertaining to a person's image or
|
||||
likeness depicted in a Work;
|
||||
iv. rights protecting against unfair competition in regards to a Work,
|
||||
subject to the limitations in paragraph 4(a), below;
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||
in a Work;
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||
European Parliament and of the Council of 11 March 1996 on the legal
|
||||
protection of databases, and under any national implementation
|
||||
thereof, including any amended or successor version of such
|
||||
directive); and
|
||||
vii. other similar, equivalent or corresponding rights throughout the
|
||||
world based on applicable law or treaty, and any national
|
||||
implementations thereof.
|
||||
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||
of action, whether now known or unknown (including existing as well as
|
||||
future claims and causes of action), in the Work (i) in all territories
|
||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||
treaty (including future time extensions), (iii) in any current or future
|
||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||
including without limitation commercial, advertising or promotional
|
||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||
member of the public at large and to the detriment of Affirmer's heirs and
|
||||
successors, fully intending that such Waiver shall not be subject to
|
||||
revocation, rescission, cancellation, termination, or any other legal or
|
||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||
as contemplated by Affirmer's express Statement of Purpose.
|
||||
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||
be judged legally invalid or ineffective under applicable law, then the
|
||||
Waiver shall be preserved to the maximum extent permitted taking into
|
||||
account Affirmer's express Statement of Purpose. In addition, to the
|
||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||
maximum duration provided by applicable law or treaty (including future
|
||||
time extensions), (iii) in any current or future medium and for any number
|
||||
of copies, and (iv) for any purpose whatsoever, including without
|
||||
limitation commercial, advertising or promotional purposes (the
|
||||
"License"). The License shall be deemed effective as of the date CC0 was
|
||||
applied by Affirmer to the Work. Should any part of the License for any
|
||||
reason be judged legally invalid or ineffective under applicable law, such
|
||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||
of the License, and in such case Affirmer hereby affirms that he or she
|
||||
will not (i) exercise any of his or her remaining Copyright and Related
|
||||
Rights in the Work or (ii) assert any associated claims and causes of
|
||||
action with respect to the Work, in either case contrary to Affirmer's
|
||||
express Statement of Purpose.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||
surrendered, licensed or otherwise affected by this document.
|
||||
b. Affirmer offers the Work as-is and makes no representations or
|
||||
warranties of any kind concerning the Work, express, implied,
|
||||
statutory or otherwise, including without limitation warranties of
|
||||
title, merchantability, fitness for a particular purpose, non
|
||||
infringement, or the absence of latent or other defects, accuracy, or
|
||||
the present or absence of errors, whether or not discoverable, all to
|
||||
the greatest extent permissible under applicable law.
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||
that may apply to the Work or any use thereof, including without
|
||||
limitation any person's Copyright and Related Rights in the Work.
|
||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||
consents, permissions or other rights required for any use of the
|
||||
Work.
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||
party to this document and has no duty or obligation with respect to
|
||||
this CC0 or use of the Work.
|
|
@ -0,0 +1,298 @@
|
|||
COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL)
|
||||
Version 1.0
|
||||
|
||||
1. Definitions.
|
||||
|
||||
1.1. “Contributor” means each individual or entity that creates or contributes
|
||||
to the creation of Modifications.
|
||||
|
||||
1.2. “Contributor Version” means the combination of the Original Software,
|
||||
prior Modifications used by a Contributor (if any), and the Modifications
|
||||
made by that particular Contributor.
|
||||
|
||||
1.3. “Covered Software” means (a) the Original Software, or (b) Modifications,
|
||||
or (c) the combination of files containing Original Software with files containing
|
||||
Modifications, in each case including portions thereof.
|
||||
|
||||
1.4. “Executable” means the Covered Software in any form other than Source
|
||||
Code.
|
||||
|
||||
1.5. “Initial Developer” means the individual or entity that first makes Original
|
||||
Software available under this License.
|
||||
|
||||
1.6. “Larger Work” means a work which combines Covered Software or portions
|
||||
thereof with code not governed by the terms of this License.
|
||||
|
||||
1.7. “License” means this document.
|
||||
|
||||
1.8. “Licensable” means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently acquired, any and
|
||||
all of the rights conveyed herein.
|
||||
|
||||
1.9. “Modifications” means the Source Code and Executable form of any of the
|
||||
following:
|
||||
|
||||
A. Any file that results from an addition to, deletion from or modification
|
||||
of the contents of a file containing Original Software or previous Modifications;
|
||||
|
||||
B. Any new file that contains any part of the Original Software or previous
|
||||
Modification; or
|
||||
|
||||
C. Any new file that is contributed or otherwise made available under the
|
||||
terms of this License.
|
||||
|
||||
1.10. “Original Software” means the Source Code and Executable form of computer
|
||||
software code that is originally released under this License.
|
||||
|
||||
1.11. “Patent Claims” means any patent claim(s), now owned or hereafter acquired,
|
||||
including without limitation, method, process, and apparatus claims, in any
|
||||
patent Licensable by grantor.
|
||||
|
||||
1.12. “Source Code” means (a) the common form of computer software code in
|
||||
which modifications are made and (b) associated documentation included in
|
||||
or with such code.
|
||||
|
||||
1.13. “You” (or “Your”) means an individual or a legal entity exercising rights
|
||||
under, and complying with all of the terms of, this License. For legal entities,
|
||||
“You” includes any entity which controls, is controlled by, or is under common
|
||||
control with You. For purposes of this definition, “control” means (a) the
|
||||
power, direct or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than fifty percent
|
||||
(50%) of the outstanding shares or beneficial ownership of such entity.
|
||||
|
||||
2. License Grants.
|
||||
|
||||
2.1. The Initial Developer Grant.
|
||||
Conditioned upon Your compliance with Section 3.1 below and subject to third
|
||||
party intellectual property claims, the Initial Developer hereby grants You
|
||||
a world-wide, royalty-free, non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark) Licensable
|
||||
by Initial Developer, to use, reproduce, modify, display, perform, sublicense
|
||||
and distribute the Original Software (or portions thereof), with or without
|
||||
Modifications, and/or as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims infringed by the making, using or selling of Original
|
||||
Software, to make, have made, use, practice, sell, and offer for sale, and/or
|
||||
otherwise dispose of the Original Software (or portions thereof).
|
||||
|
||||
(c) The licenses granted in Sections 2.1(a) and (b) are effective on the date
|
||||
Initial Developer first distributes or otherwise makes the Original Software
|
||||
available to a third party under the terms of this License.
|
||||
|
||||
(d) Notwithstanding Section 2.1(b) above, no patent license is granted: (1)
|
||||
for code that You delete from the Original Software, or (2) for infringements
|
||||
caused by: (i) the modification of the Original Software, or (ii) the combination
|
||||
of the Original Software with other software or devices.
|
||||
|
||||
2.2. Contributor Grant.
|
||||
Conditioned upon Your compliance with Section 3.1 below and subject to third
|
||||
party intellectual property claims, each Contributor hereby grants You a world-wide,
|
||||
royalty-free, non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark) Licensable
|
||||
by Contributor to use, reproduce, modify, display, perform, sublicense and
|
||||
distribute the Modifications created by such Contributor (or portions thereof),
|
||||
either on an unmodified basis, with other Modifications, as Covered Software
|
||||
and/or as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims infringed by the making, using, or selling of Modifications
|
||||
made by that Contributor either alone and/or in combination with its Contributor
|
||||
Version (or portions of such combination), to make, use, sell, offer for sale,
|
||||
have made, and/or otherwise dispose of: (1) Modifications made by that Contributor
|
||||
(or portions thereof); and (2) the combination of Modifications made by that
|
||||
Contributor with its Contributor Version (or portions of such combination).
|
||||
|
||||
(c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective on the
|
||||
date Contributor first distributes or otherwise makes the Modifications available
|
||||
to a third party.
|
||||
|
||||
(d) Notwithstanding Section 2.2(b) above, no patent license is granted: (1)
|
||||
for any code that Contributor has deleted from the Contributor Version; (2)
|
||||
for infringements caused by: (i) third party modifications of Contributor
|
||||
Version, or (ii) the combination of Modifications made by that Contributor
|
||||
with other software (except as part of the Contributor Version) or other devices;
|
||||
or (3) under Patent Claims infringed by Covered Software in the absence of
|
||||
Modifications made by that Contributor.
|
||||
|
||||
3. Distribution Obligations.
|
||||
|
||||
3.1. Availability of Source Code.
|
||||
Any Covered Software that You distribute or otherwise make available in Executable
|
||||
form must also be made available in Source Code form and that Source Code
|
||||
form must be distributed only under the terms of this License. You must include
|
||||
a copy of this License with every copy of the Source Code form of the Covered
|
||||
Software You distribute or otherwise make available. You must inform recipients
|
||||
of any such Covered Software in Executable form as to how they can obtain
|
||||
such Covered Software in Source Code form in a reasonable manner on or through
|
||||
a medium customarily used for software exchange.
|
||||
|
||||
3.2. Modifications.
|
||||
The Modifications that You create or to which You contribute are governed
|
||||
by the terms of this License. You represent that You believe Your Modifications
|
||||
are Your original creation(s) and/or You have sufficient rights to grant the
|
||||
rights conveyed by this License.
|
||||
|
||||
3.3. Required Notices.
|
||||
You must include a notice in each of Your Modifications that identifies You
|
||||
as the Contributor of the Modification. You may not remove or alter any copyright,
|
||||
patent or trademark notices contained within the Covered Software, or any
|
||||
notices of licensing or any descriptive text giving attribution to any Contributor
|
||||
or the Initial Developer.
|
||||
|
||||
3.4. Application of Additional Terms.
|
||||
You may not offer or impose any terms on any Covered Software in Source Code
|
||||
form that alters or restricts the applicable version of this License or the
|
||||
recipients’ rights hereunder. You may choose to offer, and to charge a fee
|
||||
for, warranty, support, indemnity or liability obligations to one or more
|
||||
recipients of Covered Software. However, you may do so only on Your own behalf,
|
||||
and not on behalf of the Initial Developer or any Contributor. You must make
|
||||
it absolutely clear that any such warranty, support, indemnity or liability
|
||||
obligation is offered by You alone, and You hereby agree to indemnify the
|
||||
Initial Developer and every Contributor for any liability incurred by the
|
||||
Initial Developer or such Contributor as a result of warranty, support, indemnity
|
||||
or liability terms You offer.
|
||||
|
||||
3.5. Distribution of Executable Versions.
|
||||
You may distribute the Executable form of the Covered Software under the terms
|
||||
of this License or under the terms of a license of Your choice, which may
|
||||
contain terms different from this License, provided that You are in compliance
|
||||
with the terms of this License and that the license for the Executable form
|
||||
does not attempt to limit or alter the recipient’s rights in the Source Code
|
||||
form from the rights set forth in this License. If You distribute the Covered
|
||||
Software in Executable form under a different license, You must make it absolutely
|
||||
clear that any terms which differ from this License are offered by You alone,
|
||||
not by the Initial Developer or Contributor. You hereby agree to indemnify
|
||||
the Initial Developer and every Contributor for any liability incurred by
|
||||
the Initial Developer or such Contributor as a result of any such terms You
|
||||
offer.
|
||||
|
||||
3.6. Larger Works.
|
||||
You may create a Larger Work by combining Covered Software with other code
|
||||
not governed by the terms of this License and distribute the Larger Work as
|
||||
a single product. In such a case, You must make sure the requirements of this
|
||||
License are fulfilled for the Covered Software.
|
||||
|
||||
4. Versions of the License.
|
||||
|
||||
4.1. New Versions.
|
||||
Sun Microsystems, Inc. is the initial license steward and may publish revised
|
||||
and/or new versions of this License from time to time. Each version will be
|
||||
given a distinguishing version number. Except as provided in Section 4.3,
|
||||
no one other than the license steward has the right to modify this License.
|
||||
|
||||
4.2. Effect of New Versions.
|
||||
You may always continue to use, distribute or otherwise make the Covered Software
|
||||
available under the terms of the version of the License under which You originally
|
||||
received the Covered Software. If the Initial Developer includes a notice
|
||||
in the Original Software prohibiting it from being distributed or otherwise
|
||||
made available under any subsequent version of the License, You must distribute
|
||||
and make the Covered Software available under the terms of the version of
|
||||
the License under which You originally received the Covered Software. Otherwise,
|
||||
You may also choose to use, distribute or otherwise make the Covered Software
|
||||
available under the terms of any subsequent version of the License published
|
||||
by the license steward.
|
||||
|
||||
4.3. Modified Versions.
|
||||
When You are an Initial Developer and You want to create a new license for
|
||||
Your Original Software, You may create and use a modified version of this
|
||||
License if You: (a) rename the license and remove any references to the name
|
||||
of the license steward (except to note that the license differs from this
|
||||
License); and (b) otherwise make it clear that the license contains terms
|
||||
which differ from this License.
|
||||
|
||||
5. DISCLAIMER OF WARRANTY.
|
||||
|
||||
COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN “AS IS” BASIS, WITHOUT
|
||||
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION,
|
||||
WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT
|
||||
FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY
|
||||
AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE
|
||||
PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER
|
||||
CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE.
|
||||
NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
|
||||
|
||||
6. TERMINATION.
|
||||
|
||||
6.1. This License and the rights granted hereunder will terminate automatically
|
||||
if You fail to comply with terms herein and fail to cure such breach within
|
||||
30 days of becoming aware of the breach. Provisions which, by their nature,
|
||||
must remain in effect beyond the termination of this License shall survive.
|
||||
|
||||
6.2. If You assert a patent infringement claim (excluding declaratory judgment
|
||||
actions) against Initial Developer or a Contributor (the Initial Developer
|
||||
or Contributor against whom You assert such claim is referred to as “Participant”)
|
||||
alleging that the Participant Software (meaning the Contributor Version where
|
||||
the Participant is a Contributor or the Original Software where the Participant
|
||||
is the Initial Developer) directly or indirectly infringes any patent, then
|
||||
any and all rights granted directly or indirectly to You by such Participant,
|
||||
the Initial Developer (if the Initial Developer is not the Participant) and
|
||||
all Contributors under Sections 2.1 and/or 2.2 of this License shall, upon
|
||||
60 days notice from Participant terminate prospectively and automatically
|
||||
at the expiration of such 60 day notice period, unless if within such 60 day
|
||||
period You withdraw Your claim with respect to the Participant Software against
|
||||
such Participant either unilaterally or pursuant to a written agreement with
|
||||
Participant.
|
||||
|
||||
6.3. In the event of termination under Sections 6.1 or 6.2 above, all end
|
||||
user licenses that have been validly granted by You or any distributor hereunder
|
||||
prior to termination (excluding licenses granted to You by any distributor)
|
||||
shall survive termination.
|
||||
|
||||
7. LIMITATION OF LIABILITY.
|
||||
|
||||
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING
|
||||
NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY
|
||||
OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER
|
||||
OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL,
|
||||
INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION,
|
||||
DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE
|
||||
OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF
|
||||
SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS
|
||||
LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
|
||||
INJURY RESULTING FROM SUCH PARTY’S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
|
||||
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR
|
||||
LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION
|
||||
MAY NOT APPLY TO YOU.
|
||||
|
||||
8. U.S. GOVERNMENT END USERS.
|
||||
|
||||
The Covered Software is a “commercial item,” as that term is defined in 48
|
||||
C.F.R. 2.101 (Oct. 1995), consisting of “commercial computer software” (as
|
||||
that term is defined at 48 C.F.R. § 252.227-7014(a)(1)) and “commercial computer
|
||||
software documentation” as such terms are used in 48 C.F.R. 12.212 (Sept.
|
||||
1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4
|
||||
(June 1995), all U.S. Government End Users acquire Covered Software with only
|
||||
those rights set forth herein. This U.S. Government Rights clause is in lieu
|
||||
of, and supersedes, any other FAR, DFAR, or other clause or provision that
|
||||
addresses Government rights in computer software under this License.
|
||||
|
||||
9. MISCELLANEOUS.
|
||||
|
||||
This License represents the complete agreement concerning subject matter hereof.
|
||||
If any provision of this License is held to be unenforceable, such provision
|
||||
shall be reformed only to the extent necessary to make it enforceable. This
|
||||
License shall be governed by the law of the jurisdiction specified in a notice
|
||||
contained within the Original Software (except to the extent applicable law,
|
||||
if any, provides otherwise), excluding such jurisdiction’s conflict-of-law
|
||||
provisions. Any litigation relating to this License shall be subject to the
|
||||
jurisdiction of the courts located in the jurisdiction and venue specified
|
||||
in a notice contained within the Original Software, with the losing party
|
||||
responsible for costs, including, without limitation, court costs and reasonable
|
||||
attorneys’ fees and expenses. The application of the United Nations Convention
|
||||
on Contracts for the International Sale of Goods is expressly excluded. Any
|
||||
law or regulation which provides that the language of a contract shall be
|
||||
construed against the drafter shall not apply to this License. You agree that
|
||||
You alone are responsible for compliance with the United States export administration
|
||||
regulations (and the export control laws and regulation of any other countries)
|
||||
when You use, distribute or otherwise make available any Covered Software.
|
||||
|
||||
10. RESPONSIBILITY FOR CLAIMS.
|
||||
|
||||
As between Initial Developer and the Contributors, each party is responsible
|
||||
for claims and damages arising, directly or indirectly, out of its utilization
|
||||
of rights under this License and You agree to work with Initial Developer
|
||||
and Contributors to distribute such responsibility on an equitable basis.
|
||||
Nothing herein is intended or shall be deemed to constitute any admission
|
||||
of liability.
|
207
README.rst
207
README.rst
|
@ -12,91 +12,94 @@ An attempt to provide a reproducible, automatic, complete end-to-end
|
|||
bootstrap from a minimal number of binary seeds to a supported fully
|
||||
functioning operating system.
|
||||
|
||||
How do I use this?
|
||||
------------------
|
||||
|
||||
Quick start:
|
||||
|
||||
See ``./rootfs.py --help`` and follow the instructions given there.
|
||||
This uses a variety of userland tools to prepare the bootstrap.
|
||||
|
||||
(*Currently, there is no way to perform the bootstrap without external
|
||||
preparations! This is a currently unsolved problem.*)
|
||||
|
||||
Without using Python:
|
||||
Get me started!
|
||||
---------------
|
||||
|
||||
1. ``git clone https://github.com/fosslinux/live-bootstrap``
|
||||
2. ``git submodule update --init --recursive``
|
||||
3. Consider whether you are going to run this in a chroot, in QEMU, or on bare
|
||||
metal. (All of this *can* be automated, but not in a trustable way. See
|
||||
further below.)
|
||||
a. **chroot:** Create a directory where the chroot will reside, run
|
||||
``./download-distfiles.sh``, and copy:
|
||||
* The entire contents of ``seed/stage0-posix`` into that directory.
|
||||
* All other files in ``seed`` into that directory.
|
||||
* ``steps/`` and ``distfiles/`` into that directory.
|
||||
* At least all files listed in ``steps/pre-network-sources`` must be
|
||||
copied in. All other files will be obtained from the network.
|
||||
* Run ``/bootstrap-seeds/POSIX/x86/kaem-optional-seed`` in the chroot.
|
||||
(Eg, ``chroot rootfs /bootstrap-seeds/POSIX/x86/kaem-optional-seed``).
|
||||
b. **QEMU:** Create two blank disk images.
|
||||
* Generate ``builder-hex0-x86-stage1.img`` from hex0 source:
|
||||
``sed 's/[;#].*$//g' builder-hex0/builder-hex0-x86-stage1-hex0 | xxd -r -p``
|
||||
* On the first image, write ``builder-hex0-x86-stage1.img`` to it, followed
|
||||
by ``kernel-bootstrap/builder-hex0-x86-stage2.hex0``, followed by zeros
|
||||
padding the disk to the next sector.
|
||||
* distfiles can be obtained using ``./download-distfiles.sh``.
|
||||
* See the list in part a. For every file within that list, write a line to
|
||||
the disk ``src <size-of-file> <path-to-file>``, followed by the contents
|
||||
of the file.
|
||||
* *Only* copy distfiles listed in ``sources`` files for ``build:`` steps
|
||||
manifested before ``improve: get_network`` into this disk.
|
||||
* Optionally (if you don't do this, distfiles will be network downloaded):
|
||||
* On the second image, create an MSDOS partition table and one ext3
|
||||
partition.
|
||||
* Copy ``distfiles/`` into this disk.
|
||||
* Run QEMU, with 4+G RAM, optionally SMP (multicore), both drives (in the
|
||||
order introduced above), a NIC with model E1000 (``-nic
|
||||
user,model=e1000``), and ``-machine kernel-irqchip=split``.
|
||||
c. **Bare metal:** Follow the same steps as QEMU, but the disks need to be
|
||||
two different *physical* disks, and boot from the first disk.
|
||||
3. Provide a kernel (vmlinuz file) as the name ``kernel`` in the root of the
|
||||
repository. **This must be a 32-bit kernel.**
|
||||
4. ``./rootfs.py --qemu`` - ensure your account has kvm privileges and qemu
|
||||
installed.
|
||||
|
||||
a. Alternatively, run ``./rootfs.py --chroot`` to run it in a chroot.
|
||||
b. Alternatively, run ``./rootfs.py --bwrap`` to run it in a bubblewrap
|
||||
sandbox. When user namespaces are supported, this mode is rootless.
|
||||
c. Alternatively, run ``./rootfs.py`` but don’t run the actual
|
||||
virtualization and instead copy sysa/tmp/initramfs to a USB or
|
||||
some other device and boot from bare metal. NOTE: we now require
|
||||
a hard drive. This is currently hardcoded as sda. You also need
|
||||
to put ``sysc/tmp/disk.img`` onto your sda on the bootstrapping
|
||||
machine.
|
||||
d. Alternatively, do not use python at all, see "Python-less build"
|
||||
below.
|
||||
|
||||
5. Wait.
|
||||
6. If you can, observe the many binaries in ``/usr/bin``! When the
|
||||
bootstrap is completed ``bash`` is launched providing a shell to
|
||||
explore the system.
|
||||
|
||||
|
||||
Background
|
||||
----------
|
||||
|
||||
Problem statement
|
||||
=================
|
||||
This project is a part of the bootstrappable project, a project that
|
||||
aims to be able to build complete computing platforms through the use of
|
||||
source code. When you build a compiler like GCC, you need another C
|
||||
compiler to compile the compiler - turtles all the way down. Even the
|
||||
first GCC compiler was written in C. There has to be a way to break the
|
||||
chain…
|
||||
|
||||
live-bootstrap's overarching problem statement is;
|
||||
There has been significant work on this over the last 5 years, from
|
||||
Jeremiah Orians’ stage0, hex2 and M2-Planet to janneke’s Mes. We have a
|
||||
currently, fully-functioning chain of bootstrapping from the 357-byte
|
||||
hex0 seed to a complete GCC compiler and hence a full Linux operating
|
||||
system. From there, it is trivial to move to other UNIXes. However,
|
||||
there is only currently one vector through which this can be
|
||||
automatically done, GNU Guix.
|
||||
|
||||
> How can a usable Linux system be created with only human-auditable, and
|
||||
wherever possible, human-written, source code?
|
||||
While the primary author of this project does not believe Guix is a bad
|
||||
project, the great reliance on Guile, the complexity of many of the
|
||||
scripts and the rather steep learning curve to install and run Guix make
|
||||
it a very non plug-and-play solution. Furthermore, there is currently
|
||||
(Jan 2021) no possible way to run the bootstrap from outside of a
|
||||
pre-existing Linux environment. Additionally, Guix uses many scripts and
|
||||
distributed files that cannot be considered source code.
|
||||
|
||||
Clarifications:
|
||||
(NOTE: Guix is working on a Full Source Bootstrap, but I’m not
|
||||
completely sure what that entails).
|
||||
|
||||
* "usable" means a modern toolchain, with appropriate utilities, that can be
|
||||
used to expand the amount of software on the system, interactively, or
|
||||
non-interactively.
|
||||
* "human-auditable" is discretionary, but is usually fairly strict. See
|
||||
"Specific things to be bootstrapped" below.
|
||||
Furthermore, having an alternative bootstrap automation tool allows
|
||||
people to have greater trust in the bootstrap procedure.
|
||||
|
||||
Why is this difficult?
|
||||
======================
|
||||
Comparison between GNU Guix and live-bootstrap
|
||||
----------------------------------------------
|
||||
|
||||
The core of a modern Linux system is primarily written in C and C++. C and C++
|
||||
are **self-hosting**, ie, nearly every single C compiler is written in C.
|
||||
+----------------------+----------------------+----------------------+
|
||||
| Item | Guix | live-bootstrap |
|
||||
+======================+======================+======================+
|
||||
| Total size of seeds | ~30MB (Reduced | ~1KB |
|
||||
| [1] | Source Bootstrap) | |
|
||||
| | [2] | |
|
||||
+----------------------+----------------------+----------------------+
|
||||
| Use of kernel | Linux-Libre Kernel | Any Linux Kernel |
|
||||
| | | (2.6+) [3] |
|
||||
+----------------------+----------------------+----------------------+
|
||||
| Implementation | Yes | No (in development) |
|
||||
| complete | | |
|
||||
+----------------------+----------------------+----------------------+
|
||||
| Automation | Almost fully | Optional user |
|
||||
| | automatic | customization |
|
||||
+----------------------+----------------------+----------------------+
|
||||
|
||||
Every single version of GCC was written in C. To avoid using an existing
|
||||
toolchain, we need some way to be able to compile a GCC version without C. We
|
||||
can use a less well-featured compiler, TCC, to do this. And so forth, until we
|
||||
get to a fairly primitive C compiler written in assembly, ``cc_x86``.
|
||||
[1]: Both projects only use software licensed under a FSF-approved
|
||||
free software license. Kernel is excluded from seed.
|
||||
[2]: Reiterating that Guix is working on a full source bootstrap,
|
||||
although that still uses guile (~12 MB). [3]: Work is ongoing to use
|
||||
other, smaller POSIX kernels.
|
||||
|
||||
Going up through this process requires a bunch of other utilities as well; the
|
||||
autotools suite, guile and autogen, etc. These also have to be matched
|
||||
appropriately to the toolchain available.
|
||||
|
||||
Why should I care?
|
||||
------------------
|
||||
Why would I want bootstrapping?
|
||||
-------------------------------
|
||||
|
||||
That is outside of the scope of this README. Here’s a few things you can
|
||||
look at:
|
||||
|
@ -114,7 +117,7 @@ bootstrapping. However, there are a number of non-auditable files used
|
|||
in many of their packages. Here is a list of file types that we deem
|
||||
unsuitable for bootstrapping.
|
||||
|
||||
1. Binaries (apart from seed hex0, kaem, builder-hex0).
|
||||
1. Binaries (apart from seed hex0, kaem, kernel).
|
||||
2. Any pre-generated configure scripts, or Makefile.in’s from autotools.
|
||||
3. Pre-generated bison/flex parsers (identifiable through a ``.y``
|
||||
file).
|
||||
|
@ -128,18 +131,56 @@ How does this work?
|
|||
|
||||
**For a more in-depth discussion, see parts.rst.**
|
||||
|
||||
Firstly, ``builder-hex0`` is launched. ``builder-hex0`` is a minimal kernel that is
|
||||
written in ``hex0``, existing in 3 self-bootstrapping stages.
|
||||
sysa
|
||||
~~~~
|
||||
|
||||
This is capable of executing the entirety of ``stage0-posix``, (see
|
||||
``seed/stage0-posix``), which produces a variety of useful utilities and a basic
|
||||
C language, ``M2-Planet``.
|
||||
sysa is the first ‘system’ used in live-bootstrap. We move to a new
|
||||
system after a reboot, which often occurs after the movement to a new
|
||||
kernel. It is run by the seed Linux kernel provided by the user. It
|
||||
compiles everything we need to be able to compile our own Linux kernel.
|
||||
It runs fully in an initramfs and does not rely on disk support in the
|
||||
seed Linux kernel.
|
||||
|
||||
``stage0-posix`` runs a file called ``after.kaem``. This is a shell script that
|
||||
builds and runs a small program called ``script-generator``. This program reads
|
||||
``steps/manifest`` and converts it into a series of shell scripts that can be
|
||||
executed in sequence to complete the bootstrap.
|
||||
sysb
|
||||
~~~~
|
||||
|
||||
From this point forward, ``steps/manifest`` is effectively self documenting.
|
||||
Each package built exists in ``steps/<pkg>``, and the build scripts can be seen
|
||||
there.
|
||||
sysb is the second 'system' of live-bootstrap. This uses the Linux 4.9.10
|
||||
kernel compiled within sysa. As we do not rely on disk support in sysa, we
|
||||
need this intermediate system to be able to add the missing binaries to sysc
|
||||
before moving into it. This is executed through kexec from sysa. At this point,
|
||||
a SATA disk IS required.
|
||||
|
||||
sysc
|
||||
~~~~
|
||||
|
||||
sysc is the (current) last 'system' of live-bootstrap. This is a continuation
|
||||
from sysb, executed through util-linux's ``switch_root`` command which moves
|
||||
the entire rootfs without a reboot. Every package from here on out is compiled
|
||||
under this system, taking binaries from sysa. Chroot and bubblewrap modes skip
|
||||
sysb, as it is obviously irrelevant to them.
|
||||
|
||||
Python-less build
|
||||
-----------------
|
||||
|
||||
Python is no longer a requirement to set up the build system. The
|
||||
repository is almost completely in a form where it can be used as the
|
||||
source of a build.
|
||||
|
||||
1. Download required tarballs into ``sysa/distfiles`` and ``sysc/distfiles``.
|
||||
You can use the ``download-distfiles.sh`` script.
|
||||
2. Copy sysa/stage0-posix/src/* to the root of the repository.
|
||||
3. Copy sysa/stage0-posix/src/bootstrap-seeds/POSIX/x86/kaem-optional-seed
|
||||
to init in the root of the repository.
|
||||
4. Copy sysa/after.kaem to after.kaem
|
||||
5. Create a CPIO archive (eg, ``cpio --format newc --create --directory . > ../initramfs``).
|
||||
6. Boot your initramfs and kernel.
|
||||
|
||||
chroot builds
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
For chroot based bootstraps you can skip creation of initramfs and instead start bootstrap with
|
||||
|
||||
``sudo chroot . bootstrap-seeds/POSIX/x86/kaem-optional-seed``
|
||||
|
||||
It is also recommended to copy everything to a new directory as bootstrapping messes up with files
|
||||
in git repository and cannot be re-run again.
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit a2781242d19e6be891b453d8fa827137ab5db31a
|
|
@ -1,162 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2024 fosslinux <fosslinux@aussies.space>
|
||||
|
||||
"""Check that substituted files are the same."""
|
||||
import bz2
|
||||
import filecmp
|
||||
import gzip
|
||||
import itertools
|
||||
import lzma
|
||||
import shutil
|
||||
import tarfile
|
||||
import tempfile
|
||||
import sys
|
||||
import os
|
||||
|
||||
from lib.generator import Generator
|
||||
|
||||
# Get a temporary directory to work in
|
||||
working = tempfile.mkdtemp()
|
||||
|
||||
# Colour constants
|
||||
# pylint: disable=too-few-public-methods
|
||||
class Colors():
|
||||
"""ANSI Color Codes"""
|
||||
GREY = "\033[90m"
|
||||
RED = "\033[91m"
|
||||
GREEN = "\033[92m"
|
||||
ORANGE = "\033[91m\033[93m"
|
||||
YELLOW = "\033[93m"
|
||||
END = "\033[0m"
|
||||
|
||||
def traverse_path(base_root):
|
||||
"""Takes a path and returns a set of all directories and files in that path."""
|
||||
all_dirs = set()
|
||||
all_files = set()
|
||||
for root, directories, files in os.walk(base_root, topdown=True):
|
||||
for d in directories:
|
||||
all_dirs.add(os.path.join(root, d).lstrip(base_root))
|
||||
for f in files:
|
||||
all_files.add(os.path.join(root, f).lstrip(base_root))
|
||||
return (all_dirs, all_files)
|
||||
|
||||
class Distfile():
|
||||
"""Represents one distfile and operations performed on it."""
|
||||
def __init__(self, i, url):
|
||||
self.i = i
|
||||
self.url = url
|
||||
self.out_file = f"{i}-{os.path.basename(url)}"
|
||||
self.filepath = ""
|
||||
|
||||
def download(self):
|
||||
"""Downloads the distfile."""
|
||||
Generator.download_file(self.url, working, self.out_file, silent=True)
|
||||
self.filepath = os.path.join(working, self.out_file)
|
||||
|
||||
def decompress(self):
|
||||
"""Decompresses the distfile."""
|
||||
compression = self.out_file.split('.')[-1]
|
||||
decompress_func = {
|
||||
"gz": gzip.open,
|
||||
"tgz": gzip.open,
|
||||
"bz2": bz2.open,
|
||||
"xz": lzma.open,
|
||||
"lzma": lzma.open
|
||||
}
|
||||
if compression not in decompress_func:
|
||||
# No decompression needed
|
||||
return
|
||||
# Remove the compression extension
|
||||
new_path = '.'.join(self.filepath.split('.')[:-1])
|
||||
# tgz -> .tar
|
||||
if compression == "tgz":
|
||||
new_path = f"{new_path}.tar"
|
||||
# Move the decompressed binary stream to a new file
|
||||
with decompress_func[compression](self.filepath, 'rb') as fin:
|
||||
with open(new_path, 'wb') as fout:
|
||||
shutil.copyfileobj(fin, fout)
|
||||
self.filepath = new_path
|
||||
|
||||
def extract(self):
|
||||
"""Extracts the distfile."""
|
||||
# Sanity check
|
||||
if not tarfile.is_tarfile(self.filepath):
|
||||
return
|
||||
out_dir = os.path.join(working, f"{self.i}")
|
||||
os.mkdir(out_dir)
|
||||
with tarfile.open(self.filepath, 'r') as f:
|
||||
f.extractall(path=out_dir)
|
||||
self.filepath = out_dir
|
||||
|
||||
# It makes more sense here to label them d1 and d2 rather than have one be self.
|
||||
# pylint: disable=no-self-argument
|
||||
def compare(d1, d2):
|
||||
"""Compares the distfile to another distfile."""
|
||||
if not os.path.isdir(d1.filepath):
|
||||
# Compare files
|
||||
return filecmp.cmp(d1.filepath, d2.filepath, shallow=False)
|
||||
if not os.path.isdir(d2.filepath):
|
||||
# Then, d2 is a file and d1 is a directory
|
||||
return False
|
||||
# Otherwise it's two directories
|
||||
dirnames1, filenames1 = traverse_path(d1.filepath)
|
||||
dirnames2, filenames2 = traverse_path(d2.filepath)
|
||||
if dirnames1 != dirnames2:
|
||||
return False
|
||||
if filenames1 != filenames2:
|
||||
return False
|
||||
return filecmp.cmpfiles(d1.filepath, d2.filepath, filenames1, shallow=False)
|
||||
|
||||
def check(*args):
|
||||
"""Check if a list of distfiles are equivalent."""
|
||||
notequiv = []
|
||||
# Find all pairs that are not equivalent
|
||||
for pair in itertools.combinations(args, 2):
|
||||
if pair[0].compare(pair[1]):
|
||||
print(f"{Colors.GREY}DEBUG: {pair[0].url} is equivalent to {pair[1].url}{Colors.END}")
|
||||
else:
|
||||
notequiv.append(pair)
|
||||
|
||||
# Decompress all, and check again
|
||||
for d in {y for x in notequiv for y in x}:
|
||||
d.decompress()
|
||||
for pair in notequiv.copy():
|
||||
if pair[0].compare(pair[1]):
|
||||
# pylint: disable=line-too-long
|
||||
print(f"{Colors.YELLOW}NOTE: {pair[0].url} is equivalent to {pair[1].url} when decompressed{Colors.END}")
|
||||
notequiv.remove(pair)
|
||||
|
||||
# Extract all, and check again
|
||||
for d in {y for x in notequiv for y in x}:
|
||||
d.extract()
|
||||
has_error = False
|
||||
for pair in notequiv:
|
||||
if pair[0].compare(pair[1]):
|
||||
# pylint: disable=line-too-long
|
||||
print(f"{Colors.ORANGE}WARN: {pair[0].url} is equivalent to {pair[1].url} when extracted{Colors.END}")
|
||||
else:
|
||||
has_error = True
|
||||
# pylint: disable=line-too-long
|
||||
print(f"{Colors.RED}ERROR: {pair[0].url} is not equivalent to {pair[1].url}!{Colors.END}")
|
||||
|
||||
return has_error
|
||||
|
||||
def main():
|
||||
"""Main function."""
|
||||
has_error = False
|
||||
with open("substitutes", 'r', encoding="utf-8") as f:
|
||||
for line in f.readlines():
|
||||
urls = line.strip().split(' ')
|
||||
distfiles = []
|
||||
for i, url in enumerate(urls):
|
||||
distfiles.append(Distfile(i, url))
|
||||
for distfile in distfiles:
|
||||
distfile.download()
|
||||
if check(*distfiles):
|
||||
has_error = True
|
||||
sys.exit(has_error)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -15,47 +15,32 @@ download_source() {
|
|||
local dest_path="${distfiles}/${fname}"
|
||||
if ! [ -e "${dest_path}" ]; then
|
||||
echo "Downloading ${fname}"
|
||||
curl --fail --location "${url}" --output "${dest_path}" || true
|
||||
curl --fail --location "${url}" --output "${dest_path}"
|
||||
fi
|
||||
}
|
||||
|
||||
check_source() {
|
||||
local distfiles="${1}"
|
||||
local url="${2}"
|
||||
local checksum="${3}"
|
||||
local fname="${4}"
|
||||
# Default to basename of url if not given
|
||||
fname="${fname:-$(basename "${url}")}"
|
||||
|
||||
local dest_path="${distfiles}/${fname}"
|
||||
echo "${checksum} ${dest_path}" | sha256sum -c
|
||||
}
|
||||
|
||||
download_for_sys() {
|
||||
local sysdir="${1}"
|
||||
local distfiles="${sysdir}/distfiles"
|
||||
|
||||
mkdir -p "${distfiles}"
|
||||
|
||||
local entry
|
||||
for entry in "${sysdir}"/*; do
|
||||
[ -e "${entry}/sources" ] || continue
|
||||
|
||||
local line
|
||||
# shellcheck disable=SC2162
|
||||
while read line; do
|
||||
# This is intentional - we want to split out ${line} into separate arguments.
|
||||
# shellcheck disable=SC2086
|
||||
download_source "${distfiles}" ${line}
|
||||
done < "${entry}/sources"
|
||||
done
|
||||
}
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$(readlink -f "$0")")"
|
||||
mkdir -p distfiles
|
||||
|
||||
# First, try to download anything missing - ignore failing mirrors
|
||||
for entry in steps/*; do
|
||||
[ -e "${entry}/sources" ] || continue
|
||||
|
||||
# shellcheck disable=SC2162
|
||||
while read line; do
|
||||
# This is intentional - we want to split out ${line} into separate arguments.
|
||||
# shellcheck disable=SC2086
|
||||
download_source distfiles ${line}
|
||||
done < "${entry}/sources"
|
||||
done
|
||||
|
||||
# Then, check if everything has been obtained at least once
|
||||
for entry in steps/*; do
|
||||
[ -e "${entry}/sources" ] || continue
|
||||
|
||||
# shellcheck disable=SC2162
|
||||
while read line; do
|
||||
# This is intentional - we want to split out ${line} into separate arguments.
|
||||
# shellcheck disable=SC2086
|
||||
check_source distfiles ${line}
|
||||
done < "${entry}/sources"
|
||||
done
|
||||
download_for_sys sysa
|
||||
download_for_sys sysc
|
||||
|
|
File diff suppressed because it is too large
Load Diff
357
lib/generator.py
357
lib/generator.py
|
@ -1,357 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
This file contains all code required to generate the boot image for live-bootstrap
|
||||
"""
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# SPDX-FileCopyrightText: 2022-2023 Dor Askayo <dor.askayo@gmail.com>
|
||||
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
# SPDX-FileCopyrightText: 2021 Melg Eight <public.melg8@gmail.com>
|
||||
# SPDX-FileCopyrightText: 2021-23 fosslinux <fosslinux@aussies.space>
|
||||
|
||||
import hashlib
|
||||
import os
|
||||
import shutil
|
||||
import tarfile
|
||||
import traceback
|
||||
import requests
|
||||
|
||||
# pylint: disable=too-many-instance-attributes
|
||||
class Generator():
|
||||
"""
|
||||
Class responsible for generating the basic media to be consumed.
|
||||
"""
|
||||
|
||||
git_dir = os.path.join(os.path.dirname(os.path.join(__file__)), '..')
|
||||
distfiles_dir = os.path.join(git_dir, 'distfiles')
|
||||
|
||||
def __init__(self, arch, external_sources, early_preseed, repo_path):
|
||||
self.arch = arch
|
||||
self.early_preseed = early_preseed
|
||||
self.external_sources = external_sources
|
||||
self.repo_path = repo_path
|
||||
self.source_manifest = self.get_source_manifest(not self.external_sources)
|
||||
self.early_source_manifest = self.get_source_manifest(True)
|
||||
self.target_dir = None
|
||||
self.external_dir = None
|
||||
|
||||
def reuse(self, target):
|
||||
"""
|
||||
Reuse a previously prepared bwrap environment for further stages.
|
||||
"""
|
||||
self.target_dir = target.path
|
||||
self.external_dir = os.path.join(self.target_dir, 'external')
|
||||
self.distfiles()
|
||||
|
||||
def prepare(self, target, using_kernel=False, kernel_bootstrap=False, target_size=0):
|
||||
"""
|
||||
Prepare basic media of live-bootstrap.
|
||||
/steps -- contains steps to be built
|
||||
/ -- contains seed to allow steps to be built, containing custom
|
||||
scripts and stage0-posix
|
||||
"""
|
||||
self.target_dir = target.path
|
||||
self.external_dir = os.path.join(self.target_dir, 'external')
|
||||
|
||||
# We use ext3 here; ext4 actually has a variety of extensions that
|
||||
# have been added with varying levels of recency
|
||||
# Linux 4.9.10 does not support a bunch of them
|
||||
# Attempting to disable extensions that a particular e2fsprogs
|
||||
# is *unaware* of causes the filesystem creation to fail
|
||||
# We could hypothetically detect e2fsprogs version and create an
|
||||
# argument matrix ... or we could just use ext3 instead which
|
||||
# is effectively universally the same
|
||||
if kernel_bootstrap:
|
||||
self.target_dir = os.path.join(self.target_dir, 'init')
|
||||
os.mkdir(self.target_dir)
|
||||
|
||||
if not self.repo_path and not self.external_sources:
|
||||
self.external_dir = os.path.join(self.target_dir, 'external')
|
||||
elif using_kernel:
|
||||
self.target_dir = os.path.join(self.target_dir, 'disk')
|
||||
self.external_dir = os.path.join(self.target_dir, 'external')
|
||||
|
||||
os.makedirs(self.external_dir)
|
||||
|
||||
if self.early_preseed:
|
||||
# Extract tar containing preseed
|
||||
with tarfile.open(self.early_preseed, "r") as seed:
|
||||
seed.extractall(self.target_dir)
|
||||
shutil.copy2(os.path.join(self.git_dir, 'seed', 'preseeded.kaem'),
|
||||
os.path.join(self.target_dir, 'kaem.x86'))
|
||||
else:
|
||||
self.stage0_posix(kernel_bootstrap)
|
||||
self.seed()
|
||||
|
||||
self.steps()
|
||||
|
||||
self.distfiles()
|
||||
|
||||
if self.repo_path:
|
||||
repo_dir = os.path.join(self.external_dir, 'repo-preseeded')
|
||||
shutil.copytree(self.repo_path, repo_dir)
|
||||
|
||||
if kernel_bootstrap:
|
||||
self.create_builder_hex0_disk_image(self.target_dir + '.img', target_size)
|
||||
|
||||
if self.repo_path or self.external_sources:
|
||||
mkfs_args = ['-d', os.path.join(target.path, 'external')]
|
||||
target.add_disk("external", filesystem="ext3", mkfs_args=mkfs_args)
|
||||
elif using_kernel:
|
||||
mkfs_args = ['-F', '-d', os.path.join(target.path, 'disk')]
|
||||
target.add_disk("disk",
|
||||
filesystem="ext3",
|
||||
size=(str(target_size) + "M") if target_size else "16G",
|
||||
bootable=True,
|
||||
mkfs_args=mkfs_args)
|
||||
|
||||
def steps(self):
|
||||
"""Copy in steps."""
|
||||
self.get_packages()
|
||||
|
||||
shutil.copytree(os.path.join(self.git_dir, 'steps'), os.path.join(self.target_dir, 'steps'))
|
||||
|
||||
def stage0_posix(self, kernel_bootstrap=False):
|
||||
"""Copy in all of the stage0-posix"""
|
||||
stage0_posix_base_dir = os.path.join(self.git_dir, 'seed', 'stage0-posix')
|
||||
for entry in os.listdir(stage0_posix_base_dir):
|
||||
if kernel_bootstrap and entry == 'bootstrap-seeds':
|
||||
continue
|
||||
orig = os.path.join(stage0_posix_base_dir, entry)
|
||||
target = os.path.join(self.target_dir, entry)
|
||||
if os.path.isfile(orig):
|
||||
shutil.copy2(orig, target)
|
||||
else:
|
||||
shutil.copytree(orig, target)
|
||||
|
||||
if not kernel_bootstrap:
|
||||
arch = stage0_arch_map.get(self.arch, self.arch)
|
||||
kaem_optional_seed = os.path.join(self.git_dir, 'seed', 'stage0-posix',
|
||||
'bootstrap-seeds', 'POSIX', arch,
|
||||
'kaem-optional-seed')
|
||||
shutil.copy2(kaem_optional_seed, os.path.join(self.target_dir, 'init'))
|
||||
|
||||
def seed(self):
|
||||
"""Copy in extra seed files"""
|
||||
seed_dir = os.path.join(self.git_dir, 'seed')
|
||||
for entry in os.listdir(seed_dir):
|
||||
if os.path.isfile(os.path.join(seed_dir, entry)):
|
||||
shutil.copy2(os.path.join(seed_dir, entry), os.path.join(self.target_dir, entry))
|
||||
|
||||
def distfiles(self):
|
||||
"""Copy in distfiles"""
|
||||
def copy_no_network_distfiles(out, early):
|
||||
# Note that "no disk" implies "no network" for kernel bootstrap mode
|
||||
manifest = self.early_source_manifest if early else self.source_manifest
|
||||
for file in manifest:
|
||||
file = file[3].strip()
|
||||
shutil.copy2(os.path.join(self.distfiles_dir, file),
|
||||
os.path.join(out, file))
|
||||
|
||||
early_distfile_dir = os.path.join(self.target_dir, 'external', 'distfiles')
|
||||
main_distfile_dir = os.path.join(self.external_dir, 'distfiles')
|
||||
|
||||
if early_distfile_dir != main_distfile_dir:
|
||||
os.makedirs(early_distfile_dir, exist_ok=True)
|
||||
copy_no_network_distfiles(early_distfile_dir, True)
|
||||
|
||||
if self.external_sources:
|
||||
shutil.copytree(self.distfiles_dir, main_distfile_dir, dirs_exist_ok=True)
|
||||
else:
|
||||
os.mkdir(main_distfile_dir)
|
||||
copy_no_network_distfiles(main_distfile_dir, False)
|
||||
|
||||
@staticmethod
|
||||
def output_dir(srcfs_file, dirpath):
|
||||
"""Add a directory to srcfs file system"""
|
||||
srcline = f"src 0 {dirpath}\n"
|
||||
srcfs_file.write(srcline.encode())
|
||||
|
||||
@staticmethod
|
||||
def output_file(srcfs_file, filepath):
|
||||
"""Add a file to srcfs file system"""
|
||||
srcline = f"src {os.path.getsize(filepath)} {filepath}\n"
|
||||
srcfs_file.write(srcline.encode())
|
||||
with open(filepath, 'rb') as srcfile:
|
||||
srcfs_file.write(srcfile.read())
|
||||
|
||||
def output_tree(self, srcfs_file, treepath):
|
||||
"""Add a tree of files to srcfs file system"""
|
||||
self.output_dir(srcfs_file, treepath)
|
||||
for root, dirs, files in os.walk(treepath):
|
||||
if ".git" in root:
|
||||
continue
|
||||
for dirpath in dirs:
|
||||
if ".git" in dirpath:
|
||||
continue
|
||||
self.output_dir(srcfs_file, os.path.join(root, dirpath))
|
||||
|
||||
for filepath in files:
|
||||
if ".git" in filepath:
|
||||
continue
|
||||
self.output_file(srcfs_file, os.path.join(root, filepath))
|
||||
|
||||
def append_srcfs(self, image_file):
|
||||
"""Append srcfs file system to disk image"""
|
||||
save_cwd = os.getcwd()
|
||||
|
||||
os.chdir(self.target_dir)
|
||||
self.output_tree(image_file, '.')
|
||||
|
||||
# Add commands to kick off stage0-posix
|
||||
cmd = ' '.join(['src',
|
||||
'0',
|
||||
'/bootstrap-seeds\n'])
|
||||
image_file.write(cmd.encode())
|
||||
cmd = ' '.join(['src',
|
||||
'0',
|
||||
'/bootstrap-seeds/POSIX\n'])
|
||||
image_file.write(cmd.encode())
|
||||
cmd = ' '.join(['src',
|
||||
'0',
|
||||
'/bootstrap-seeds/POSIX/x86\n'])
|
||||
image_file.write(cmd.encode())
|
||||
cmd = ' '.join(['hex0',
|
||||
'/x86/hex0_x86.hex0',
|
||||
'/bootstrap-seeds/POSIX/x86/hex0-seed\n'])
|
||||
image_file.write(cmd.encode())
|
||||
cmd = ' '.join(['hex0',
|
||||
'/x86/kaem-minimal.hex0',
|
||||
'/bootstrap-seeds/POSIX/x86/kaem-optional-seed\n'])
|
||||
image_file.write(cmd.encode())
|
||||
cmd = ' '.join(['hex0',
|
||||
'/x86/kaem-minimal.hex0',
|
||||
'/init\n'])
|
||||
image_file.write(cmd.encode())
|
||||
cmd = ' '.join(['/bootstrap-seeds/POSIX/x86/kaem-optional-seed', '/kaem.x86\n'])
|
||||
image_file.write(cmd.encode())
|
||||
os.chdir(save_cwd)
|
||||
|
||||
def create_builder_hex0_disk_image(self, image_file_name, size):
|
||||
"""Create builder-hex0 disk image"""
|
||||
with open(image_file_name, 'ab') as image_file:
|
||||
# Compile and write stage1 binary seed
|
||||
with open(os.path.join('builder-hex0', 'builder-hex0-x86-stage1.hex0'),
|
||||
encoding="utf-8") as infile:
|
||||
for line in infile:
|
||||
image_file.write(bytes.fromhex(line.split('#')[0].split(';')[0].strip()))
|
||||
# Append stage2 hex0 source
|
||||
with open(os.path.join('builder-hex0', 'builder-hex0-x86-stage2.hex0'),
|
||||
encoding="utf-8") as infile:
|
||||
image_file.write(infile.read().encode())
|
||||
# Pad to next sector
|
||||
current_size = os.stat(image_file_name).st_size
|
||||
while current_size % 512 != 0:
|
||||
image_file.write(b'\0')
|
||||
current_size += 1
|
||||
self.append_srcfs(image_file)
|
||||
|
||||
current_size = os.stat(image_file_name).st_size
|
||||
|
||||
megabyte = 1024 * 1024
|
||||
# fill file with zeros up to next megabyte
|
||||
extra = current_size % megabyte
|
||||
round_up = megabyte - extra
|
||||
with open(image_file_name, 'ab') as image_file:
|
||||
image_file.write(b'\0' * round_up)
|
||||
current_size += round_up
|
||||
|
||||
# extend file up to desired size
|
||||
if current_size < size * megabyte:
|
||||
with open(image_file_name, 'ab') as image_file:
|
||||
image_file.truncate(size * megabyte)
|
||||
|
||||
@staticmethod
|
||||
def check_file(file_name, expected_hash):
|
||||
"""Check hash of downloaded source file."""
|
||||
with open(file_name, "rb") as downloaded_file:
|
||||
downloaded_content = downloaded_file.read() # read entire file as bytes
|
||||
readable_hash = hashlib.sha256(downloaded_content).hexdigest()
|
||||
if expected_hash == readable_hash:
|
||||
return
|
||||
raise ValueError(f"Checksum mismatch for file {os.path.basename(file_name)}:\n\
|
||||
expected: {expected_hash}\n\
|
||||
actual: {readable_hash}\n\
|
||||
When in doubt, try deleting the file in question -- it will be downloaded again when running \
|
||||
this script the next time")
|
||||
|
||||
@staticmethod
|
||||
def download_file(url, directory, file_name, silent=False):
|
||||
"""
|
||||
Download a single source archive.
|
||||
"""
|
||||
abs_file_name = os.path.join(directory, file_name)
|
||||
|
||||
# Create a directory for downloaded file
|
||||
if not os.path.isdir(directory):
|
||||
os.mkdir(directory)
|
||||
|
||||
# Actually download the file
|
||||
headers = {
|
||||
"Accept-Encoding": "identity",
|
||||
"User-Agent": "curl/7.88.1"
|
||||
}
|
||||
if not os.path.isfile(abs_file_name):
|
||||
if not silent:
|
||||
print(f"Downloading: {file_name}")
|
||||
response = requests.get(url, allow_redirects=True, stream=True,
|
||||
headers=headers, timeout=20)
|
||||
if response.status_code == 200:
|
||||
with open(abs_file_name, 'wb') as target_file:
|
||||
target_file.write(response.raw.read())
|
||||
else:
|
||||
raise requests.HTTPError("Download failed: HTTP " +
|
||||
str(response.status_code) + " " + response.reason)
|
||||
return abs_file_name
|
||||
|
||||
def get_packages(self):
|
||||
"""Prepare remaining sources"""
|
||||
for line in self.source_manifest:
|
||||
try:
|
||||
path = self.download_file(line[2], line[1], line[3])
|
||||
except requests.HTTPError:
|
||||
print(traceback.format_exc())
|
||||
for line in self.source_manifest:
|
||||
path = os.path.join(line[1], line[3])
|
||||
self.check_file(path, line[0])
|
||||
|
||||
@classmethod
|
||||
def get_source_manifest(cls, pre_network=False):
|
||||
"""
|
||||
Generate a source manifest for the system.
|
||||
"""
|
||||
entries = []
|
||||
directory = os.path.relpath(cls.distfiles_dir, cls.git_dir)
|
||||
|
||||
# Find all source files
|
||||
steps_dir = os.path.join(cls.git_dir, 'steps')
|
||||
with open(os.path.join(steps_dir, 'manifest'), 'r', encoding="utf_8") as file:
|
||||
for line in file:
|
||||
if pre_network and line.strip().startswith("improve: ") and "network" in line:
|
||||
break
|
||||
|
||||
if not line.strip().startswith("build: "):
|
||||
continue
|
||||
|
||||
step = line.split(" ")[1].split("#")[0].strip()
|
||||
sourcef = os.path.join(steps_dir, step, "sources")
|
||||
if os.path.exists(sourcef):
|
||||
# Read sources from the source file
|
||||
with open(sourcef, "r", encoding="utf_8") as sources:
|
||||
for source in sources.readlines():
|
||||
source = source.strip().split(" ")
|
||||
|
||||
if len(source) > 2:
|
||||
file_name = source[2]
|
||||
else:
|
||||
# Automatically determine file name based on URL.
|
||||
file_name = os.path.basename(source[0])
|
||||
|
||||
entry = (source[1], directory, source[0], file_name)
|
||||
if entry not in entries:
|
||||
entries.append(entry)
|
||||
|
||||
return entries
|
||||
|
||||
stage0_arch_map = {
|
||||
"amd64": "AMD64",
|
||||
}
|
|
@ -0,0 +1,132 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
This file contains a few functions to be shared by all Sys* classes
|
||||
"""
|
||||
|
||||
# SPDX-FileCopyrightText: 2022-2023 Dor Askayo <dor.askayo@gmail.com>
|
||||
# SPDX-FileCopyrightText: 2021-23 fosslinux <fosslinux@aussies.space>
|
||||
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import os
|
||||
import hashlib
|
||||
import glob
|
||||
import subprocess
|
||||
|
||||
import requests
|
||||
|
||||
class SysGeneral:
|
||||
"""
|
||||
A class from which all Sys* class are extended.
|
||||
Contains functions used in all Sys*
|
||||
"""
|
||||
|
||||
# All of these are variables defined in the individual Sys* classes
|
||||
cache_dir = None
|
||||
base_dir = None
|
||||
git_dir = None
|
||||
sys_dir = None
|
||||
initramfs_path = None
|
||||
tmp_dir = None
|
||||
|
||||
def check_file(self, file_name, expected_hash):
|
||||
"""Check hash of downloaded source file."""
|
||||
with open(file_name, "rb") as downloaded_file:
|
||||
downloaded_content = downloaded_file.read() # read entire file as bytes
|
||||
readable_hash = hashlib.sha256(downloaded_content).hexdigest()
|
||||
if expected_hash == readable_hash:
|
||||
return
|
||||
raise ValueError(f"Checksum mismatch for file {os.path.basename(file_name)}:\n\
|
||||
expected: {expected_hash}\n\
|
||||
actual: {readable_hash}\n\
|
||||
When in doubt, try deleting the file in question -- it will be downloaded again when running \
|
||||
this script the next time")
|
||||
|
||||
def download_file(self, url, directory, file_name):
|
||||
"""
|
||||
Download a single source archive.
|
||||
"""
|
||||
abs_file_name = os.path.join(directory, file_name)
|
||||
|
||||
# Create a directory for downloaded file
|
||||
if not os.path.isdir(directory):
|
||||
os.mkdir(directory)
|
||||
|
||||
# Actually download the file
|
||||
headers = {
|
||||
"Accept-Encoding": "identity"
|
||||
}
|
||||
if not os.path.isfile(abs_file_name):
|
||||
print(f"Downloading: {file_name}")
|
||||
response = requests.get(url, allow_redirects=True, stream=True,
|
||||
headers=headers, timeout=20)
|
||||
if response.status_code == 200:
|
||||
with open(abs_file_name, 'wb') as target_file:
|
||||
target_file.write(response.raw.read())
|
||||
else:
|
||||
raise requests.HTTPError("Download failed.")
|
||||
return abs_file_name
|
||||
|
||||
def get_packages(self, source_manifest):
|
||||
"""Prepare remaining sources"""
|
||||
for line in source_manifest.split("\n"):
|
||||
line = line.strip().split(" ")
|
||||
|
||||
path = self.download_file(line[2], line[1], line[3])
|
||||
self.check_file(path, line[0])
|
||||
|
||||
@classmethod
|
||||
def get_source_manifest(cls):
|
||||
"""
|
||||
Generate a source manifest for the system.
|
||||
"""
|
||||
manifest_lines = []
|
||||
directory = os.path.relpath(cls.cache_dir, cls.git_dir)
|
||||
|
||||
# Find all source files
|
||||
for file in os.listdir(cls.sys_dir):
|
||||
if os.path.isdir(os.path.join(cls.sys_dir, file)):
|
||||
sourcef = os.path.join(cls.sys_dir, file, "sources")
|
||||
if os.path.exists(sourcef):
|
||||
# Read sources from the source file
|
||||
with open(sourcef, "r", encoding="utf_8") as sources:
|
||||
for line in sources.readlines():
|
||||
line = line.strip().split(" ")
|
||||
|
||||
if len(line) > 2:
|
||||
file_name = line[2]
|
||||
else:
|
||||
# Automatically determine file name based on URL.
|
||||
file_name = os.path.basename(line[0])
|
||||
|
||||
manifest_lines.append(f"{line[1]} {directory} {line[0]} {file_name}")
|
||||
|
||||
return "\n".join(manifest_lines)
|
||||
|
||||
def make_initramfs(self):
|
||||
"""Package binary bootstrap seeds and sources into initramfs."""
|
||||
self.initramfs_path = os.path.join(self.tmp_dir, 'initramfs')
|
||||
|
||||
# Create a list of files to go within the initramfs
|
||||
file_list = glob.glob(os.path.join(self.tmp_dir, '**'), recursive=True)
|
||||
|
||||
# Use built-in removeprefix once we can use Python 3.9
|
||||
def remove_prefix(text, prefix):
|
||||
if text.startswith(prefix):
|
||||
return text[len(prefix):]
|
||||
return text # or whatever
|
||||
|
||||
file_list = [remove_prefix(f, self.tmp_dir + os.sep) for f in file_list]
|
||||
|
||||
# Create the initramfs
|
||||
with open(self.initramfs_path, "w", encoding="utf_8") as initramfs:
|
||||
# pylint: disable=consider-using-with
|
||||
cpio = subprocess.Popen(
|
||||
["cpio", "--format", "newc", "--create",
|
||||
"--directory", self.tmp_dir],
|
||||
stdin=subprocess.PIPE, stdout=initramfs)
|
||||
cpio.communicate(input='\n'.join(file_list).encode())
|
||||
|
||||
stage0_arch_map = {
|
||||
"amd64": "AMD64",
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
"""
|
||||
Contains a class that represents a target directory
|
||||
"""
|
||||
|
||||
import enum
|
||||
import os
|
||||
|
||||
from lib.utils import mount, create_disk
|
||||
|
||||
class TargetType(enum.Enum):
|
||||
"""Different types of target dirs we can have"""
|
||||
NONE = 0
|
||||
TMPFS = 1
|
||||
|
||||
class Target:
|
||||
"""
|
||||
Represents a target directory
|
||||
"""
|
||||
|
||||
_disks = {}
|
||||
_mountpoints = {}
|
||||
|
||||
def __init__(self, path="target"):
|
||||
self.path = os.path.abspath(path)
|
||||
self._type = TargetType.NONE
|
||||
|
||||
if not os.path.exists(self.path):
|
||||
os.mkdir(self.path)
|
||||
|
||||
def tmpfs(self, size="8G"):
|
||||
"""Mount a tmpfs"""
|
||||
print(f"Mounting tmpfs on {self.path}")
|
||||
mount("tmpfs", self.path, "tmpfs", f"size={size}")
|
||||
self._type = TargetType.TMPFS
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def add_disk(self,
|
||||
name,
|
||||
size="16G",
|
||||
filesystem="ext4",
|
||||
tabletype="msdos",
|
||||
bootable=False,
|
||||
mkfs_args=None):
|
||||
"""Add a disk"""
|
||||
disk_path = os.path.join(self.path, f"{name}.img")
|
||||
create_disk(disk_path,
|
||||
tabletype,
|
||||
filesystem,
|
||||
size,
|
||||
bootable,
|
||||
mkfs_args)
|
||||
self._disks[name] = disk_path
|
||||
|
||||
def get_disk(self, name):
|
||||
"""Get the path to a device of a disk"""
|
||||
return self._disks.get(name)
|
|
@ -0,0 +1,99 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
"""
|
||||
Contains a class that represents a tmpdir
|
||||
"""
|
||||
|
||||
import enum
|
||||
import getpass
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from lib.utils import mount, umount, create_disk, run
|
||||
|
||||
class TmpType(enum.Enum):
|
||||
"""Different types of tmpdirs we can have"""
|
||||
NONE = 0
|
||||
TMPFS = 1
|
||||
|
||||
class Tmpdir:
|
||||
"""
|
||||
Represents a tmpdir
|
||||
"""
|
||||
|
||||
_syses = {}
|
||||
_disks = {}
|
||||
_disk_filesystems = {}
|
||||
_mountpoints = {}
|
||||
|
||||
def __init__(self, preserve, path="tmp"):
|
||||
self.path = os.path.abspath(path)
|
||||
self.preserve = preserve
|
||||
self._type = TmpType.NONE
|
||||
|
||||
if not os.path.exists(self.path):
|
||||
os.mkdir(self.path)
|
||||
|
||||
def __del__(self):
|
||||
for path in self._mountpoints:
|
||||
print(f"Unmounting {path}")
|
||||
umount(path)
|
||||
|
||||
if not self.preserve:
|
||||
for disk in self._disks.values():
|
||||
print(f"Detaching {disk}")
|
||||
run("sudo", "losetup", "-d", disk)
|
||||
|
||||
if self._type == TmpType.TMPFS:
|
||||
print(f"Unmounting tmpdir from {self.path}")
|
||||
umount(self.path)
|
||||
|
||||
print(f"Removing {self.path}")
|
||||
shutil.rmtree(self.path, ignore_errors=True)
|
||||
|
||||
def tmpfs(self, size="8G"):
|
||||
"""Mount a tmpfs"""
|
||||
print(f"Mounting tmpfs on {self.path}")
|
||||
mount("tmpfs", self.path, "tmpfs", f"size={size}")
|
||||
self._type = TmpType.TMPFS
|
||||
|
||||
def add_sys(self, name, subdir=None):
|
||||
"""Create a subdirectory and register a sys"""
|
||||
if subdir is None:
|
||||
subdir = name
|
||||
sys_path = os.path.join(self.path, name)
|
||||
if not os.path.exists(sys_path):
|
||||
os.mkdir(sys_path)
|
||||
return sys_path
|
||||
|
||||
def add_disk(self, name, size="8G", filesystem="ext4"):
|
||||
"""Add a disk"""
|
||||
disk_path = os.path.join(self.path, f"{name}.img")
|
||||
self._disks[name] = create_disk(disk_path, "msdos", filesystem, size)
|
||||
self._disk_filesystems[name] = filesystem
|
||||
# Allow executing user to access it
|
||||
run("sudo", "chown", getpass.getuser(), self._disks[name])
|
||||
|
||||
def mount_disk(self, name, mountpoint=None):
|
||||
"""Mount the disk"""
|
||||
if mountpoint is None:
|
||||
mountpoint = f"{name}_mnt"
|
||||
mountpoint = os.path.join(self.path, mountpoint)
|
||||
os.mkdir(mountpoint)
|
||||
mount(self._disks[name] + "p1", mountpoint, self._disk_filesystems[name])
|
||||
# Allow executing user to access it
|
||||
run("sudo", "chown", getpass.getuser(), mountpoint)
|
||||
self._mountpoints[name] = mountpoint
|
||||
return mountpoint
|
||||
|
||||
def umount_disk(self, name):
|
||||
"""Unmount a disk"""
|
||||
umount(self._mountpoints[name])
|
||||
del self._mountpoints[name]
|
||||
|
||||
def get_disk(self, name):
|
||||
"""Get the path to a device of a disk"""
|
||||
return self._disks[name]
|
28
lib/utils.py
28
lib/utils.py
|
@ -25,33 +25,27 @@ def run(*args, **kwargs):
|
|||
print("Bootstrapping failed")
|
||||
sys.exit(1)
|
||||
|
||||
def run_as_root(*args, **kwargs):
|
||||
"""A helper for run that invokes sudo when unprivileged"""
|
||||
if os.geteuid() != 0:
|
||||
return run("sudo", *args, **kwargs)
|
||||
return run(*args, **kwargs)
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
def create_disk(image, disk_type, fs_type, size, bootable=False, mkfs_args=None):
|
||||
def create_disk(image, disk_type, fs_type, size):
|
||||
"""Create a disk image, with a filesystem on it"""
|
||||
if mkfs_args is None:
|
||||
mkfs_args = []
|
||||
run('truncate', '-s', size, image)
|
||||
# First find the device we will use, then actually use it
|
||||
loop_dev = run('sudo', 'losetup', '-f', capture_output=True).stdout.decode().strip()
|
||||
run('sudo', 'losetup', '-P', loop_dev, image)
|
||||
# Create the partition
|
||||
if disk_type != "none":
|
||||
# 1 GiB if bootable, 1 MiB otherwise
|
||||
offset = str(1024 * 1024 * (1024 if bootable else 1))
|
||||
run('parted', '--script', image, 'mklabel', disk_type, 'mkpart',
|
||||
'primary', fs_type, offset + 'B', '100%')
|
||||
run('mkfs.' + fs_type, image, '-E', 'offset=' + offset, *mkfs_args)
|
||||
run('sudo', 'parted', '--script', image, 'mklabel', disk_type, 'mkpart',
|
||||
'primary', 'ext4', '0%', '100%')
|
||||
run('sudo', 'partprobe', loop_dev)
|
||||
run('sudo', 'mkfs.' + fs_type, loop_dev + "p1")
|
||||
return loop_dev
|
||||
|
||||
def mount(source, target, fs_type, options='', **kwargs):
|
||||
"""Mount filesystem"""
|
||||
run_as_root('mount', source, target, '-t', fs_type, '-o', options, **kwargs)
|
||||
run('sudo', 'mount', source, target, '-t', fs_type, '-o', options, **kwargs)
|
||||
|
||||
def umount(target, **kwargs):
|
||||
"""Unmount filesystem"""
|
||||
run_as_root('umount', '--recursive', target, **kwargs)
|
||||
run('sudo', 'umount', '--recursive', target, **kwargs)
|
||||
|
||||
def copytree(src, dst, ignore=shutil.ignore_patterns('*.git*')):
|
||||
"""Copy directory tree into another directory"""
|
||||
|
|
240
rootfs.py
240
rootfs.py
|
@ -12,49 +12,40 @@ you can run bootstap inside chroot.
|
|||
# SPDX-FileCopyrightText: 2021 Bastian Bittorf <bb@npl.de>
|
||||
# SPDX-FileCopyrightText: 2021 Melg Eight <public.melg8@gmail.com>
|
||||
# SPDX-FileCopyrightText: 2021-23 fosslinux <fosslinux@aussies.space>
|
||||
# SPDX-FileCopyrightText: 2023-24 Gábor Stefanik <netrolller.3d@gmail.com>
|
||||
|
||||
import argparse
|
||||
import os
|
||||
|
||||
from lib.utils import run, run_as_root
|
||||
from lib.target import Target
|
||||
from lib.generator import Generator, stage0_arch_map
|
||||
from sysa import SysA
|
||||
from sysc import SysC
|
||||
from lib.utils import run
|
||||
from lib.sysgeneral import stage0_arch_map
|
||||
from lib.tmpdir import Tmpdir
|
||||
|
||||
def create_configuration_file(args):
|
||||
"""
|
||||
Creates bootstrap.cfg file which would contain options used to
|
||||
customize bootstrap.
|
||||
"""
|
||||
config_path = os.path.join('steps', 'bootstrap.cfg')
|
||||
config_path = os.path.join('sysa', 'bootstrap.cfg')
|
||||
with open(config_path, "w", encoding="utf_8") as config:
|
||||
config.write(f"ARCH={args.arch}\n")
|
||||
config.write(f"ARCH_DIR={stage0_arch_map.get(args.arch, args.arch)}\n")
|
||||
config.write(f"FORCE_TIMESTAMPS={args.force_timestamps}\n")
|
||||
config.write(f"CHROOT={args.chroot or args.bwrap}\n")
|
||||
config.write(f"CHROOT_ONLY_SYSA={args.bwrap}\n")
|
||||
config.write(f"UPDATE_CHECKSUMS={args.update_checksums}\n")
|
||||
config.write(f"JOBS={args.cores}\n")
|
||||
config.write(f"SWAP_SIZE={args.swap}\n")
|
||||
config.write(f"FINAL_JOBS={args.cores}\n")
|
||||
config.write(f"INTERNAL_CI={args.internal_ci or False}\n")
|
||||
config.write(f"INTERACTIVE={args.interactive}\n")
|
||||
config.write(f"BARE_METAL={args.bare_metal or (args.qemu and args.interactive)}\n")
|
||||
config.write("DISK=sda1\n")
|
||||
if (args.bare_metal or args.qemu) and not args.kernel:
|
||||
if args.repo or args.external_sources:
|
||||
config.write("DISK=sdb1\n")
|
||||
else:
|
||||
config.write("DISK=sda\n")
|
||||
config.write("KERNEL_BOOTSTRAP=True\n")
|
||||
else:
|
||||
config.write("DISK=sda1\n")
|
||||
config.write("KERNEL_BOOTSTRAP=False\n")
|
||||
config.write(f"BUILD_KERNELS={args.update_checksums or args.build_kernels}\n")
|
||||
|
||||
# pylint: disable=too-many-statements,too-many-branches
|
||||
# pylint: disable=too-many-statements
|
||||
def main():
|
||||
"""
|
||||
A few command line arguments to customize bootstrap.
|
||||
This function also creates object which prepares directory
|
||||
This function also creates SysA object which prepares directory
|
||||
structure with bootstrap seeds and all sources.
|
||||
"""
|
||||
parser = argparse.ArgumentParser()
|
||||
|
@ -64,9 +55,11 @@ def main():
|
|||
action="store_true")
|
||||
parser.add_argument("-bw", "--bwrap", help="Run inside a bwrap sandbox",
|
||||
action="store_true")
|
||||
parser.add_argument("-t", "--target", help="Target directory",
|
||||
default="target")
|
||||
parser.add_argument("--tmpfs", help="Use a tmpfs on target",
|
||||
parser.add_argument("-p", "--preserve", help="Do not remove temporary dir",
|
||||
action="store_true")
|
||||
parser.add_argument("-t", "--tmpdir", help="Temporary directory",
|
||||
default="tmp")
|
||||
parser.add_argument("--tmpfs", help="Use a tmpfs on tmpdir",
|
||||
action="store_true")
|
||||
parser.add_argument("--tmpfs-size", help="Size of the tmpfs",
|
||||
default="8G")
|
||||
|
@ -76,27 +69,21 @@ def main():
|
|||
help="Force all files timestamps to be 0 unix time",
|
||||
action="store_true")
|
||||
parser.add_argument("--update-checksums",
|
||||
help="Update checksum files",
|
||||
help="Update checksum files.",
|
||||
action="store_true")
|
||||
parser.add_argument("--external-sources",
|
||||
help="Download sources externally from live-bootstrap",
|
||||
help="Download sources externally from live-bootstrap.",
|
||||
action="store_true")
|
||||
parser.add_argument("--build-kernels",
|
||||
help="Also build kernels in chroot and bwrap builds",
|
||||
help="Also build kernels in chroot and bwrap builds.",
|
||||
action="store_true")
|
||||
parser.add_argument("--no-create-config",
|
||||
help="Do not automatically create config file",
|
||||
action="store_true")
|
||||
parser.add_argument("-i", "--interactive",
|
||||
help="Use interactive prompts to resolve issues during bootstrap",
|
||||
action="store_true")
|
||||
parser.add_argument("-r", "--repo",
|
||||
help="Path to prebuilt binary packages", nargs=None)
|
||||
help="Path to prebuilt binary packages.", nargs=None)
|
||||
parser.add_argument("--early-preseed",
|
||||
help="Skip early stages of live-bootstrap", nargs=None)
|
||||
parser.add_argument("--internal-ci", help="INTERNAL for github CI")
|
||||
parser.add_argument("-s", "--swap", help="Swap space to allocate in Linux",
|
||||
default=0)
|
||||
help="Skip early stages of live-bootstrap.", nargs=None)
|
||||
|
||||
# QEMU arguments
|
||||
parser.add_argument("-q", "--qemu", help="Use QEMU",
|
||||
|
@ -105,9 +92,7 @@ def main():
|
|||
default="qemu-system-x86_64")
|
||||
parser.add_argument("-qr", "--qemu-ram", help="Memory (in megabytes) allocated to QEMU VM",
|
||||
default=4096)
|
||||
parser.add_argument("-qs", "--target-size", help="Size of the target image (for QEMU only)",
|
||||
default="16G")
|
||||
parser.add_argument("-qk", "--kernel", help="Custom early kernel to use")
|
||||
parser.add_argument("-qk", "--kernel", help="Custom sysa kernel to use")
|
||||
|
||||
parser.add_argument("-b", "--bare-metal", help="Build images for bare metal",
|
||||
action="store_true")
|
||||
|
@ -134,10 +119,10 @@ def main():
|
|||
raise ValueError("One of qemu, chroot, bwrap, or bare metal must be selected.")
|
||||
|
||||
# Arch validation
|
||||
if args.arch != "x86":
|
||||
print("Only x86 is supported at the moment, other arches are for development only.")
|
||||
#if args.arch != "x86" and args.arch != "amd64":
|
||||
# raise ValueError("Only x86 is supported at the moment.")
|
||||
|
||||
# Tmpfs validation
|
||||
# Tmp validation
|
||||
if args.bwrap and args.tmpfs:
|
||||
raise ValueError("tmpfs cannot be used with bwrap.")
|
||||
|
||||
|
@ -145,151 +130,130 @@ def main():
|
|||
if int(args.cores) < 1:
|
||||
raise ValueError("Must use one or more cores.")
|
||||
|
||||
# Target image size validation
|
||||
if args.qemu:
|
||||
if int(str(args.target_size).rstrip('gGmM')) < 1:
|
||||
raise ValueError("Please specify a positive target size for qemu.")
|
||||
args.target_size = (int(str(args.target_size).rstrip('gGmM')) *
|
||||
(1024 if str(args.target_size).lower().endswith('g') else 1))
|
||||
else:
|
||||
args.target_size = 0
|
||||
|
||||
# Swap file size validation
|
||||
if args.qemu or args.bare_metal:
|
||||
args.swap = (int(str(args.swap).rstrip('gGmM')) *
|
||||
(1024 if str(args.swap).lower().endswith('g') else 1))
|
||||
else:
|
||||
args.swap = 0
|
||||
|
||||
# Set constant umask
|
||||
os.umask(0o022)
|
||||
|
||||
# bootstrap.cfg
|
||||
if args.bare_metal:
|
||||
args.no_create_config = True
|
||||
|
||||
try:
|
||||
os.remove(os.path.join('steps', 'bootstrap.cfg'))
|
||||
os.remove(os.path.join('sysa', 'bootstrap.cfg'))
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
if not args.no_create_config:
|
||||
create_configuration_file(args)
|
||||
else:
|
||||
with open(os.path.join('steps', 'bootstrap.cfg'), 'a', encoding='UTF-8'):
|
||||
with open(os.path.join('sysa', 'bootstrap.cfg'), 'a', encoding='UTF-8'):
|
||||
pass
|
||||
|
||||
# target
|
||||
target = Target(path=args.target)
|
||||
# tmpdir
|
||||
tmpdir = Tmpdir(path=args.tmpdir, preserve=args.preserve)
|
||||
if args.tmpfs:
|
||||
target.tmpfs(size=args.tmpfs_size)
|
||||
tmpdir.tmpfs(size=args.tmpfs_size)
|
||||
|
||||
generator = Generator(arch=args.arch,
|
||||
external_sources=args.external_sources,
|
||||
repo_path=args.repo,
|
||||
early_preseed=args.early_preseed)
|
||||
# sys
|
||||
system_c = SysC(arch=args.arch, tmpdir=tmpdir,
|
||||
external_sources=args.external_sources)
|
||||
system_a = SysA(arch=args.arch, early_preseed=args.early_preseed,
|
||||
tmpdir=tmpdir, external_sources=args.external_sources,
|
||||
repo_path=args.repo)
|
||||
|
||||
bootstrap(args, generator, target, args.target_size)
|
||||
bootstrap(args, system_a, system_c, tmpdir)
|
||||
|
||||
def bootstrap(args, generator, target, size):
|
||||
def bootstrap(args, system_a, system_c, tmpdir):
|
||||
"""Kick off bootstrap process."""
|
||||
print(f"Bootstrapping {args.arch}", flush=True)
|
||||
print(f"Bootstrapping {args.arch} -- SysA")
|
||||
if args.chroot:
|
||||
find_chroot = """
|
||||
import shutil
|
||||
print(shutil.which('chroot'))
|
||||
"""
|
||||
chroot_binary = run_as_root('python3', '-c', find_chroot,
|
||||
capture_output=True).stdout.decode().strip()
|
||||
chroot_binary = run('sudo', 'python3', '-c', find_chroot,
|
||||
capture_output=True).stdout.decode().strip()
|
||||
|
||||
generator.prepare(target, using_kernel=False)
|
||||
system_c.prepare(create_disk_image=False)
|
||||
system_a.prepare(create_initramfs=False)
|
||||
|
||||
arch = stage0_arch_map.get(args.arch, args.arch)
|
||||
init = os.path.join(os.sep, 'bootstrap-seeds', 'POSIX', arch, 'kaem-optional-seed')
|
||||
run_as_root('env', '-i', 'PATH=/bin', chroot_binary, generator.target_dir, init)
|
||||
run('sudo', 'env', '-i', 'PATH=/bin', chroot_binary, system_a.tmp_dir, init)
|
||||
|
||||
elif args.bwrap:
|
||||
init = '/init'
|
||||
if not args.internal_ci or args.internal_ci == "pass1":
|
||||
generator.prepare(target, using_kernel=False)
|
||||
system_c.prepare(create_disk_image=False)
|
||||
system_a.prepare(create_initramfs=False)
|
||||
|
||||
arch = stage0_arch_map.get(args.arch, args.arch)
|
||||
init = os.path.join(os.sep, 'bootstrap-seeds', 'POSIX', arch, 'kaem-optional-seed')
|
||||
else:
|
||||
generator.reuse(target)
|
||||
arch = stage0_arch_map.get(args.arch, args.arch)
|
||||
init = os.path.join(os.sep, 'bootstrap-seeds', 'POSIX', arch, 'kaem-optional-seed')
|
||||
run('bwrap', '--unshare-user',
|
||||
'--uid', '0',
|
||||
'--gid', '0',
|
||||
'--unshare-net',
|
||||
'--clearenv',
|
||||
'--setenv', 'PATH', '/usr/bin',
|
||||
'--bind', system_a.tmp_dir, '/',
|
||||
'--dir', '/dev',
|
||||
'--dev-bind', '/dev/null', '/dev/null',
|
||||
'--dev-bind', '/dev/zero', '/dev/zero',
|
||||
'--dev-bind', '/dev/random', '/dev/random',
|
||||
'--dev-bind', '/dev/urandom', '/dev/urandom',
|
||||
'--bind', '/usr/bin/qemu-riscv64', '/usr/bin/qemu-riscv64',
|
||||
init)
|
||||
|
||||
run('env', '-i', 'bwrap', '--unshare-user',
|
||||
'--uid', '0',
|
||||
'--gid', '0',
|
||||
'--unshare-net' if args.external_sources else None,
|
||||
'--setenv', 'PATH', '/usr/bin',
|
||||
'--bind', generator.target_dir, '/',
|
||||
'--dir', '/dev',
|
||||
'--dev-bind', '/dev/null', '/dev/null',
|
||||
'--dev-bind', '/dev/zero', '/dev/zero',
|
||||
'--dev-bind', '/dev/random', '/dev/random',
|
||||
'--dev-bind', '/dev/urandom', '/dev/urandom',
|
||||
'--dev-bind', '/dev/ptmx', '/dev/ptmx',
|
||||
'--dev-bind', '/dev/tty', '/dev/tty',
|
||||
'--tmpfs', '/dev/shm',
|
||||
'--proc', '/proc',
|
||||
'--bind', '/sys', '/sys',
|
||||
'--tmpfs', '/tmp',
|
||||
init)
|
||||
run('bwrap', '--unshare-user',
|
||||
'--uid', '0',
|
||||
'--gid', '0',
|
||||
'--unshare-net' if args.external_sources else None,
|
||||
'--clearenv',
|
||||
'--setenv', 'PATH', '/usr/bin',
|
||||
'--bind', system_a.tmp_dir + "/sysc_image", '/',
|
||||
'--dir', '/dev',
|
||||
'--dev-bind', '/dev/null', '/dev/null',
|
||||
'--dev-bind', '/dev/zero', '/dev/zero',
|
||||
'--dev-bind', '/dev/random', '/dev/random',
|
||||
'--dev-bind', '/dev/urandom', '/dev/urandom',
|
||||
'--tmpfs', '/dev/shm',
|
||||
'--proc', '/proc',
|
||||
'--bind', '/sys', '/sys',
|
||||
'--tmpfs', '/tmp',
|
||||
'/init')
|
||||
|
||||
elif args.bare_metal:
|
||||
if args.kernel:
|
||||
generator.prepare(target, using_kernel=True, target_size=size)
|
||||
path = os.path.join(args.target, os.path.relpath(generator.target_dir, args.target))
|
||||
system_c.prepare(create_disk_image=True)
|
||||
system_a.prepare(create_initramfs=True)
|
||||
print("Please:")
|
||||
print(f" 1. Take {path}/initramfs and your kernel, boot using this.")
|
||||
print(f" 2. Take {path}/disk.img and put this on a writable storage medium.")
|
||||
print(" 1. Take tmp/sysa/initramfs and your kernel, boot using this.")
|
||||
print(" 2. Take tmp/sysc/disk.img and put this on a writable storage medium.")
|
||||
else:
|
||||
generator.prepare(target, kernel_bootstrap=True, target_size=size)
|
||||
path = os.path.join(args.target, os.path.relpath(generator.target_dir, args.target))
|
||||
system_a.prepare(create_initramfs=True, kernel_bootstrap=True)
|
||||
print("Please:")
|
||||
print(f" 1. Take {path}.img and write it to a boot drive and then boot it.")
|
||||
print(" 1. Take tmp/sysa/sysa.img and write it to a boot drive and then boot it.")
|
||||
|
||||
else:
|
||||
if args.kernel:
|
||||
generator.prepare(target, using_kernel=True, target_size=size)
|
||||
system_c.prepare(create_disk_image=True)
|
||||
system_a.prepare(create_initramfs=True)
|
||||
|
||||
arg_list = [
|
||||
run(args.qemu_cmd,
|
||||
'-enable-kvm',
|
||||
'-m', str(args.qemu_ram) + 'M',
|
||||
'-smp', str(args.cores),
|
||||
'-drive', 'file=' + target.get_disk("disk") + ',format=raw'
|
||||
]
|
||||
if target.get_disk("external") is not None:
|
||||
arg_list += [
|
||||
'-drive', 'file=' + target.get_disk("external") + ',format=raw',
|
||||
]
|
||||
arg_list += [
|
||||
'-no-reboot',
|
||||
'-hda', tmpdir.get_disk("sysc"),
|
||||
'-nic', 'user,ipv6=off,model=e1000',
|
||||
'-kernel', args.kernel,
|
||||
'-append',
|
||||
]
|
||||
if args.interactive:
|
||||
arg_list += ['consoleblank=0 earlyprintk=vga root=/dev/sda1 '
|
||||
'rootfstype=ext3 init=/init rw']
|
||||
else:
|
||||
arg_list += ['console=ttyS0 earlycon=uart8250,io,0x3f8,115200n8 '
|
||||
'root=/dev/sda1 rootfstype=ext3 init=/init rw']
|
||||
'-initrd', system_a.initramfs_path,
|
||||
'-nographic',
|
||||
'-append', 'console=ttyS0')
|
||||
else:
|
||||
generator.prepare(target, kernel_bootstrap=True, target_size=size)
|
||||
arg_list = [
|
||||
system_a.prepare(create_initramfs=True, kernel_bootstrap=True)
|
||||
run(args.qemu_cmd,
|
||||
'-enable-kvm',
|
||||
'-m', str(args.qemu_ram) + 'M',
|
||||
'-m', "4G",
|
||||
'-smp', str(args.cores),
|
||||
'-drive', 'file=' + generator.target_dir + '.img' + ',format=raw'
|
||||
]
|
||||
if target.get_disk("external") is not None:
|
||||
arg_list += [
|
||||
'-drive', 'file=' + target.get_disk("external") + ',format=raw',
|
||||
]
|
||||
arg_list += [
|
||||
'-no-reboot',
|
||||
'-drive', 'file=' + os.path.join(system_a.tmp_dir, 'sysa.img') + ',format=raw',
|
||||
'-machine', 'kernel-irqchip=split',
|
||||
'-nic', 'user,ipv6=off,model=e1000'
|
||||
]
|
||||
if not args.interactive:
|
||||
arg_list += ['-no-reboot', '-nographic']
|
||||
run(args.qemu_cmd, *arg_list)
|
||||
'-nic', 'user,ipv6=off,model=e1000',
|
||||
'-nographic')
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
/script-generator /steps/manifest
|
||||
/usr/bin/kaem --file /preseed-jump.kaem
|
|
@ -1 +0,0 @@
|
|||
1927a357c893d60952616146e788af25e637635b2862650914bf895d27f556a6 script-generator
|
|
@ -1,641 +0,0 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
#define MAX_TOKEN 64
|
||||
#define MAX_STRING 2048
|
||||
|
||||
#include <bootstrappable.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
struct Token {
|
||||
char *val;
|
||||
struct Token *next;
|
||||
};
|
||||
typedef struct Token Token;
|
||||
|
||||
#define TYPE_BUILD 1
|
||||
#define TYPE_IMPROVE 2
|
||||
#define TYPE_DEFINE 3
|
||||
#define TYPE_JUMP 4
|
||||
#define TYPE_UNINSTALL 5
|
||||
|
||||
struct Directive {
|
||||
Token *tok;
|
||||
struct Directive *next;
|
||||
int type;
|
||||
char *arg; /* The primary argument */
|
||||
};
|
||||
typedef struct Directive Directive;
|
||||
|
||||
/* Tokenizer. */
|
||||
|
||||
/* Skip over a comment. */
|
||||
char consume_comment(FILE *in) {
|
||||
/* Discard the rest of the line. */
|
||||
char c = fgetc(in);
|
||||
while (c != -1 && c != '\n')
|
||||
c = fgetc(in);
|
||||
return c;
|
||||
}
|
||||
|
||||
char consume_line(FILE *in, Directive *directive) {
|
||||
char c = fgetc(in);
|
||||
|
||||
/* Short-circuit if whole line is comment or blank line. */
|
||||
if (c == '#') {
|
||||
c = consume_comment(in);
|
||||
return c;
|
||||
} else if (c == '\n' || c == -1) {
|
||||
return c;
|
||||
}
|
||||
|
||||
/* Ok, we will have something to put here. */
|
||||
directive->next = calloc(1, sizeof(Directive));
|
||||
directive = directive->next;
|
||||
|
||||
Token *head = calloc(1, sizeof(Token));
|
||||
Token *cur = head;
|
||||
char *out;
|
||||
int i = 0;
|
||||
while (c != -1 && c != '\n') {
|
||||
/* Initialize next token. */
|
||||
cur->next = calloc(1, sizeof(Token));
|
||||
cur = cur->next;
|
||||
cur->val = calloc(MAX_TOKEN, sizeof(char));
|
||||
out = cur->val;
|
||||
/* Copy line to token until a space (or EOL/EOF) or comment is found. */
|
||||
while (c != -1 && c != '\n' && c != ' ' && c != '#') {
|
||||
out[0] = c;
|
||||
out += 1;
|
||||
c = fgetc(in);
|
||||
}
|
||||
/* Go to start of next token. */
|
||||
if (c == ' ') {
|
||||
c = fgetc(in);
|
||||
}
|
||||
/* Handle comment. */
|
||||
if (c == '#') {
|
||||
c = consume_comment(in);
|
||||
}
|
||||
}
|
||||
|
||||
/* Add information to directive. */
|
||||
directive->tok = head->next;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
Directive *tokenizer(FILE *in) {
|
||||
Directive *head = calloc(1, sizeof(Directive));
|
||||
Directive *cur = head;
|
||||
|
||||
char c;
|
||||
while (c != -1) {
|
||||
/*
|
||||
* Note that consume_line fills cur->next, not cur.
|
||||
* This avoids having an empty last Directive.
|
||||
*/
|
||||
c = consume_line(in, cur);
|
||||
if (cur->next != NULL) {
|
||||
cur = cur->next;
|
||||
}
|
||||
}
|
||||
return head->next;
|
||||
}
|
||||
|
||||
/* Config variables. */
|
||||
|
||||
struct Variable {
|
||||
char *name;
|
||||
char *val;
|
||||
struct Variable *next;
|
||||
};
|
||||
typedef struct Variable Variable;
|
||||
|
||||
Variable *variables;
|
||||
|
||||
Variable *load_config() {
|
||||
FILE *config = fopen("/steps/bootstrap.cfg", "r");
|
||||
/* File does not exist check. */
|
||||
if (config == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *line = calloc(MAX_STRING, sizeof(char));
|
||||
Variable *head = calloc(1, sizeof(Variable));
|
||||
Variable *cur = head;
|
||||
/* For each line... */
|
||||
char *equals;
|
||||
while (fgets(line, MAX_STRING, config) != 0) {
|
||||
/* Weird M2-Planet behaviour. */
|
||||
if (*line == 0) {
|
||||
break;
|
||||
}
|
||||
cur->next = calloc(1, sizeof(Variable));
|
||||
cur = cur->next;
|
||||
/* Split on the equals. First half is name, second half is value. */
|
||||
equals = strchr(line, '=');
|
||||
if (equals == 0) {
|
||||
fputs("bootstrap.cfg should have the format var=val on each line.", stderr);
|
||||
exit(1);
|
||||
}
|
||||
cur->name = calloc(equals - line + 1, sizeof(char));
|
||||
strncpy(cur->name, line, equals - line);
|
||||
equals += 1;
|
||||
cur->val = calloc(strlen(equals), sizeof(char));
|
||||
strncpy(cur->val, equals, strlen(equals) - 1);
|
||||
line = calloc(MAX_STRING, sizeof(char));
|
||||
}
|
||||
variables = head->next;
|
||||
fclose(config);
|
||||
}
|
||||
|
||||
void output_config(FILE *out) {
|
||||
Variable *variable;
|
||||
for (variable = variables; variable != NULL; variable = variable->next) {
|
||||
fputs(variable->name, out);
|
||||
fputs("=", out);
|
||||
fputs(variable->val, out);
|
||||
fputs("\n", out);
|
||||
}
|
||||
}
|
||||
|
||||
char *get_var(char *name) {
|
||||
/* Search through existing variables. */
|
||||
Variable *var;
|
||||
Variable *last = NULL;
|
||||
for (var = variables; var != NULL; var = var->next) {
|
||||
if (strcmp(name, var->name) == 0) {
|
||||
return var->val;
|
||||
}
|
||||
last = var;
|
||||
}
|
||||
|
||||
/* If the variable is unset, prompt the user. */
|
||||
if (variables == NULL) {
|
||||
variables = calloc(1, sizeof(Variable));
|
||||
var = variables;
|
||||
} else {
|
||||
last->next = calloc(1, sizeof(Variable));
|
||||
var = last->next;
|
||||
}
|
||||
var->name = calloc(strlen(name) + 1, sizeof(char));
|
||||
strcpy(var->name, name);
|
||||
var->val = calloc(MAX_STRING, sizeof(char));
|
||||
fputs("You have not set a value for ", stdout);
|
||||
fputs(name, stdout);
|
||||
fputs(" in bootstrap.cfg. Please set it now:\n", stdout);
|
||||
while (fgets(var->val, MAX_STRING, stdin) == 0 || var->val[0] == '\n') {
|
||||
fputs("Error inputting, try again:\n", stdout);
|
||||
}
|
||||
if (var->val[0] == 0) {
|
||||
fputs("You put in an EOF!\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
/* Trim the newline. */
|
||||
var->val[strlen(var->val)] = 0;
|
||||
return var->val;
|
||||
}
|
||||
|
||||
/* Recursive descent interpreter. */
|
||||
|
||||
Token *fill(Token *tok, Directive *directive, int type) {
|
||||
directive->type = type;
|
||||
directive->arg = tok->val;
|
||||
return tok->next;
|
||||
}
|
||||
|
||||
Token *logic(Token *tok, char **val) {
|
||||
/* logic = "("
|
||||
* (name |
|
||||
* (name "==" value) |
|
||||
* (name "!=" value) |
|
||||
* (logic "||" logic) |
|
||||
* (logic "&&" logic))
|
||||
* ")"
|
||||
*/
|
||||
|
||||
char *lhs = tok->val;
|
||||
char *rhs;
|
||||
tok = tok->next;
|
||||
if (strcmp(tok->val, ")") == 0) {
|
||||
/* Case where it's just a constant. */
|
||||
*val = lhs;
|
||||
return tok;
|
||||
} else if (strcmp(tok->val, "==") == 0) {
|
||||
/* Case for equality. */
|
||||
rhs = tok->next->val;
|
||||
tok = tok->next->next;
|
||||
if (strcmp(get_var(lhs), rhs) == 0) {
|
||||
lhs = "True";
|
||||
} else {
|
||||
lhs = "False";
|
||||
}
|
||||
} else if (strcmp(tok->val, "!=") == 0) {
|
||||
/* Case for inequality. */
|
||||
rhs = tok->next->val;
|
||||
tok = tok->next->next;
|
||||
if (strcmp(get_var(lhs), rhs) == 0) {
|
||||
lhs = "False";
|
||||
} else {
|
||||
lhs = "True";
|
||||
}
|
||||
} else {
|
||||
fputs("Expected == or != after ", stderr);
|
||||
fputs(lhs, stderr);
|
||||
fputs(" in logic\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (strcmp(tok->val, ")") == 0) {
|
||||
*val = lhs;
|
||||
return tok;
|
||||
} else if (strcmp(tok->val, "||") == 0) {
|
||||
/* OR */
|
||||
tok = logic(tok->next, &rhs);
|
||||
if (strcmp(lhs, "True") == 0 || strcmp(rhs, "True") == 0) {
|
||||
lhs = "True";
|
||||
} else {
|
||||
lhs = "False";
|
||||
}
|
||||
} else if (strcmp(tok->val, "&&") == 0) {
|
||||
/* AND */
|
||||
tok = logic(tok->next, &rhs);
|
||||
if (strcmp(lhs, "True") == 0 && strcmp(rhs, "True") == 0) {
|
||||
lhs = "True";
|
||||
} else {
|
||||
lhs = "False";
|
||||
}
|
||||
} else {
|
||||
fputs("Expected || or && in logic\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
*val = lhs;
|
||||
return tok;
|
||||
}
|
||||
|
||||
Token *primary_logic(Token *tok, char **val) {
|
||||
/* Starting ( */
|
||||
if (strcmp(tok->val, "(") != 0) {
|
||||
fputs("Expected logic to begin with (\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
tok = tok->next;
|
||||
|
||||
tok = logic(tok, val);
|
||||
|
||||
if (strcmp(tok->val, ")") != 0) {
|
||||
fputs("Expected logic to end with )\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
return tok;
|
||||
}
|
||||
|
||||
int eval_predicate(Token *tok) {
|
||||
char *result;
|
||||
tok = primary_logic(tok, &result);
|
||||
return strcmp(result, "True") == 0;
|
||||
}
|
||||
|
||||
Token *define(Token *tok, Directive *directive) {
|
||||
/* define = name "=" (logic | constant) */
|
||||
char *name = tok->val;
|
||||
tok = tok->next;
|
||||
if (strcmp(tok->val, "=") != 0) {
|
||||
fputs("define of ", stderr);
|
||||
fputs(name, stderr);
|
||||
fputs(" has a missing equals\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
tok = tok->next;
|
||||
|
||||
char *val = calloc(MAX_STRING, sizeof(char));
|
||||
if (strcmp(tok->val, "(") == 0) {
|
||||
/* It is a logic. */
|
||||
tok = primary_logic(tok, &val);
|
||||
} else {
|
||||
/* It is a constant. */
|
||||
strcpy(val, tok->val);
|
||||
}
|
||||
|
||||
/* Check for predicate. */
|
||||
tok = tok->next;
|
||||
if (tok != NULL) {
|
||||
if (!eval_predicate(tok)) {
|
||||
/* Nothing more to do. */
|
||||
return tok;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update existing variable, or else, add to the end of variables. */
|
||||
/* Special case: empty variables. */
|
||||
if (variables == NULL) {
|
||||
variables = calloc(1, sizeof(Variable));
|
||||
variables->name = name;
|
||||
variables->val = val;
|
||||
}
|
||||
|
||||
Variable *var;
|
||||
for (var = variables; var->next != NULL; var = var->next) {
|
||||
if (strcmp(var->next->name, name) == 0) {
|
||||
var->next->val = val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (var->next == NULL) {
|
||||
/* We did not update an existing variable. */
|
||||
var->next = calloc(1, sizeof(Variable));
|
||||
var->next->name = name;
|
||||
var->next->val = val;
|
||||
}
|
||||
|
||||
return tok;
|
||||
}
|
||||
|
||||
int interpret(Directive *directive) {
|
||||
/* directive = (build | improve | define | jump | uninstall) predicate? */
|
||||
Token *tok = directive->tok;
|
||||
if (strcmp(tok->val, "build:") == 0) {
|
||||
tok = fill(tok->next, directive, TYPE_BUILD);
|
||||
} else if (strcmp(tok->val, "improve:") == 0) {
|
||||
tok = fill(tok->next, directive, TYPE_IMPROVE);
|
||||
} else if (strcmp(tok->val, "jump:") == 0) {
|
||||
tok = fill(tok->next, directive, TYPE_JUMP);
|
||||
} else if (strcmp(tok->val, "define:") == 0) {
|
||||
tok = define(tok->next, directive);
|
||||
return 1; /* There is no codegen for a define. */
|
||||
} else if (strcmp(tok->val, "uninstall:") == 0) {
|
||||
tok = fill(tok->next, directive, TYPE_UNINSTALL);
|
||||
while (tok != NULL) {
|
||||
if (strcmp(tok->val, "(") == 0) {
|
||||
break;
|
||||
}
|
||||
if (strlen(directive->arg) + strlen(tok->val) + 1 > MAX_STRING) {
|
||||
fputs("somehow you have managed to have too many uninstall arguments.\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
directive->arg = strcat(directive->arg, " ");
|
||||
directive->arg = strcat(directive->arg, tok->val);
|
||||
tok = tok->next;
|
||||
}
|
||||
}
|
||||
|
||||
if (tok != NULL) {
|
||||
return !eval_predicate(tok);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Directive *interpreter(Directive *directives) {
|
||||
Directive *directive;
|
||||
Directive *last = NULL;
|
||||
for (directive = directives; directive != NULL; directive = directive->next) {
|
||||
if (interpret(directive)) {
|
||||
/* This means this directive needs to be removed from the linked list. */
|
||||
if (last == NULL) {
|
||||
/* First directive. */
|
||||
directives = directive->next;
|
||||
} else {
|
||||
last->next = directive->next;
|
||||
}
|
||||
} else {
|
||||
last = directive;
|
||||
}
|
||||
}
|
||||
return directives;
|
||||
}
|
||||
|
||||
/* Script generator. */
|
||||
FILE *start_script(int id, int bash_build) {
|
||||
/* Create the file /steps/$id.sh */
|
||||
char *filename = calloc(MAX_STRING, sizeof(char));
|
||||
strcpy(filename, "/steps/");
|
||||
strcat(filename, int2str(id, 10, 0));
|
||||
strcat(filename, ".sh");
|
||||
|
||||
FILE *out = fopen(filename, "w");
|
||||
if (out == NULL) {
|
||||
fputs("Error opening output file ", stderr);
|
||||
fputs(filename, stderr);
|
||||
fputs("\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (bash_build) {
|
||||
fputs("#!/bin/bash\n", out);
|
||||
if (strcmp(get_var("INTERACTIVE"), "True") == 0) {
|
||||
if (bash_build != 1) {
|
||||
fputs("set -E\ntrap 'env PS1=\"[TRAP] \\w # \" bash -i' ERR\n", out);
|
||||
} else {
|
||||
/* FIXME early bash has buggy ERR trap handling */
|
||||
fputs("set -e\ntrap 'bash -c '\"'\"'while true; do printf \""
|
||||
"[TRAP - use Ctrl+D] $(pwd) # \"; eval \"$(cat)\"; done'\"'\"'' EXIT\n",
|
||||
out);
|
||||
}
|
||||
} else {
|
||||
fputs("set -e\n", out);
|
||||
}
|
||||
fputs("cd /steps\n", out);
|
||||
fputs(". ./bootstrap.cfg\n", out);
|
||||
fputs(". ./env\n", out);
|
||||
fputs(". ./helpers.sh\n", out);
|
||||
} else {
|
||||
fputs("set -ex\n", out);
|
||||
fputs("cd /steps\n", out);
|
||||
output_config(out);
|
||||
FILE *env = fopen("/steps/env", "r");
|
||||
char *line = calloc(MAX_STRING, sizeof(char));
|
||||
while (fgets(line, MAX_STRING, env) != 0) {
|
||||
/* Weird M2-Planet behaviour. */
|
||||
if (*line == 0) {
|
||||
break;
|
||||
}
|
||||
fputs(line, out);
|
||||
line = calloc(MAX_STRING, sizeof(char));
|
||||
}
|
||||
fclose(env);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
void output_call_script(FILE *out, char *type, char *name, int bash_build, int source) {
|
||||
if (bash_build) {
|
||||
if (source) {
|
||||
fputs(". ", out);
|
||||
} else {
|
||||
fputs("bash ", out);
|
||||
}
|
||||
} else {
|
||||
fputs("kaem --file ", out);
|
||||
}
|
||||
fputs("/steps/", out);
|
||||
if (strlen(type) != 0) {
|
||||
fputs(type, out);
|
||||
fputs("/", out);
|
||||
}
|
||||
fputs(name, out);
|
||||
fputs(".sh\n", out);
|
||||
}
|
||||
|
||||
void output_build(FILE *out, Directive *directive, int pass_no, int bash_build) {
|
||||
if (bash_build) {
|
||||
fputs("build ", out);
|
||||
fputs(directive->arg, out);
|
||||
fputs(" pass", out);
|
||||
fputs(int2str(pass_no, 10, 0), out);
|
||||
fputs(".sh\n", out);
|
||||
} else {
|
||||
fputs("pkg=", out);
|
||||
fputs(directive->arg, out);
|
||||
fputs("\n", out);
|
||||
fputs("cd ${pkg}\n", out);
|
||||
fputs("kaem --file pass", out);
|
||||
fputs(int2str(pass_no, 10, 0), out);
|
||||
fputs(".kaem\n", out);
|
||||
fputs("cd ..\n", out);
|
||||
}
|
||||
}
|
||||
|
||||
void generate_preseed_jump(int id) {
|
||||
FILE *out = fopen("/preseed-jump.kaem", "w");
|
||||
fputs("set -ex\n", out);
|
||||
fputs("PATH=/usr/bin\n", out);
|
||||
fputs("bash /steps/", out);
|
||||
fputs(int2str(id, 10, 0), out);
|
||||
fputs(".sh\n", out);
|
||||
fclose(out);
|
||||
}
|
||||
|
||||
void generate(Directive *directives) {
|
||||
/*
|
||||
* We are separating the stages given in the mainfest into a bunch of
|
||||
* smaller scripts. The following conditions call for the creation of
|
||||
* a new script:
|
||||
* - a jump
|
||||
* - build of bash
|
||||
*/
|
||||
|
||||
int counter = 0;
|
||||
|
||||
/* Initially, we use kaem, not bash. */
|
||||
int bash_build = 0;
|
||||
|
||||
FILE *out = start_script(counter, bash_build);
|
||||
counter += 1;
|
||||
|
||||
Directive *directive;
|
||||
Directive *past;
|
||||
char *filename;
|
||||
int pass_no;
|
||||
for (directive = directives; directive != NULL; directive = directive->next) {
|
||||
if (directive->type == TYPE_BUILD) {
|
||||
/* Get what pass number this is. */
|
||||
pass_no = 1;
|
||||
for (past = directives; past != directive; past = past->next) {
|
||||
if (strcmp(past->arg, directive->arg) == 0) {
|
||||
pass_no += 1;
|
||||
}
|
||||
}
|
||||
output_build(out, directive, pass_no, bash_build);
|
||||
if (strncmp(directive->arg, "bash-", 5) == 0) {
|
||||
if (!bash_build) {
|
||||
/*
|
||||
* We are transitioning from bash to kaem, the point at which "early
|
||||
* preseed" occurs. So generate the preseed jump script at this point.
|
||||
*/
|
||||
generate_preseed_jump(counter);
|
||||
}
|
||||
bash_build += 1;
|
||||
/* Create call to new script. */
|
||||
output_call_script(out, "", int2str(counter, 10, 0), bash_build, 0);
|
||||
fclose(out);
|
||||
out = start_script(counter, bash_build);
|
||||
counter += 1;
|
||||
}
|
||||
} else if (directive->type == TYPE_IMPROVE) {
|
||||
output_call_script(out, "improve", directive->arg, bash_build, 1);
|
||||
} else if (directive->type == TYPE_JUMP) {
|
||||
/*
|
||||
* Create /init to call new script.
|
||||
* We actually do this by creating /init.X for some number X, and then
|
||||
* moving that to /init at the appropriate time.
|
||||
*/
|
||||
filename = calloc(MAX_STRING, sizeof(char));
|
||||
if (bash_build) {
|
||||
fputs("mv /init /init.bak\n", out);
|
||||
/* Move new init to /init. */
|
||||
strcpy(filename, "/init.");
|
||||
strcat(filename, int2str(counter, 10, 0));
|
||||
fputs("cp ", out);
|
||||
fputs(filename, out);
|
||||
fputs(" /init\n", out);
|
||||
fputs("chmod 755 /init\n", out);
|
||||
} else {
|
||||
strcpy(filename, "/kaem.run.");
|
||||
strcat(filename, int2str(counter, 10, 0));
|
||||
fputs("cp ", out);
|
||||
fputs(filename, out);
|
||||
fputs(" /kaem.run\n", out);
|
||||
fputs("cp /usr/bin/kaem /init\n", out);
|
||||
fputs("chmod 755 /init\n", out);
|
||||
}
|
||||
|
||||
output_call_script(out, "jump", directive->arg, bash_build, 1);
|
||||
fclose(out);
|
||||
|
||||
if (bash_build) {
|
||||
out = fopen(filename, "w");
|
||||
if (out == NULL) {
|
||||
fputs("Error opening /init\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
fputs("#!/bin/bash\n", out);
|
||||
} else {
|
||||
out = fopen(filename, "w");
|
||||
if (out == NULL) {
|
||||
fputs("Error opening /kaem.run\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
fputs("set -ex\n", out);
|
||||
}
|
||||
output_call_script(out, "", int2str(counter, 10, 0), bash_build, 0);
|
||||
fclose(out);
|
||||
out = start_script(counter, bash_build);
|
||||
counter += 1;
|
||||
} else if (directive->type == TYPE_UNINSTALL) {
|
||||
fputs("uninstall ", out);
|
||||
fputs(directive->arg, out);
|
||||
fputs("\n", out);
|
||||
}
|
||||
}
|
||||
fclose(out);
|
||||
}
|
||||
|
||||
void main(int argc, char **argv) {
|
||||
if (argc != 2) {
|
||||
fputs("Usage: script-generator <script>\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
FILE *in = fopen(argv[1], "r");
|
||||
if (in == NULL) {
|
||||
fputs("Error opening input file\n", stderr);
|
||||
exit(1);
|
||||
}
|
||||
Directive *directives = tokenizer(in);
|
||||
fclose(in);
|
||||
load_config();
|
||||
directives = interpreter(directives);
|
||||
generate(directives);
|
||||
FILE *config = fopen("/steps/bootstrap.cfg", "w");
|
||||
output_config(config);
|
||||
fclose(config);
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
1aa31b29ce0999b6a9cace93bc584020ec78059b9ad37d9aa3da9ad6c3d9af59 script-generator
|
|
@ -1 +0,0 @@
|
|||
dc6106dbc02839cdc9e3e2348432242eb6d33d840ab74badfd63c3c9997462b9 script-generator
|
|
@ -1,75 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
|
||||
# SPDX-FileCopyrightText: 2020-2022 fosslinux <fosslinux@aussies.space>
|
||||
# SPDX-FileCopyrightText: 2022 Dor Askayo <dor.askayo@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
set -ex
|
||||
|
||||
mkdir -p ${PREFIX} ${BINDIR} ${LIBDIR} ${INCDIR} ${SRCDIR} ${TMPDIR} /dev
|
||||
|
||||
# Temporarily change PATH
|
||||
PATH=/${ARCH_DIR}/bin
|
||||
|
||||
# Remove remaining dependencies on /bin (stage0-posix directory)
|
||||
cp /${ARCH_DIR}/bin/blood-elf ${BINDIR}/blood-elf
|
||||
cp /${ARCH_DIR}/bin/catm ${BINDIR}/catm
|
||||
cp /${ARCH_DIR}/bin/chmod ${BINDIR}/chmod
|
||||
cp /${ARCH_DIR}/bin/get_machine ${BINDIR}/get_machine
|
||||
cp /${ARCH_DIR}/bin/hex2 ${BINDIR}/hex2
|
||||
cp /${ARCH_DIR}/bin/kaem ${BINDIR}/kaem
|
||||
cp /${ARCH_DIR}/bin/match ${BINDIR}/match
|
||||
cp /${ARCH_DIR}/bin/M1 ${BINDIR}/M1
|
||||
cp /${ARCH_DIR}/bin/M2-Mesoplanet ${BINDIR}/M2-Mesoplanet
|
||||
cp /${ARCH_DIR}/bin/M2-Planet ${BINDIR}/M2-Planet
|
||||
cp /${ARCH_DIR}/bin/mkdir ${BINDIR}/mkdir
|
||||
cp /${ARCH_DIR}/bin/sha256sum ${BINDIR}/sha256sum
|
||||
cp /${ARCH_DIR}/bin/unbz2 ${BINDIR}/unbz2
|
||||
cp /${ARCH_DIR}/bin/ungz ${BINDIR}/ungz
|
||||
cp /${ARCH_DIR}/bin/untar ${BINDIR}/untar
|
||||
cp /${ARCH_DIR}/bin/unxz ${BINDIR}/unxz
|
||||
cp /${ARCH_DIR}/bin/cp ${BINDIR}/cp
|
||||
cp /${ARCH_DIR}/bin/replace ${BINDIR}/replace
|
||||
cp /${ARCH_DIR}/bin/rm ${BINDIR}/rm
|
||||
|
||||
chmod 755 ${BINDIR}/blood-elf
|
||||
chmod 755 ${BINDIR}/catm
|
||||
chmod 755 ${BINDIR}/chmod
|
||||
chmod 755 ${BINDIR}/cp
|
||||
chmod 755 ${BINDIR}/get_machine
|
||||
chmod 755 ${BINDIR}/hex2
|
||||
chmod 755 ${BINDIR}/kaem
|
||||
chmod 755 ${BINDIR}/match
|
||||
chmod 755 ${BINDIR}/M1
|
||||
chmod 755 ${BINDIR}/M2-Mesoplanet
|
||||
chmod 755 ${BINDIR}/M2-Planet
|
||||
chmod 755 ${BINDIR}/mkdir
|
||||
chmod 755 ${BINDIR}/sha256sum
|
||||
chmod 755 ${BINDIR}/unbz2
|
||||
chmod 755 ${BINDIR}/ungz
|
||||
chmod 755 ${BINDIR}/untar
|
||||
chmod 755 ${BINDIR}/unxz
|
||||
chmod 755 ${BINDIR}/replace
|
||||
chmod 755 ${BINDIR}/rm
|
||||
|
||||
PATH=${BINDIR}
|
||||
M2LIBC_PATH=/M2libc
|
||||
|
||||
# mes envars
|
||||
NYACC_PKG=nyacc-1.00.2
|
||||
MES_PKG=mes-0.26
|
||||
MES_PREFIX=${SRCDIR}/${MES_PKG}/build/${MES_PKG}
|
||||
GUILE_LOAD_PATH=${MES_PREFIX}/mes/module:${MES_PREFIX}/module:${SRCDIR}/${MES_PKG}/build/${NYACC_PKG}/module
|
||||
|
||||
M2-Mesoplanet --architecture ${ARCH} -f script-generator.c -o script-generator
|
||||
# Checksums
|
||||
if match x${UPDATE_CHECKSUMS} xTrue; then
|
||||
sha256sum -o script-generator.${ARCH}.checksums script-generator
|
||||
else
|
||||
sha256sum -c script-generator.${ARCH}.checksums
|
||||
fi
|
||||
./script-generator /steps/manifest
|
||||
kaem --file /steps/0.sh
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 779e5424d4b55fe9b7faea2285ae8b6486df0433
|
|
@ -9,11 +9,27 @@ for the bootstrapping process.
|
|||
|
||||
import argparse
|
||||
|
||||
from lib.generator import Generator
|
||||
from sysa import SysA
|
||||
from sysc import SysC
|
||||
|
||||
def main():
|
||||
"""Generate a source manifest for a system"""
|
||||
print('\n'.join(map(' '.join, Generator.get_source_manifest())))
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_argument("-s", "--system",
|
||||
help="Generate source manifest for the specified systems",
|
||||
choices=["sysa", "sysc"],
|
||||
nargs="+",
|
||||
action="extend",
|
||||
required=True)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if "sysa" in args.system:
|
||||
print(SysA.get_source_manifest())
|
||||
|
||||
if "sysc" in args.system:
|
||||
print(SysC.get_source_manifest())
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -1,128 +0,0 @@
|
|||
2dac610769286171ca81e736d729f5227938596cf44a0a8a764009715c55d23b autoconf-2.52_0.tar.bz2
|
||||
7345a49227ed69774e01097c514f1ebd3abaeed0b2b9136b7f5ee1b0fe573390 autoconf-2.53_0.tar.bz2
|
||||
22418f18b0dbf0476efb1823dcebdf70d7619113ca10076ba9b078ab3597a578 autoconf-2.54_0.tar.bz2
|
||||
8e74f93f12599f883ba62fe2bf4f69c70270ce368f71aa782f8f42a36a752d19 autoconf-2.55_0.tar.bz2
|
||||
1bd66ca8cc6300e192afe06cd90b1250f02ca64539a4f3e98a872333ec04f44b autoconf-2.57_0.tar.bz2
|
||||
83235c739887f0d801e410e922553a6fd7723cbd0c9b2e96106e20538abb3a3b autoconf-2.59_0.tar.bz2
|
||||
8912ae2a24ea40a7cd3ccab5e97dd109db7be4a86f40458ac836568aa7437b6a autoconf-2.61_0.tar.bz2
|
||||
d5fcce4baea5e11f983a7e4b7148545ab6720bb4e010898c73387f6711be67f4 autoconf-2.64_0.tar.bz2
|
||||
298dcf17a439adb306237b308e3c4ed3d376cb863ae0f0f08bfdf1f3199a548b autoconf-2.69_0.tar.bz2
|
||||
8c2401edf1c68910005bbcb8b8e84727a46f7d9643d2ad1267bd0259078dadc4 autoconf-2.71_0.tar.bz2
|
||||
6ff691e3ddd4f3d1796d28b07a2a96691dbd9801844c99ccbe660da59dabd74b autoconf-archive-2021.02.19_0.tar.bz2
|
||||
439fc68ab7d0a9a46caca2c7cbefbdb6ffe906f927e07d150e102bb76b393c37 autogen-5.18.16_0.tar.bz2
|
||||
02a426e82a52d4a2cd7e73fe3dc5a2c58b3ed100f24a92c57e42511fd86e247c automake-1.10.3_0.tar.bz2
|
||||
34925adeaa2876a5e068adeb17b71fe7c7105244c3cb5439d33f7406310674da automake-1.11.2_0.tar.bz2
|
||||
7e36e9e4b3957c95b6de8ff475c9b37aa007e2f9735b01c0eaf14b711fdd112f automake-1.15.1_0.tar.bz2
|
||||
57100612d902537b72ee2fd3dfecc903f2ea3959f1a480af87c6a1ef9a9d7c03 automake-1.16.3_0.tar.bz2
|
||||
1c7e09ac08f156960420fca1f6e8560c1855bf01b001a0648b56153d6ceb9c28 automake-1.6.3_0.tar.bz2
|
||||
444131776779d1f27628088a817bfb8c9aa85f4b036b934794a71e484ec9bd70 automake-1.6.3_1.tar.bz2
|
||||
e8ff13753943e43972a8cf1672819f001718ed38e5497cf7b554c21a507ba22b automake-1.7.8_0.tar.bz2
|
||||
ef08694bf8e78ffcf56f9c8a63b0f189e301c06f02ab240e15e4c7fe354c2a0d automake-1.7_0.tar.bz2
|
||||
9922651b64ad2e29b944082f26db223008220155048f25d64df1f6d82071ff1c automake-1.8.5_0.tar.bz2
|
||||
c5807850a377e4bb9aa4121d9781d145bdd80327626a9419630a75ce2c8d9c71 automake-1.9.6_0.tar.bz2
|
||||
f8a55bf656f950ee3c5cea48af03f552166f6db9926b78c78843f3cc52a6e22d bash-5.2.15_0.tar.bz2
|
||||
ebc631ee8e9382650005984ec5f3910492ccb6fb2656b4c0af0f4afc16998906 bc-1.07.1_0.tar.bz2
|
||||
90009c7a2232fce68ad628d6afe1f474d57874462b3ea2c50ab1a3e6c60a5a36 binutils-2.30_0.tar.bz2
|
||||
da658346866061324b92a6b734561257acfdb981783ad5794d67a0cd56e14e58 binutils-2.41_0.tar.bz2
|
||||
026447a32ab08a8a5150bab82a2f150af4a2ed90c47cfde631e1460eaed019aa binutils-2.41_1.tar.bz2
|
||||
f0bb18831983493b82fde53917e8d16c6a380761ac5e71e14769a82193fee788 bison-2.3_0.tar.bz2
|
||||
e4a3c9466d95c58bb072159da3473d71b40eb069b756acefba293588c4495a6f bison-3.4.1_0.tar.bz2
|
||||
fd3a3b855c3cbc42d719a0cbbae773d27e0e12b563641124ba2870b7103da1f8 bison-3.4.1_1.tar.bz2
|
||||
5232f6f8f3864b5827a015ce0414d484bb8aeb9f34ba66ceb7093da0a79561a8 bison-3.4.1_2.tar.bz2
|
||||
6d5e4debdec03aee096dbcefcad878fb5c6a069f895ee7ade878d9eeb97fb83e bison-3.4.2_0.tar.bz2
|
||||
727b0f28369b78f171dce4e227b05cea474dcb638c357387429c125f0d80fbc8 bzip2-1.0.8_0.tar.bz2
|
||||
543214998317d764595d3dd247a1fb2e0803ad77978b8474bd24d64c161b9530 ca-certificates-3.95_0.tar.bz2
|
||||
da3a3c7e0e6ce94ccb3d39885bc44207eb94c912b324a4c7669b5a752648b02d coreutils-5.0_0.tar.bz2
|
||||
56b84ab2035847524d595bb417c2b91c290174965550be321cd3d5d1f77aa2e5 coreutils-6.10_0.tar.bz2
|
||||
9fa31a4aeaa5132205efb796c8f546c94c1cfef6b5c27e64f6ebe06ca0360e67 coreutils-9.4_0.tar.bz2
|
||||
abd629e5675196c39dae00afbe23e2116bbd277be1d82214e2ec557a3b03994f curl-8.5.0_0.tar.bz2
|
||||
db8757b5fe77f56073caa034bfe9b3af6076d7299db966c4348e06f01a34415f curl-8.5.0_1.tar.bz2
|
||||
9534d834b018343b8335d0ef0b5faff3ee18e4ecbecf43a2a80deb972283f5d6 dhcpcd-10.0.1_0.tar.bz2
|
||||
e6372051f90c40d1f4a5cca2f8930187b363dfc916bcb973c72bca6c0aba3cd5 diffutils-2.7_0.tar.bz2
|
||||
41e3129b974391fe4ace69914fdef9b0fe72c6f5d87d495750fb89bdd999fa01 diffutils-3.10_0.tar.bz2
|
||||
bda6afcd3a390a34a57443269a4857ccc470129f7a557981778c145fd841cbd1 dist-3.5-236_0.tar.bz2
|
||||
26c0835a8b9be115082a2866e906363947528169c7274bd3b82752df77e99f11 e2fsprogs-1.45.7_0.tar.bz2
|
||||
9c6f7e156f299f1d0948537e28f00d40e727a3debae3cce158e9bce827136214 ed-1.4_0.tar.bz2
|
||||
0061d240f9bb2bb534db7003ddcc4eae9981954ad72e8f41ff1d76dc449ebd37 file-5.44_0.tar.bz2
|
||||
eec07e0d710ed3dd8d0ba6a1ec6ca9f1fa3a611bbb225195435679175317bf90 findutils-4.2.33_0.tar.bz2
|
||||
80798628ccb38521f42e1ca1abe4f0244e4b283e6f662cd354ab70e61a9b4675 flex-2.5.11_0.tar.bz2
|
||||
b3a8d59229289ca5a1de6a24c9c828d2847144f6662e0d5b7f41e7ff6e57abaa flex-2.5.33_0.tar.bz2
|
||||
e10060b55e2378a065cf8590cae17400c8befc6b3bb0cbbb7093f1b9f46ec4cc flex-2.6.4_0.tar.bz2
|
||||
5619cf9a893902491a9d8a8f8da4d39efb3606d7d0a72cb4aaa9d1ff798b5495 gawk-3.0.4_0.tar.bz2
|
||||
62e90abe883f6ccd679adf42d00c2c18a9809bbab599411c81b6c4ac4d446452 gawk-5.3.0_0.tar.bz2
|
||||
6de1c1380026ef9948387e665610185b6014f47a80453177a6c81898c95cbbd3 gc-8.0.4_0.tar.bz2
|
||||
c99d080cf17ac3f75cbae67095cb76220a92d96d877c92c896a7f05c9c94e92d gcc-10.4.0_0.tar.bz2
|
||||
e0c9e7f4f0cd0d5027f2a38eb262f883133c31ac9ec93ee6afa5abc028096bc0 gcc-13.1.0_0.tar.bz2
|
||||
27bb77077559b6c0f8dd7b8790ac48f70410ecc8816b5c493988ad5556da65e2 gcc-4.0.4_0.tar.bz2
|
||||
c1bf792e90df13bf7a24d3f8ce3939fd96ff61b8117e4dcef75605974f3fcf25 gcc-4.0.4_1.tar.bz2
|
||||
7ac087bf006188154c28401d0c875ede56076c19d41bc54ffa0d7cc18ce40800 gcc-4.7.4_0.tar.bz2
|
||||
dc67fc1b132fa3945349efe74c5b2197bd0b6babf4d29d2deddd04f09d9af680 gettext-0.21_0.tar.bz2
|
||||
309282ba840f80b5e10897b1221f3ff3329b9e05b982c788d03652f411974524 gmp-6.2.1_0.tar.bz2
|
||||
62edfa633f64202b2d29199d11d56a897654a441c7ae39a4d59ca5fe75199f61 gperf-3.1_0.tar.bz2
|
||||
c1989fc2855dbb0350c4e5b677028306614a9f4b5cb6c01fd459c5e1abf592b9 grep-2.4_0.tar.bz2
|
||||
8e612afb9a439aa8bf5db0fc2589eec890a6017690412d5c8e88a5838730b42c grep-3.7_0.tar.bz2
|
||||
ed16ffe92f50bca0dac71145adc07c08043837457dee46bb3a5f5d0a6dc99221 grub-2.06_0.tar.bz2
|
||||
e2a85aad6d51e52c9a30afeed058f95172fde1215f77243549274672990f6237 guile-3.0.9_0.tar.bz2
|
||||
6585ae3bc8149ec0e3fba766278fa30e2d7f0e7d1b9a9a4a457e0afa15b109c9 gzip-1.13_0.tar.bz2
|
||||
29a1603101cfbe2660e2d695f5b9c08dc9eefd8e3389405a6530c479e271821b heirloom-devtools-070527_0.tar.bz2
|
||||
8d2015b87337abbf287f7a39ee4cf53514120b5d3e90a93fe7d533dcc43f14fa help2man-1.36.4_0.tar.bz2
|
||||
ea5639dc6198c5f243362a1a7adfbea0cb779e085975712a1b410e82d7e0cf84 kbd-1.15_0.tar.bz2
|
||||
50a0f881161c68fe7c9ec6836b11a905b0d54e08e99b2476e8d1f5ac3212769e kexec-linux-1.0.0_0.tar.bz2
|
||||
fc784d2c46ffe91e7d54150022c9d2687140e90e3019c1d6799f875f22d99d2e kexec-tools-2.0.22_0.tar.bz2
|
||||
e4dcdabf540a9e51a555616abff8ec2fdee5bb40bb05ce702b5410239dd5d7d8 libarchive-3.5.2_0.tar.bz2
|
||||
36550df491767bb24d2ccab304ce70a3b4956e7c0c0e0c343d922fd57cdafbdd libatomic_ops-7.6.10_0.tar.bz2
|
||||
fea96776b929569b98bc1740a9977cf8c0eff1d999a08d766bcc0f40c7b1380c libbsd-0.11.8_0.tar.bz2
|
||||
b39826742e236890f3562cdf19492e7ef4224b271f3e75ddeab1f07982b03ebe libffi-3.3_0.tar.bz2
|
||||
0f6aefeb587b3d14d8ea73d7750f946a23d3e59a76a0ee5cdcdcc8132bccf73d libmd-1.1.0_0.tar.bz2
|
||||
daae709e98d2df2190d1d13b4e86f7f3fe90fa7a975282fe0bb03289b6539f29 libtool-2.2.4_0.tar.bz2
|
||||
6cefa575362149620f8008a32c8af54f0198a18bc6ab910bd3cead196c1507d7 libtool-2.4.7_0.tar.bz2
|
||||
503007bbcddcf4e49d26514c59b4c9501f8b42f0c994a59dfdc388b1ae6b7900 libunistring-0.9.10_0.tar.bz2
|
||||
5787f84a49e1d22560d0398e4f9075d6021017eb2a757697dc2877e7565d0199 linux-4.14.341-openela_0.tar.bz2
|
||||
c97644d0db5b3de127b048683afee6d31453441d97ba5dea71df5838b13542a4 linux-headers-4.14.341-openela_0.tar.bz2
|
||||
78b0cf6d9312e53c613186cbddd5f747310f375c1f322f33a6ac33682d2f3389 m4-1.4.19_0.tar.bz2
|
||||
0e3c21b0a1d8ca0c3f74a98ebe268809def62778ff4a486ff20c1d6e8247dc49 m4-1.4.7_0.tar.bz2
|
||||
e69554b0a77b419ddd5d0a0e418ba4005ecd0f6784c92a6928a0270bd929a098 make-3.82_0.tar.bz2
|
||||
6d24960d6a987f68a7e0e3abf6edb52d2e0fe4c86f6ba45327e9634dbf7d40b4 make-4.2.1_0.tar.bz2
|
||||
17cd976bc0f6e897c6fffe43dd7c55d93ce0adadf1b4dc72925b80e2d266519f mpc-1.2.1_0.tar.bz2
|
||||
98a9f55c01ed375fae21913284e7fa07ff434c0810f34d791f3fbaa1df221302 mpfr-4.1.0_0.tar.bz2
|
||||
40fc3497fa8cdd96ac338a10e78504c6dc942e7f4fa459550fb953d52bd53aa7 musl-1.1.24_0.tar.bz2
|
||||
20285055d84ac6106965a9d343ba8ebd19209f62782efb8ed863318c0b7d5e7d musl-1.1.24_1.tar.bz2
|
||||
d58d85c4be26d90f111f273929a4998d05294fe5aa37c4842d5aecaa593e6079 musl-1.1.24_2.tar.bz2
|
||||
81f79a0faf58e105c5f12d9f538d3ea7578a3b361e633ab8f47324ec23ec9de6 musl-1.2.4_0.tar.bz2
|
||||
6dc5e763b747b66f72692c6820d7f46b7f4cf2e2fe05229a1d01c03919c1c936 musl-1.2.4_1.tar.bz2
|
||||
820203286127e7c22cee9f1b3cff664431f10d14c3f22f00b3e771fd849fd449 musl-1.2.4_2.tar.bz2
|
||||
a18c4b2e5de2bfe5bb3ee9d360484fcfebad3df042f1859d4aa333dd60f55e56 opendoas-6.8.2_0.tar.bz2
|
||||
67b536b2f2a6c56e4673e462a3dbe2f42e8a4a5cb0b61b6bc1fdc14adea33f63 openssl-3.0.13_0.tar.bz2
|
||||
71864d042cdc564b65eab21360902c714e9b43f80a19689c5600589529b267e7 patch-2.7.6_0.tar.bz2
|
||||
287b0a8c0de14a2817e68ab023bfc502a0880d8c34386162351d5ffaf942da70 perl-5.000_0.tar.bz2
|
||||
9617799cdc9d4be39d31af54b9bcae47941d68416e9cc9c92cbc2ed08785dbc1 perl-5.003_0.tar.bz2
|
||||
74d64a8af080022432fa94dba449090419d25b103d247710dc0b6102a4ad86a6 perl-5.10.1_0.tar.bz2
|
||||
d381e910532061ac97e48ff09906bddbcb0956b37fc47d8c666f56a56b50c589 perl-5.32.1_0.tar.bz2
|
||||
d63d2fda752759778ae2d0dd08e6c023a81afbfc63ce11db860fc6858ae26c7f perl-5.6.2_0.tar.bz2
|
||||
c39ab70bce0bd09f013109ad7370085e90d77ef2b55abcfdc922d7832524c9cf perl5.004-05_0.tar.bz2
|
||||
2ac211ad3cf966dd89434c175970e10699c363b66228abc1642766aeafe2766a perl5.005-03_0.tar.bz2
|
||||
1b9d4260edf7b2241d10e4c4ad17d0f90047bd4bf42f2487a7133902529e9dfe pkg-config-0.29.2_0.tar.bz2
|
||||
2f7198009e4d021d52ee4ce86241b4936fb88349c20cc8b6c286261368878c3c python-2.0.1_0.tar.bz2
|
||||
b5d86ddc98cfbc684b03f1c84c786caaad810d5e4c7be38089f324eb3c276ad9 python-2.0.1_1.tar.bz2
|
||||
396577cdd0cc61d76420a1771c64156e49e8f9d00430c82feb88ad933b341632 python-2.3.7_0.tar.bz2
|
||||
2499cb7f10f292c3506fbf1b6a876195179ec98edfe7b8c357140137a1449492 python-2.3.7_1.tar.bz2
|
||||
80d8fcaf68c82238ddffb120b62fbc20d58bd9e2416cba080547a9f442e9e229 python-2.5.6_0.tar.bz2
|
||||
3508248f299b73c50e3607c4c294d40face05170476a5026b0821aed69025863 python-3.1.5_0.tar.bz2
|
||||
12b1ffc7ec98ba8f807160b93ba69a694d5395567c3bcac1e49e8f8d1d50de43 python-3.1.5_1.tar.bz2
|
||||
d6a7d3a109f63cd5ed4feaa772c33e272e570e216346ee90f6ca365d3a951615 python-3.11.1_0.tar.bz2
|
||||
60b93253a2078f849f81e7e1ed6233e30702f03b1893640eee95671d814f5514 python-3.3.7_0.tar.bz2
|
||||
da7c8ec579dd225c0d8bee63d95aeeb27ac2d5a60d4eefe298508cbf86bf506c python-3.4.10_0.tar.bz2
|
||||
af7a8334045fed8bd610b19194c0b46aa670070fc4738c34449ba5e93e49db8a python-3.8.16_0.tar.bz2
|
||||
c313520567176dd9bf61a271ee56e06a62e944e862f9dc4564d94b7fc884c8f9 sed-4.0.9_0.tar.bz2
|
||||
e8daec00b2c2de7b18efbec057dc9290eed06668806c6f5a48914d4a5cd95eb4 sed-4.8_0.tar.bz2
|
||||
ef2f2c791c1ae74f19c98ebcd7edae6ae28bc1d9367cc3a2cdb1ac302a156cb7 shadow-4.14.3_0.tar.bz2
|
||||
912d8f344104f1322255d6210c7c7e1371413ab530b2c6796e6aa565c74bf647 tar-1.34_0.tar.bz2
|
||||
60e98c09d9135b0150ed52b71cfbb072335741c0954a9b14bbba850c20564036 tcc-0.9.27_0.tar.bz2
|
||||
e2c9ea82a1ebf2d5d4c937fa837ddb6fc6835395cf03f3207df40c96b6cafcd8 tcc-0.9.27_1.tar.bz2
|
||||
4860223e6960ce976e6ad59aa90b69c18a1473684bce59ec8a8b36535405792b tcc-0.9.27_2.tar.bz2
|
||||
d4fe9460ca561fc2f546f9730f19f541b17dac0bcc42eb190abba856588c3593 tcc-0.9.27_3.tar.bz2
|
||||
50ebaa1d8fcc4a03a43d431eb71e2f435cc8712ae47d400564df3716037d553a texinfo-6.7_0.tar.bz2
|
||||
59bda6faaa95782154b917a6600cdf932e08cd6bf9388ba40d801baf18e5b454 util-linux-2.19.1_0.tar.bz2
|
||||
ecdb7ffeb9256f6a9760be70969fe5dea9cde6a538cc88595281fe44340e98a1 which-2.21_0.tar.bz2
|
||||
3fade2079cc91f2c5624ff7247220059caee82e7de493332103d7a78155400b2 xz-5.4.1_0.tar.bz2
|
||||
ca8ec9876a7334f5f87e1159e0efe343b8b497ffb0dea8b548223035ecd67f9e zlib-1.2.13_0.tar.bz2
|
|
@ -1 +0,0 @@
|
|||
https://mirrors.kernel.org/gnu/autoconf/autoconf-2.64.tar.xz 32d977213320b8ae76c71175305301197f2b0e04e72d70694bc3d3e2ae6c7248
|
|
@ -1 +0,0 @@
|
|||
https://mirrors.kernel.org/gnu/autoconf/autoconf-2.69.tar.xz 64ebcec9f8ac5b2487125a86a7760d2591ac9e1d3dbd59489633f9de62a57684
|
|
@ -1 +0,0 @@
|
|||
https://mirrors.kernel.org/gnu/automake/automake-1.15.1.tar.xz af6ba39142220687c500f79b4aa2f181d9b24e4f8d8ec497cea4ba26c64bedaf
|
|
@ -1 +0,0 @@
|
|||
467552a7875bae2086ba0fa9a8d2a253a158984e27b2e89acf2e3bcec539ad54 /usr/bin/bash
|
|
@ -1 +0,0 @@
|
|||
https://src.fedoraproject.org/repo/pkgs/bash/bash-2.05b.tar.bz2/f3e5428ed52a4f536f571a945d5de95d/bash-2.05b.tar.bz2 1ce4e5b47a6354531389f0adefb54dee2823227bf6e1e59a31c0e9317a330822
|
|
@ -1 +0,0 @@
|
|||
https://mirrors.kernel.org/slackware/slackware64-15.0/source/ap/bc/bc-1.07.1.tar.xz 95396f88fc719a1bf8bd463809119526fef44a42ab9eb708335c2cb79bc801c6
|
|
@ -1 +0,0 @@
|
|||
https://mirrors.kernel.org/gnu/binutils/binutils-2.30.tar.xz 6e46b8aeae2f727a36f0bd9505e405768a72218f1796f0d09757d45209871ae6
|
|
@ -1,26 +0,0 @@
|
|||
SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
Ensure functions.texi dependencies are satisfied.
|
||||
|
||||
--- libiberty/Makefile.in 2023-12-08 15:18:57.985791235 +1100
|
||||
+++ libiberty/Makefile.in 2023-12-08 15:19:15.391252344 +1100
|
||||
@@ -368,12 +368,12 @@
|
||||
libiberty.html : $(srcdir)/libiberty.texi $(TEXISRC)
|
||||
$(MAKEINFO) --no-split --html -I$(srcdir) -o $@ $<
|
||||
|
||||
-@MAINT@$(srcdir)/functions.texi : stamp-functions
|
||||
-@MAINT@ @true
|
||||
+$(srcdir)/functions.texi : stamp-functions
|
||||
+ @true
|
||||
|
||||
-@MAINT@stamp-functions : $(CFILES:%=$(srcdir)/%) $(TEXIFILES:%=$(srcdir)/%) $(srcdir)/gather-docs Makefile
|
||||
-@MAINT@@HAVE_PERL@ $(PERL) $(srcdir)/gather-docs $(srcdir) $(srcdir)/functions.texi $(CFILES) $(TEXIFILES)
|
||||
-@MAINT@ echo stamp > stamp-functions
|
||||
+stamp-functions : $(CFILES:%=$(srcdir)/%) $(TEXIFILES:%=$(srcdir)/%) $(srcdir)/gather-docs Makefile
|
||||
+@HAVE_PERL@ $(PERL) $(srcdir)/gather-docs $(srcdir) $(srcdir)/functions.texi $(CFILES) $(TEXIFILES)
|
||||
+ echo stamp > stamp-functions
|
||||
|
||||
INSTALL_DEST = @INSTALL_DEST@
|
||||
install: install_to_$(INSTALL_DEST) install-subdir
|
|
@ -1,18 +0,0 @@
|
|||
SPDX-FileCopyrightText: 2022 Dor Askayo <dor.askayo@gmail.com>
|
||||
SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
Ensure i386-tbl.h dependencies are satisfied.
|
||||
|
||||
--- opcodes/Makefile.am 2023-12-08 17:13:05.669136957 +1100
|
||||
+++ opcodes/Makefile.am 2023-12-08 17:13:18.410480026 +1100
|
||||
@@ -540,7 +540,7 @@
|
||||
# i386-gen will generate all headers in one go. Use a pattern rule to properly
|
||||
# express this, with the inner dash ('-') arbitrarily chosen to be the stem.
|
||||
$(srcdir)/i386%tbl.h $(srcdir)/i386%init.h $(srcdir)/i386%mnem.h: \
|
||||
- @MAINT@ i386-gen$(EXEEXT_FOR_BUILD) i386-opc.tbl i386-reg.tbl i386-opc.h
|
||||
+ i386-gen$(EXEEXT_FOR_BUILD) i386-opc.tbl i386-reg.tbl i386-opc.h
|
||||
$(AM_V_GEN)$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) - \
|
||||
< $(srcdir)/i386-opc.tbl \
|
||||
| ./i386-gen$(EXEEXT_FOR_BUILD) --srcdir $(srcdir)
|
|
@ -1 +0,0 @@
|
|||
https://mirrors.kernel.org/gnu/binutils/binutils-2.41.tar.xz ae9a5789e23459e59606e6714723f2d3ffc31c03174191ef0d015bdf06007450
|
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
|||
https://mirrors.kernel.org/gnu/bison/bison-3.4.1.tar.xz 27159ac5ebf736dffd5636fd2cd625767c9e437de65baa63cb0de83570bd820d
|
|
@ -1 +0,0 @@
|
|||
5a478142a517173180b2030cdd87b5f0f0c077e4b4a152c4b72141febf4d5905 /usr/bin/yacc
|
|
@ -1,98 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2002-2022 Thomas E. Dickey
|
||||
# SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
#
|
||||
# From original byacc README:
|
||||
# Berkeley Yacc is in the public domain. The data structures and algorithms
|
||||
# used in Berkeley Yacc are all either taken from documents available to the
|
||||
# general public or are inventions of the author. Anyone may freely distribute
|
||||
# source or binary forms of Berkeley Yacc whether unchanged or modified.
|
||||
# Distributers may charge whatever fees they can obtain for Berkeley Yacc.
|
||||
# Programs generated by Berkeley Yacc may be distributed freely.
|
||||
#
|
||||
# (typo "Distributers" in original)
|
||||
|
||||
DEST = .
|
||||
|
||||
HDRS = defs.h
|
||||
|
||||
CFLAGS ?= -O -DNDEBUG
|
||||
|
||||
LDFLAGS ?=
|
||||
|
||||
LIBS ?=
|
||||
|
||||
LINKER ?= $(CC)
|
||||
|
||||
MAKEFILE = Makefile
|
||||
|
||||
OBJS = closure.o \
|
||||
error.o graph.o \
|
||||
lalr.o \
|
||||
lr0.o \
|
||||
main.o \
|
||||
mkpar.o mstring.o \
|
||||
output.o \
|
||||
reader.o \
|
||||
symtab.o \
|
||||
verbose.o \
|
||||
warshall.o yaccpar.o
|
||||
|
||||
PRINT = pr -f -l88
|
||||
|
||||
PROGRAM = yacc
|
||||
|
||||
SRCS = closure.c \
|
||||
error.c graph.c \
|
||||
lalr.c \
|
||||
lr0.c \
|
||||
main.c \
|
||||
mkpar.c mstring.c \
|
||||
output.c \
|
||||
reader.c \
|
||||
symtab.c \
|
||||
verbose.c \
|
||||
warshall.c yaccpar.c
|
||||
|
||||
all: $(PROGRAM)
|
||||
|
||||
$(PROGRAM): $(OBJS) $(LIBS)
|
||||
@$(LINKER) $(LDFLAGS) -o $(PROGRAM) $(OBJS) $(LIBS)
|
||||
|
||||
clean:; @rm -f $(OBJS)
|
||||
|
||||
clobber:; @rm -f $(OBJS) $(PROGRAM)
|
||||
|
||||
depend:; @mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) DEST=$(DEST)
|
||||
|
||||
index:; @ctags -wx $(HDRS) $(SRCS)
|
||||
|
||||
install: $(PROGRAM)
|
||||
@echo Installing $(PROGRAM) in $(DEST)
|
||||
@install -s $(PROGRAM) $(DEST)
|
||||
|
||||
listing:; @$(PRINT) Makefile $(HDRS) $(SRCS) | lpr
|
||||
|
||||
lint:; @lint $(SRCS)
|
||||
|
||||
program: $(PROGRAM)
|
||||
|
||||
tags: $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS)
|
||||
|
||||
###
|
||||
closure.o: defs.h
|
||||
error.o: defs.h
|
||||
lalr.o: defs.h
|
||||
lr0.o: defs.h
|
||||
main.o: defs.h
|
||||
mkpar.o: defs.h
|
||||
output.o: defs.h
|
||||
reader.o: defs.h
|
||||
symtab.o: defs.h
|
||||
verbose.o: defs.h
|
||||
warshall.o: defs.h
|
||||
btyaccpar.o: defs.h
|
||||
yaccpar.o: defs.h
|
||||
graph.o: defs.h
|
||||
mstring.o: defs.h
|
|
@ -1,45 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
# SPDX-FileCopyrightText: 2021-22 fosslinux <fosslinux@aussies.space>
|
||||
# SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
set -ex
|
||||
|
||||
# Check tarball checksums
|
||||
checksum-transcriber sources
|
||||
sha256sum -c sources.SHA256SUM
|
||||
|
||||
mkdir build src
|
||||
cd build
|
||||
|
||||
# Extract
|
||||
cp ${DISTFILES}/${pkg}.tgz ../src/${pkg}.tar.gz
|
||||
gunzip -f ../src/${pkg}.tar.gz
|
||||
tar xf ../src/${pkg}.tar
|
||||
rm -r ../src/
|
||||
cd ${pkg}
|
||||
|
||||
# Prepare and patch
|
||||
cp ../../files/Makefile .
|
||||
patch -Np0 -i ../../patches/meslibc.patch
|
||||
|
||||
# Build yacc
|
||||
make CC=tcc AR=tcc\ -ar CFLAGS=-DMAXPATHLEN=100\ -DEILSEQ=84\ -DMB_LEN_MAX=100 LDFLAGS=-lgetopt\ -static RANLIB=true
|
||||
|
||||
# Install yacc
|
||||
install yacc ${BINDIR}/yacc
|
||||
|
||||
cd ../..
|
||||
|
||||
# Checksums
|
||||
if match x${UPDATE_CHECKSUMS} xTrue; then
|
||||
sha256sum -o ${pkg}.checksums \
|
||||
/usr/bin/yacc
|
||||
|
||||
install ${pkg}.checksums ${SRCDIR}
|
||||
else
|
||||
sha256sum -c ${pkg}.checksums
|
||||
fi
|
|
@ -1,170 +0,0 @@
|
|||
SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
Remove usages of tmpfile(), rewind(), fgetpos(), fsetpos() and bsearch(),
|
||||
which are unsupported by meslibc, and add missing declaration for strdup.
|
||||
|
||||
License note: Berkeley Yacc is in the public domain, but it's linked with
|
||||
meslibc, which is GPL-3.0-or-later, so we apply that license here too.
|
||||
|
||||
diff -ru ../byacc-20240109.bak/main.c ./main.c
|
||||
--- ../byacc-20240109.bak/main.c 2024-04-14 16:06:09.646465507 +0200
|
||||
+++ ./main.c 2024-04-14 20:41:56.227083399 +0200
|
||||
@@ -788,7 +788,7 @@
|
||||
(void)umask(save_umask);
|
||||
}
|
||||
#else
|
||||
- result = tmpfile();
|
||||
+ result = fopen(label, "w+");
|
||||
#endif
|
||||
|
||||
if (result == 0)
|
||||
diff -ru ../byacc-20240109.bak/output.c ./output.c
|
||||
--- ../byacc-20240109.bak/output.c 2024-04-14 16:06:09.646465507 +0200
|
||||
+++ ./output.c 2024-04-14 16:06:24.636465897 +0200
|
||||
@@ -1289,7 +1289,7 @@
|
||||
{
|
||||
if (union_file != 0)
|
||||
{
|
||||
- rewind(union_file);
|
||||
+ fseek(union_file, 0, SEEK_SET);
|
||||
while ((c = getc(union_file)) != EOF)
|
||||
putc_code(fp, c);
|
||||
}
|
||||
@@ -1314,7 +1314,7 @@
|
||||
|
||||
if (text_file == NULL)
|
||||
open_error("text_file");
|
||||
- rewind(text_file);
|
||||
+ fseek(text_file, 0, SEEK_SET);
|
||||
in = text_file;
|
||||
if ((c = getc(in)) == EOF)
|
||||
return;
|
||||
@@ -1684,7 +1684,7 @@
|
||||
int state;
|
||||
char line_state[20];
|
||||
|
||||
- rewind(action_file);
|
||||
+ fseek(action_file, 0, SEEK_SET);
|
||||
if ((c = getc(action_file)) == EOF)
|
||||
return;
|
||||
|
||||
diff -ru ../byacc-20240109.bak/reader.c ./reader.c
|
||||
--- ../byacc-20240109.bak/reader.c 2024-04-14 16:06:09.646465507 +0200
|
||||
+++ ./reader.c 2024-04-14 20:40:58.387082748 +0200
|
||||
@@ -70,7 +70,7 @@
|
||||
char *line_data; /* saved input-line */
|
||||
size_t line_used; /* position within saved input-line */
|
||||
size_t line_size; /* length of saved input-line */
|
||||
- fpos_t line_fpos; /* pointer before reading past saved input-line */
|
||||
+ long line_fpos; /* pointer before reading past saved input-line */
|
||||
}
|
||||
SAVE_LINE;
|
||||
|
||||
@@ -315,7 +315,7 @@
|
||||
line = save_area.line_data;
|
||||
cptr = save_area.line_used + line;
|
||||
linesize = save_area.line_size;
|
||||
- if (fsetpos(input_file, &save_area.line_fpos) != 0)
|
||||
+ if (fseek(input_file, save_area.line_fpos, SEEK_SET) != 0)
|
||||
on_error();
|
||||
memset(&save_area, 0, sizeof(save_area));
|
||||
}
|
||||
@@ -338,7 +338,7 @@
|
||||
save_area.line_size = linesize;
|
||||
NO_SPACE(save_area.line_data);
|
||||
memcpy(save_area.line_data, line, linesize);
|
||||
- if (fgetpos(f, &save_area.line_fpos) != 0)
|
||||
+ if ((save_area.line_fpos = ftell(f)) == -1)
|
||||
on_error();
|
||||
must_save = -must_save;
|
||||
}
|
||||
@@ -572,6 +572,36 @@
|
||||
return strcmp(p->name, q->name);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Compare keyword to cached token, treating '_' and '-' the same. Some
|
||||
+ * grammars rely upon this misfeature.
|
||||
+ */
|
||||
+static int
|
||||
+matchec(const char *name)
|
||||
+{
|
||||
+ const char *p = cache;
|
||||
+ const char *q = name;
|
||||
+ int code = 0; /* assume mismatch */
|
||||
+
|
||||
+ while (*p != '\0' && *q != '\0')
|
||||
+ {
|
||||
+ char a = *p++;
|
||||
+ char b = *q++;
|
||||
+ if (a == '_')
|
||||
+ a = '-';
|
||||
+ if (b == '_')
|
||||
+ b = '-';
|
||||
+ if (a != b)
|
||||
+ break;
|
||||
+ if (*p == '\0' && *q == '\0')
|
||||
+ {
|
||||
+ code = 1;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ return code;
|
||||
+}
|
||||
+
|
||||
static int
|
||||
keyword(void)
|
||||
{
|
||||
@@ -612,10 +642,36 @@
|
||||
}
|
||||
cachec(NUL);
|
||||
|
||||
- if ((key = bsearch(cache, keywords,
|
||||
- sizeof(keywords) / sizeof(*key),
|
||||
- sizeof(*key), compare_keys)))
|
||||
- return key->token;
|
||||
+ if (matchec("token") || matchec("term"))
|
||||
+ return (TOKEN);
|
||||
+ if (matchec("type"))
|
||||
+ return (TYPE);
|
||||
+ if (matchec("left"))
|
||||
+ return (LEFT);
|
||||
+ if (matchec("right"))
|
||||
+ return (RIGHT);
|
||||
+ if (matchec("nonassoc") || matchec("binary"))
|
||||
+ return (NONASSOC);
|
||||
+ if (matchec("start"))
|
||||
+ return (START);
|
||||
+ if (matchec("union"))
|
||||
+ return (UNION);
|
||||
+ if (matchec("ident"))
|
||||
+ return (IDENT);
|
||||
+ if (matchec("expect"))
|
||||
+ return (EXPECT);
|
||||
+ if (matchec("expect-rr"))
|
||||
+ return (EXPECT_RR);
|
||||
+ if (matchec("pure-parser"))
|
||||
+ return (PURE_PARSER);
|
||||
+ if (matchec("parse-param"))
|
||||
+ return (PARSE_PARAM);
|
||||
+ if (matchec("lex-param"))
|
||||
+ return (LEX_PARAM);
|
||||
+ if (matchec("token-table"))
|
||||
+ return (TOKEN_TABLE);
|
||||
+ if (matchec("yacc"))
|
||||
+ return (POSIX_YACC);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1178,6 +1234,9 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
+char *
|
||||
+strdup (char const *s);
|
||||
+
|
||||
static void
|
||||
save_param(int k, char *buffer, int name, int type2)
|
||||
{
|
|
@ -1 +0,0 @@
|
|||
https://invisible-island.net/archives/byacc/byacc-20240109.tgz f2897779017189f1a94757705ef6f6e15dc9208ef079eea7f28abec577e08446
|
|
@ -1 +0,0 @@
|
|||
103af2b8cb00efe5ea91266978db548a69cee5883aa6263e1f1b960448065580 /usr/bin/bzip2
|
|
@ -1 +0,0 @@
|
|||
https://mirrors.kernel.org/slackware/slackware-14.0/patches/source/bzip2/bzip2-1.0.8.tar.xz 47fd74b2ff83effad0ddf62074e6fad1f6b4a77a96e121ab421c20a216371a1f
|
|
@ -1 +0,0 @@
|
|||
http://ftp.mozilla.org/pub/security/nss/releases/NSS_3_95_RTM/src/nss-3.95.tar.gz 469888e41e8a780051ce00edcd914e8a6bd38da88a82cfb84898dd388635822a
|
|
@ -1 +0,0 @@
|
|||
74656fa0cdd15992f7eee5797ecc33d7e65eb0e41acd3c6636cae45e5d3ce35d /usr/bin/checksum-transcriber
|
|
@ -1 +0,0 @@
|
|||
394b4651da547ae43b5de818a4bb9843f3872b2dbc022adf3711c991371d4398 /usr/bin/checksum-transcriber
|
|
@ -1 +0,0 @@
|
|||
19fd50d727e8a7feba8b6e369e68287d1922d8f623a156fb113d994891e96998 /usr/bin/checksum-transcriber
|
|
@ -1,20 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
set -ex
|
||||
|
||||
# Build & install
|
||||
M2-Mesoplanet --architecture ${ARCH} -f src/checksum-transcriber.c -o ${BINDIR}/checksum-transcriber
|
||||
|
||||
# Checksums
|
||||
if match x${UPDATE_CHECKSUMS} xTrue; then
|
||||
sha256sum -o ${pkg}.${ARCH}.checksums \
|
||||
/usr/bin/checksum-transcriber
|
||||
|
||||
cp ${pkg}.${ARCH}.checksums ${SRCDIR}
|
||||
else
|
||||
sha256sum -c ${pkg}.${ARCH}.checksums
|
||||
fi
|
|
@ -1,61 +0,0 @@
|
|||
523b51bf51c379c1dfa2d04b69863c02c31f31d54638a03a399bac71c498e302 /usr/bin/install
|
||||
0b802f4c74c8a2640c84f7a87f010bccdc9858dc9b2ba438c6d3cc3894c3892a /usr/bin/basename
|
||||
42a8ccb469ffd7e098626c2bd40d7933904a7d152b6b4aaa83512a7d43c8c026 /usr/bin/cat
|
||||
0dc7228a05afd6956fec228358e38901e9176c8a01307547364f7f3d7df1ae85 /usr/bin/chmod
|
||||
99d8f566fe26bf0997b32294cf301b8ac90796b79e7fe274bee19b8e5f4a2f2d /usr/bin/cksum
|
||||
0a0b5e17e778a50637ae0f496232f742ae3748f137b4abaf78639c4278db5fe9 /usr/bin/cp
|
||||
44d2c5e2d430998efb6260337a780cb730818be82fc1272da50e1dab2fcfb6a1 /usr/bin/csplit
|
||||
c985d78e11c8a6140569068fcdb8473aaf81dee6a5d5e412bd47f9ae14c0aa8e /usr/bin/cut
|
||||
7725e05029dd5537c673ca9f8662a70044202f5cce6267c6bbfa8b1bddb9a3e3 /usr/bin/dirname
|
||||
95a6849907b9baf30168589ba2cfba2e08e760e2624962d8b5abf11f20662dd4 /usr/bin/echo
|
||||
948341073b85442d6c00bef62360e810219189f2e0ae06b15bf512c9ad5586f6 /usr/bin/expand
|
||||
ee13822dd21e78374d46671d38375ae8db1126e75c0dbe19bd63f92702ead9ca /usr/bin/expr
|
||||
6918fd8d5f8a3f80c4f1bbd534c5115033927deb9ba816e12fca45d19eec1bcc /usr/bin/factor
|
||||
d3c5662d77ad197191b53b88e0ffed4e1659084f41b18736a8deaf16755c17ab /usr/bin/false
|
||||
83509ff0c83016065ad02086f255620c84ac12d668f7f0ab1b1463b621cd2467 /usr/bin/fmt
|
||||
7649cb10eb246de6035e5d7db5c900ecaef8d83677452d1f084001962fdd251f /usr/bin/fold
|
||||
8e26e4f22735c21109b4969ff6e4c8e52cb623198c708c91fc323f9a78d8a9f8 /usr/bin/head
|
||||
dfa93d89a269ab8bc1a31ac27ae58ca4b57e9e80016c14bdb32560a11b5d2781 /usr/bin/hostname
|
||||
a85003482887e354b121b2467244b9d8b289d484e888b95e4eac017356a50ca1 /usr/bin/id
|
||||
a16d179a6252510cc3d7184a3afe03d67a2697f0958c65fc588cdc20540da0ba /usr/bin/join
|
||||
fa575a974614812d656a739bd7971726c5ef37d9b659302caada5fb98c2d9bd2 /usr/bin/kill
|
||||
60132054c00316ef9010664b90daeb3aed3edc7daa3492164aaf9cd6dda47385 /usr/bin/link
|
||||
1422bd7e979aaa6fdb6b885f8befc95537207a6668df2d98f2f3e8b2997e754b /usr/bin/ln
|
||||
b273ec1b70d14ad732b3843e66b80cc9995d0f064159c7fee06cea50b867414b /usr/bin/logname
|
||||
dc1fb1d37393741dc72ec83c9ae52498ef0994cb9543c50f94e239f9cf80b30b /usr/bin/mkfifo
|
||||
5eac78966fb4dbc976c834677eaf3162ed5eb4cfadc7e09693f1d982e9fe855b /usr/bin/mkdir
|
||||
172edf9d1a9766eed0d836355c0e5f39e941ca0f3db1ee9a2a03a0ea63fa22d5 /usr/bin/mknod
|
||||
9c9892aa721dc5dd7661c039d015d74525d071ee065df0bc1f6aa06ef0c50fce /usr/bin/nl
|
||||
2a035b319845e589315a853b50818666c3d1198806430acdb9d5839471812b1f /usr/bin/od
|
||||
02e8bd0034632d192d562ac6e7a65e1d5d58bdf704879de26dd02a74b4a0d645 /usr/bin/paste
|
||||
7fcedafbe585d81fb1968c3cf8b3551817f1cdd98461896d1206f954f2d6a1e2 /usr/bin/pathchk
|
||||
19038aeda999dd42316e08243c55b3d515150fbe11c811bb47f556face7add7f /usr/bin/pr
|
||||
b990dc4321203613e56b0dabd8f8984dcbd8adc6e72f5e9265376a1911a08cad /usr/bin/printf
|
||||
f32aaf380592c7ff14bd71515083c75d35d8fa396d600f75ce99be347ee6f387 /usr/bin/ptx
|
||||
05dbc4ad66caace6dad054bc21ca98c261ef1cdcbd25431e4c82198eda2c12b2 /usr/bin/pwd
|
||||
56ba3841290c6f5977bb44887b672bee3b97f571c845ea31e2d17f926662ffc5 /usr/bin/readlink
|
||||
e9a9e3cf2c2908659a03b63b9fa4963d52c7fdf69d699c359855467a19df4756 /usr/bin/rmdir
|
||||
e30b629fa1fcf35a5f46f5cfd1b1602aa5c7ca184a1ff343452349333b778a6c /usr/bin/seq
|
||||
c30b559c2efb15b90865600f203f1ea75aa50e728f7dfd4d2a0eaf1aa8ff3924 /usr/bin/sleep
|
||||
53e4e2c96092489cb2b9e6883e66164c12a228de0420389dd63cad506948487f /usr/bin/sort
|
||||
b1a1344aaee44f1bf04430b0c0a4a6148af69128160f2bc093fce91d79d6e25f /usr/bin/split
|
||||
e5de0b1782231a9ce0b0bbcc7c818a39517e419273fe56faddc628b7c0a0e5a6 /usr/bin/sum
|
||||
df19f0df1b4198e02261b478266ce642c62450114c818c8812249cb1eac473e6 /usr/bin/tail
|
||||
0b6726576538145c62a7c33994574ff3d2470ed475d612076caf7049a6eb8f7c /usr/bin/tee
|
||||
311ce27575937ff583e67ee98cd8a64ef6d8a103666de773a0f61c7ba1537cf9 /usr/bin/tr
|
||||
b4285c93f16b2f1521c2729c20df7176408d27c32a055676fadc34c009b956ba /usr/bin/tsort
|
||||
5958c475dcee08b42516bf0aeec420e19ea592d56d1781692d2481e273999762 /usr/bin/unexpand
|
||||
08a550c90975a232311cd2f41c8fabb06e3b32b4c6aa362a35ca038189712f67 /usr/bin/uniq
|
||||
d33508270e1f86fc959d6abb12ae03ac6643f0138395e1b67586539d5c3dd38b /usr/bin/unlink
|
||||
7e7526b6970838c620fbcccf8ce295a5d901aa03186da4036d1938ee907d1d46 /usr/bin/wc
|
||||
ef0041e5daf3b96d6656068c9bc27cde52c11f10177ede1ee7ecc0d1fc09c061 /usr/bin/whoami
|
||||
794107d42c946b844c84575f80b7fc2ac35bc197555d36ecefd9471a4ce8943e /usr/bin/tac
|
||||
61624e0509eded80e4539890d33908e8f9b92da3f53685810da6bfa5f749c141 /usr/bin/test
|
||||
cc16741fbadaeee5ef9427ac96f762c6e7d21ed8b80a625afde5b375443896b3 /usr/bin/touch
|
||||
3f94bca6093256356dd09d896aa657c2f7aa26b6b337cbde19d59e1bb6ca2e34 /usr/bin/true
|
||||
6256e12f10ab5e9e199db96fec51809591445d3135cea446e788523c47989504 /usr/bin/yes
|
||||
f10746a6226e699da42a1a2a4e1a99d36fd7d9d6211a100a8bf0a98b3585321e /usr/bin/ls
|
||||
e604f08d122e88c1a112c32b59b870f8b0c9000e4821684bc41d0a50d6338214 /usr/bin/md5sum
|
||||
32aa8dc8b78a0807cdf3867725a529f56b8e0701f2fcd3dc93c5e19e0c8b4f9f /usr/bin/mv
|
||||
4dcfebaed9312e084e9927ce1bb89ec4a928d668816c8f5f1efd6acaf54d8bbd /usr/bin/rm
|
||||
e4c326abc31fac0c5bd77d5c2f6bafee9b9a97e6cfb603f55eb6c722bb41e875 /usr/bin/sha1sum
|
|
@ -1,26 +0,0 @@
|
|||
SPDX-FileCopyrightText: 2023 Emily Trau <emily@downunderctf.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
strcoll() does not exist in mes libc, change it to strcmp.
|
||||
|
||||
--- src/expr.c
|
||||
+++ src/expr.c
|
||||
@@ -332,7 +332,7 @@ nextarg (char *str)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
- int r = strcoll (*args, str) == 0;
|
||||
+ int r = strcmp (*args, str) == 0;
|
||||
args += r;
|
||||
return r;
|
||||
}
|
||||
@@ -668,7 +668,7 @@ eval2 (void)
|
||||
r = eval3 ();
|
||||
tostring (l);
|
||||
tostring (r);
|
||||
- lval = strcoll (l->u.s, r->u.s);
|
||||
+ lval = strcmp (l->u.s, r->u.s);
|
||||
rval = 0;
|
||||
if (toarith (l) && toarith (r))
|
||||
{
|
|
@ -1,37 +0,0 @@
|
|||
SPDX-FileCopyrightText: 2023 Emily Trau <emily@downunderctf.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
strcoll() does not exist in mes libc, change it to strcmp.
|
||||
hard_LC_COLLATE is used but not declared when HAVE_SETLOCALE is unset.
|
||||
|
||||
--- lib/memcoll.c
|
||||
+++ lib/memcoll.c
|
||||
@@ -47,7 +47,7 @@ memcoll (char *s1, size_t s1len, char *s2, size_t s2len)
|
||||
s1[s1len++] = '\0';
|
||||
s2[s2len++] = '\0';
|
||||
|
||||
- while (! (errno = 0, (diff = strcoll (s1, s2)) || errno))
|
||||
+ while (! (errno = 0, (diff = strcmp (s1, s2)) || errno))
|
||||
{
|
||||
/* strcoll found no difference, but perhaps it was fooled by NUL
|
||||
characters in the data. Work around this problem by advancing
|
||||
|
||||
--- src/sort.c
|
||||
+++ src/sort.c
|
||||
@@ -91,13 +91,13 @@ double strtod ();
|
||||
#define NEGATION_SIGN '-'
|
||||
#define NUMERIC_ZERO '0'
|
||||
|
||||
+/* Nonzero if the corresponding locales are hard. */
|
||||
+static int hard_LC_COLLATE;
|
||||
#if HAVE_SETLOCALE
|
||||
|
||||
static char decimal_point;
|
||||
static int th_sep; /* if CHAR_MAX + 1, then there is no thousands separator */
|
||||
|
||||
-/* Nonzero if the corresponding locales are hard. */
|
||||
-static int hard_LC_COLLATE;
|
||||
# if HAVE_NL_LANGINFO
|
||||
static int hard_LC_TIME;
|
||||
# endif
|
|
@ -1,68 +0,0 @@
|
|||
SPDX-FileCopyrightText: 2005 Paul Eggert <eggert@cs.ucla.edu>
|
||||
SPDX-FileCopyrightText: 2023 Emily Trau <emily@downunderctf.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
uniq: don't assume fopen cannot return stdin or stdout.
|
||||
Backport of https://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=786ebb2ceca72f69aa2de701671fb41f53cb1489
|
||||
|
||||
--- src/uniq.c
|
||||
+++ src/uniq.c
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "error.h"
|
||||
#include "hard-locale.h"
|
||||
#include "posixver.h"
|
||||
+#include "stdio-safer.h"
|
||||
#include "xmemcoll.h"
|
||||
#include "xstrtol.h"
|
||||
#include "memcasecmp.h"
|
||||
@@ -267,20 +268,26 @@ check_file (const char *infile, const char *outfile)
|
||||
FILE *ostream;
|
||||
struct linebuffer lb1, lb2;
|
||||
struct linebuffer *thisline, *prevline;
|
||||
+ bool is_stdin = STREQ (infile, "-");
|
||||
+ bool is_stdout = STREQ (outfile, "-");
|
||||
|
||||
- if (STREQ (infile, "-"))
|
||||
+ if (is_stdin)
|
||||
istream = stdin;
|
||||
else
|
||||
- istream = fopen (infile, "r");
|
||||
- if (istream == NULL)
|
||||
- error (EXIT_FAILURE, errno, "%s", infile);
|
||||
+ {
|
||||
+ istream = fopen_safer (infile, "r");
|
||||
+ if (! istream)
|
||||
+ error (EXIT_FAILURE, errno, "%s", infile);
|
||||
+ }
|
||||
|
||||
- if (STREQ (outfile, "-"))
|
||||
+ if (is_stdout)
|
||||
ostream = stdout;
|
||||
else
|
||||
- ostream = fopen (outfile, "w");
|
||||
- if (ostream == NULL)
|
||||
- error (EXIT_FAILURE, errno, "%s", outfile);
|
||||
+ {
|
||||
+ ostream = fopen_safer (outfile, "w");
|
||||
+ if (! ostream)
|
||||
+ error (EXIT_FAILURE, errno, "%s", outfile);
|
||||
+ }
|
||||
|
||||
thisline = &lb1;
|
||||
prevline = &lb2;
|
||||
@@ -377,12 +384,12 @@ check_file (const char *infile, const char *outfile)
|
||||
}
|
||||
|
||||
closefiles:
|
||||
- if (ferror (istream) || fclose (istream) == EOF)
|
||||
+ if (!is_stdin && (ferror (istream) || fclose (istream) != 0))
|
||||
error (EXIT_FAILURE, errno, _("error reading %s"), infile);
|
||||
|
||||
/* Close ostream only if it's not stdout -- the latter is closed
|
||||
via the atexit-invoked close_stdout. */
|
||||
- if (ostream != stdout && (ferror (ostream) || fclose (ostream) == EOF))
|
||||
+ if (!is_stdout && (ferror (ostream) || fclose (ostream) != 0))
|
||||
error (EXIT_FAILURE, errno, _("error writing %s"), outfile);
|
||||
|
||||
free (lb1.buffer);
|
|
@ -1 +0,0 @@
|
|||
https://mirrors.kernel.org/gnu/coreutils/coreutils-6.10.tar.lzma 8b05bba1b2726a164e444c314e3f359604b58216be704bed8f2e028449cc6204
|
|
@ -1,327 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# SPDX-FileCopyrightText: 2021 Melg Eight <public.melg8@gmail.com>
|
||||
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Regenerate unicode files
|
||||
pushd ../gnulib-bb5bb43/lib
|
||||
gcc -Iunictype -o gen-uni-tables gen-uni-tables.c
|
||||
mv ../../*.txt .
|
||||
./gen-uni-tables UnicodeData-15.0.0.txt PropList-15.0.0.txt DerivedCoreProperties-15.0.0.txt emoji-data-15.0.0.txt ArabicShaping-15.0.0.txt Scripts-15.0.0.txt Blocks-15.0.0.txt PropList-3.0.1.txt EastAsianWidth-15.0.0.txt LineBreak-15.0.0.txt WordBreakProperty-15.0.0.txt GraphemeBreakProperty-15.0.0.txt CompositionExclusions-15.0.0.txt SpecialCasing-15.0.0.txt CaseFolding-15.0.0.txt 15.0
|
||||
popd
|
||||
|
||||
../gnulib-bb5bb43/gnulib-tool --import --local-dir=gl \
|
||||
--lib=libcoreutils \
|
||||
--source-base=lib \
|
||||
--m4-base=m4 \
|
||||
--doc-base=doc \
|
||||
--tests-base=gnulib-tests \
|
||||
--aux-dir=build-aux \
|
||||
--with-tests \
|
||||
--makefile-name=gnulib.mk \
|
||||
--automake-subdir \
|
||||
--no-conditional-dependencies \
|
||||
--no-libtool \
|
||||
--macro-prefix=gl \
|
||||
--avoid=canonicalize-lgpl \
|
||||
--avoid=dummy \
|
||||
acl \
|
||||
alignalloc \
|
||||
alignasof \
|
||||
alloca \
|
||||
announce-gen \
|
||||
areadlink-with-size \
|
||||
areadlinkat-with-size \
|
||||
argmatch \
|
||||
argv-iter \
|
||||
assert \
|
||||
assert-h \
|
||||
assure \
|
||||
attribute \
|
||||
autobuild \
|
||||
backup-rename \
|
||||
backupfile \
|
||||
base32 \
|
||||
base64 \
|
||||
btowc \
|
||||
buffer-lcm \
|
||||
byteswap \
|
||||
c-strcase \
|
||||
calloc-gnu \
|
||||
canon-host \
|
||||
canonicalize \
|
||||
chmodat \
|
||||
chown \
|
||||
chownat \
|
||||
cl-strtod \
|
||||
cl-strtold \
|
||||
cloexec \
|
||||
closein \
|
||||
closeout \
|
||||
config-h \
|
||||
configmake \
|
||||
copy-file-range \
|
||||
count-leading-zeros \
|
||||
crypto/md5 \
|
||||
crypto/sha1 \
|
||||
crypto/sha256 \
|
||||
crypto/sha512 \
|
||||
crypto/sm3 \
|
||||
cycle-check \
|
||||
d-ino \
|
||||
d-type \
|
||||
di-set \
|
||||
dirfd \
|
||||
dirname \
|
||||
do-release-commit-and-tag \
|
||||
dtoastr \
|
||||
dup2 \
|
||||
environ \
|
||||
error \
|
||||
euidaccess \
|
||||
exclude \
|
||||
exitfail \
|
||||
explicit_bzero \
|
||||
faccessat \
|
||||
fadvise \
|
||||
fchdir \
|
||||
fchmodat \
|
||||
fchownat \
|
||||
fclose \
|
||||
fcntl \
|
||||
fcntl-safer \
|
||||
fd-reopen \
|
||||
fdatasync \
|
||||
fdopen \
|
||||
fdutimensat \
|
||||
file-has-acl \
|
||||
file-type \
|
||||
fileblocks \
|
||||
filemode \
|
||||
filenamecat \
|
||||
filevercmp \
|
||||
flexmember \
|
||||
fnmatch-gnu \
|
||||
fopen-safer \
|
||||
fprintftime \
|
||||
fpurge \
|
||||
free-posix \
|
||||
freopen \
|
||||
freopen-safer \
|
||||
fseeko \
|
||||
fstatat \
|
||||
fsusage \
|
||||
fsync \
|
||||
ftoastr \
|
||||
ftruncate \
|
||||
fts \
|
||||
full-read \
|
||||
full-write \
|
||||
getgroups \
|
||||
gethrxtime \
|
||||
getline \
|
||||
getloadavg \
|
||||
getlogin \
|
||||
getndelim2 \
|
||||
getopt-gnu \
|
||||
getpagesize \
|
||||
getpass-gnu \
|
||||
gettext-h \
|
||||
gettime \
|
||||
gettime-res \
|
||||
getugroups \
|
||||
getusershell \
|
||||
git-version-gen \
|
||||
gitlog-to-changelog \
|
||||
gnu-make \
|
||||
gnu-web-doc-update \
|
||||
gnumakefile \
|
||||
gnupload \
|
||||
group-member \
|
||||
hard-locale \
|
||||
hash \
|
||||
hash-triple \
|
||||
heap \
|
||||
host-os \
|
||||
human \
|
||||
idcache \
|
||||
idx \
|
||||
ignore-value \
|
||||
inttostr \
|
||||
inttypes \
|
||||
isapipe \
|
||||
isatty \
|
||||
isblank \
|
||||
largefile \
|
||||
lchmod \
|
||||
lchown \
|
||||
ldtoastr \
|
||||
lib-ignore \
|
||||
libgmp \
|
||||
linebuffer \
|
||||
link \
|
||||
link-follow \
|
||||
linkat \
|
||||
long-options \
|
||||
lstat \
|
||||
maintainer-makefile \
|
||||
malloc-gnu \
|
||||
manywarnings \
|
||||
mbrlen \
|
||||
mbrtowc \
|
||||
mbsalign \
|
||||
mbschr \
|
||||
mbslen \
|
||||
mbswidth \
|
||||
memcasecmp \
|
||||
memchr \
|
||||
memcmp2 \
|
||||
mempcpy \
|
||||
memrchr \
|
||||
mgetgroups \
|
||||
minmax \
|
||||
mkancesdirs \
|
||||
mkdir \
|
||||
mkdir-p \
|
||||
mkdirat \
|
||||
mkfifo \
|
||||
mkfifoat \
|
||||
mknod \
|
||||
mkostemp \
|
||||
mkstemp \
|
||||
mktime \
|
||||
modechange \
|
||||
mountlist \
|
||||
mpsort \
|
||||
netinet_in \
|
||||
nproc \
|
||||
nstrftime \
|
||||
nullptr \
|
||||
obstack \
|
||||
open \
|
||||
openat-safer \
|
||||
parse-datetime \
|
||||
parse-datetime2 \
|
||||
pathmax \
|
||||
perl \
|
||||
physmem \
|
||||
pipe-posix \
|
||||
pipe2 \
|
||||
posix-shell \
|
||||
posixtm \
|
||||
posixver \
|
||||
priv-set \
|
||||
progname \
|
||||
propername-lite \
|
||||
pthread-cond \
|
||||
pthread-mutex \
|
||||
pthread-thread \
|
||||
pthread_sigmask \
|
||||
putenv \
|
||||
quote \
|
||||
quotearg \
|
||||
randint \
|
||||
randperm \
|
||||
rawmemchr \
|
||||
read-file \
|
||||
readlink \
|
||||
readtokens \
|
||||
readtokens0 \
|
||||
readutmp \
|
||||
realloc-gnu \
|
||||
regex \
|
||||
remove \
|
||||
rename \
|
||||
renameat \
|
||||
renameatu \
|
||||
rmdir \
|
||||
root-dev-ino \
|
||||
rpmatch \
|
||||
safe-read \
|
||||
same \
|
||||
save-cwd \
|
||||
savedir \
|
||||
savewd \
|
||||
select \
|
||||
selinux-at \
|
||||
setenv \
|
||||
settime \
|
||||
sig2str \
|
||||
sigaction \
|
||||
smack \
|
||||
ssize_t \
|
||||
stat-macros \
|
||||
stat-size \
|
||||
stat-time \
|
||||
stdbool \
|
||||
stdckdint \
|
||||
stdlib-safer \
|
||||
stpcpy \
|
||||
stpncpy \
|
||||
strdup-posix \
|
||||
strncat \
|
||||
strnumcmp \
|
||||
strsignal \
|
||||
strtoimax \
|
||||
strtoumax \
|
||||
symlinkat \
|
||||
sys_ioctl \
|
||||
sys_resource \
|
||||
sys_stat \
|
||||
sys_wait \
|
||||
targetdir \
|
||||
tempname \
|
||||
termios \
|
||||
time_rz \
|
||||
timer-time \
|
||||
timespec \
|
||||
tmpdir \
|
||||
tzset \
|
||||
uname \
|
||||
unicodeio \
|
||||
unistd-safer \
|
||||
unlink-busy \
|
||||
unlinkat \
|
||||
unlinkdir \
|
||||
unlocked-io \
|
||||
unsetenv \
|
||||
update-copyright \
|
||||
useless-if-before-free \
|
||||
userspec \
|
||||
utimecmp \
|
||||
utimens \
|
||||
utimensat \
|
||||
vasprintf-posix \
|
||||
vc-list-files \
|
||||
verify \
|
||||
verror \
|
||||
version-etc-fsf \
|
||||
wchar-single \
|
||||
wcswidth \
|
||||
wcwidth \
|
||||
winsz-ioctl \
|
||||
winsz-termios \
|
||||
write-any-file \
|
||||
xalignalloc \
|
||||
xalloc \
|
||||
xbinary-io \
|
||||
xdectoint \
|
||||
xfts \
|
||||
xgetcwd \
|
||||
xgetgroups \
|
||||
xgethostname \
|
||||
xmemcoll \
|
||||
xnanosleep \
|
||||
xprintf \
|
||||
xprintf-posix \
|
||||
xreadlink \
|
||||
xstrtod \
|
||||
xstrtoimax \
|
||||
xstrtol \
|
||||
xstrtol-error \
|
||||
xstrtold \
|
||||
xstrtoumax \
|
||||
year2038-recommended \
|
||||
yesno
|
|
@ -1,19 +0,0 @@
|
|||
http://git.savannah.gnu.org/cgit/coreutils.git/snapshot/coreutils-9.4.tar.xz 8fb56810310253300b3d6f84e68dc97eb2d74e1f4f78e05776831d9d82e4f2d7
|
||||
https://files.bootstrapping.world/coreutils-9.4.tar.xz 8fb56810310253300b3d6f84e68dc97eb2d74e1f4f78e05776831d9d82e4f2d7
|
||||
http://git.savannah.gnu.org/cgit/gnulib.git/snapshot/gnulib-bb5bb43.tar.gz b8aa1ac1b18c67f081486069e6a7a5564f20431c2313a94c20a46dcfb904be2a
|
||||
https://files.bootstrapping.world/gnulib-bb5bb43.tar.gz b8aa1ac1b18c67f081486069e6a7a5564f20431c2313a94c20a46dcfb904be2a
|
||||
http://ftp.unicode.org/Public/15.0.0/ucd/UnicodeData.txt 806e9aed65037197f1ec85e12be6e8cd870fc5608b4de0fffd990f689f376a73 UnicodeData-15.0.0.txt
|
||||
http://ftp.unicode.org/Public/15.0.0/ucd/PropList.txt e05c0a2811d113dae4abd832884199a3ea8d187ee1b872d8240a788a96540bfd PropList-15.0.0.txt
|
||||
http://ftp.unicode.org/Public/15.0.0/ucd/DerivedCoreProperties.txt d367290bc0867e6b484c68370530bdd1a08b6b32404601b8c7accaf83e05628d DerivedCoreProperties-15.0.0.txt
|
||||
http://ftp.unicode.org/Public/15.0.0/ucd/emoji/emoji-data.txt 29071dba22c72c27783a73016afb8ffaeb025866740791f9c2d0b55cc45a3470 emoji-data-15.0.0.txt
|
||||
http://ftp.unicode.org/Public/15.0.0/ucd/ArabicShaping.txt eb840f36e0a7446293578c684a54c6d83d249abde7bdd4dfa89794af1d7fe9e9 ArabicShaping-15.0.0.txt
|
||||
http://ftp.unicode.org/Public/15.0.0/ucd/Scripts.txt cca85d830f46aece2e7c1459ef1249993dca8f2e46d51e869255be140d7ea4b0 Scripts-15.0.0.txt
|
||||
http://ftp.unicode.org/Public/15.0.0/ucd/Blocks.txt 529dc5d0f6386d52f2f56e004bbfab48ce2d587eea9d38ba546c4052491bd820 Blocks-15.0.0.txt
|
||||
http://ftp.unicode.org/Public/3.0-Update1/PropList-3.0.1.txt 909eef4adbeddbdddcd9487c856fe8cdbb8912aa8eb315ed7885b6ef65f4dc4c
|
||||
http://ftp.unicode.org/Public/15.0.0/ucd/EastAsianWidth.txt 743e7bc435c04ab1a8459710b1c3cad56eedced5b806b4659b6e69b85d0adf2a EastAsianWidth-15.0.0.txt
|
||||
http://ftp.unicode.org/Public/15.0.0/ucd/LineBreak.txt 012bca868e2c4e59a5a10a7546baf0c6fb1b2ef458c277f054915c8a49d292bf LineBreak-15.0.0.txt
|
||||
http://ftp.unicode.org/Public/15.0.0/ucd/auxiliary/WordBreakProperty.txt 5188a56e91593467c2e912601ebc78750e6adc9b04541b8c5becb5441e388ce2 WordBreakProperty-15.0.0.txt
|
||||
http://ftp.unicode.org/Public/15.0.0/ucd/auxiliary/GraphemeBreakProperty.txt 5a0f8748575432f8ff95e1dd5bfaa27bda1a844809e17d6939ee912bba6568a1 GraphemeBreakProperty-15.0.0.txt
|
||||
http://ftp.unicode.org/Public/15.0.0/ucd/CompositionExclusions.txt 3b019c0a33c3140cbc920c078f4f9af2680ba4f71869c8d4de5190667c70b6a3 CompositionExclusions-15.0.0.txt
|
||||
http://ftp.unicode.org/Public/15.0.0/ucd/SpecialCasing.txt 78b29c64b5840d25c11a9f31b665ee551b8a499eca6c70d770fcad7dd710f494 SpecialCasing-15.0.0.txt
|
||||
http://ftp.unicode.org/Public/15.0.0/ucd/CaseFolding.txt cdd49e55eae3bbf1f0a3f6580c974a0263cb86a6a08daa10fbf705b4808a56f7 CaseFolding-15.0.0.txt
|
|
@ -1 +0,0 @@
|
|||
https://curl.se/download/curl-8.5.0.tar.xz 42ab8db9e20d8290a3b633e7fbb3cec15db34df65fd1015ef8ac1e4723750eeb
|
|
@ -1,99 +0,0 @@
|
|||
#!/bin/sh
|
||||
# SPDX-FileCopyrightText: 2024 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
../gnulib-5d2fe24/gnulib-tool --import --local-dir=gl \
|
||||
--lib=libdiffutils \
|
||||
--source-base=lib \
|
||||
--m4-base=m4 \
|
||||
--doc-base=doc \
|
||||
--tests-base=gnulib-tests \
|
||||
--aux-dir=build-aux \
|
||||
--with-tests \
|
||||
--makefile-name=gnulib.mk \
|
||||
--no-conditional-dependencies \
|
||||
--no-libtool \
|
||||
--macro-prefix=gl \
|
||||
--avoid=localename \
|
||||
--avoid=lock-tests \
|
||||
--avoid=setlocale \
|
||||
announce-gen \
|
||||
argmatch \
|
||||
attribute \
|
||||
binary-io \
|
||||
c-stack \
|
||||
config-h \
|
||||
diffseq \
|
||||
dirname \
|
||||
do-release-commit-and-tag \
|
||||
dup2 \
|
||||
error \
|
||||
exclude \
|
||||
exitfail \
|
||||
extensions \
|
||||
extern-inline \
|
||||
fcntl \
|
||||
file-type \
|
||||
filenamecat \
|
||||
flexmember \
|
||||
fnmatch-gnu \
|
||||
getopt-gnu \
|
||||
gettext-h \
|
||||
gettime \
|
||||
git-version-gen \
|
||||
gitlog-to-changelog \
|
||||
gnu-make \
|
||||
gnu-web-doc-update \
|
||||
gnumakefile \
|
||||
gnupload \
|
||||
hard-locale \
|
||||
inttostr \
|
||||
inttypes \
|
||||
isblank \
|
||||
largefile \
|
||||
lstat \
|
||||
maintainer-makefile \
|
||||
manywarnings \
|
||||
mbrtowc \
|
||||
mempcpy \
|
||||
mkstemp \
|
||||
mktime \
|
||||
nstrftime \
|
||||
nullptr \
|
||||
perl \
|
||||
progname \
|
||||
propername \
|
||||
raise \
|
||||
rawmemchr \
|
||||
readme-release \
|
||||
regex \
|
||||
sh-quote \
|
||||
signal \
|
||||
sigprocmask \
|
||||
stat \
|
||||
stat-macros \
|
||||
stat-time \
|
||||
stdbool \
|
||||
stdint \
|
||||
stpcpy \
|
||||
strcase \
|
||||
strptime \
|
||||
strtoimax \
|
||||
sys_wait \
|
||||
system-quote \
|
||||
time_rz \
|
||||
unistd \
|
||||
unlocked-io \
|
||||
update-copyright \
|
||||
verify \
|
||||
version-etc \
|
||||
version-etc-fsf \
|
||||
wcwidth \
|
||||
xalloc \
|
||||
xfreopen \
|
||||
xmalloca \
|
||||
xreadlink \
|
||||
xstdopen \
|
||||
xstrtoimax \
|
||||
year2038
|
|
@ -1,24 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2024 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
|
||||
autoreconf-2.71 -fi
|
||||
rm man/*.1
|
||||
rm doc/*.info
|
||||
|
||||
# gperf
|
||||
rm lib/iconv_open*.h
|
||||
|
||||
# Don't use in tree help2man
|
||||
rm man/help2man
|
||||
ln -s "${PREFIX}/bin/help2man" man/help2man
|
||||
|
||||
. ../../import-gnulib.sh
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
./configure --prefix="${PREFIX}"
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
https://mirrors.kernel.org/gnu/diffutils/diffutils-3.10.tar.xz 90e5e93cc724e4ebe12ede80df1634063c7a855692685919bfe60b556c9bd09e
|
||||
http://git.savannah.gnu.org/cgit/gnulib.git/snapshot/gnulib-5d2fe24.tar.gz 72e7bb2d1d75e63d1c46d33b8dd22e8eb60afdba4af3e7251151b5c2a6f00bfb
|
||||
https://files.bootstrapping.world/gnulib-5d2fe24.tar.gz 72e7bb2d1d75e63d1c46d33b8dd22e8eb60afdba4af3e7251151b5c2a6f00bfb
|
|
@ -1 +0,0 @@
|
|||
https://mirrors.kernel.org/slackware/slackware-13.37/source/a/ed/ed-1.4.tar.xz 102c80e6da527c6b8eebd5195cd05fc71808d60735d73e8bb503a5e294475007
|
12
steps/env
12
steps/env
|
@ -1,12 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
DISTFILES=/external/distfiles
|
||||
PREFIX=/usr
|
||||
BINDIR=${PREFIX}/bin
|
||||
LIBDIR=${PREFIX}/lib/mes
|
||||
INCDIR=${PREFIX}/include/mes
|
||||
SRCDIR=/steps
|
||||
TMPDIR=/tmp
|
||||
PATH=${BINDIR}:/${ARCH_DIR}/bin
|
|
@ -1,22 +0,0 @@
|
|||
/* SPDX-FileCopyrightText: 2024 Richard Masters <grick23@gmail.com> */
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
#undef NR_PROCS
|
||||
#define NR_PROCS 4096
|
||||
#undef NR_CALLOUTS
|
||||
#define NR_CALLOUTS NR_PROCS
|
||||
#undef NR_OPENS
|
||||
#define NR_OPENS 4096
|
||||
#undef NR_FLOCKS
|
||||
#define NR_FLOCKS (NR_PROCS * 5)
|
||||
#undef MAX_PID_VALUE
|
||||
#define MAX_PID_VALUE 16000000
|
||||
#undef RAMDISK_DRIVES
|
||||
#define RAMDISK_DRIVES 0
|
||||
#define CONFIG_SYSCALL_6TH_ARG
|
||||
#define CONFIG_VM_SPLIT22
|
||||
#define CONFIG_KEXEC
|
||||
#undef CONFIG_OFFSET64
|
||||
#define CONFIG_MMAP2
|
||||
#define CONFIG_64BIT_SYSCALLS
|
||||
#undef CONFIG_NET
|
||||
#undef CONFIG_PRINTK64
|
|
@ -1,4 +0,0 @@
|
|||
/* SPDX-FileCopyrightText: 2024 Richard Masters <grick23@gmail.com> */
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
#undef INIT_PROGRAM
|
||||
#define INIT_PROGRAM "/init"
|
|
@ -1,8 +0,0 @@
|
|||
/* SPDX-FileCopyrightText: 2024 Richard Masters <grick23@gmail.com> */
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
#undef CHILD_MAX
|
||||
#define CHILD_MAX 4096
|
||||
#undef OPEN_MAX
|
||||
#define OPEN_MAX 4096
|
||||
#undef FD_SETSIZE
|
||||
#define FD_SETSIZE OPEN_MAX
|
|
@ -1,4 +0,0 @@
|
|||
/* SPDX-FileCopyrightText: 2024 Richard Masters <grick23@gmail.com> */
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
#undef UTS_SYSNAME
|
||||
#define UTS_SYSNAME "Linux"
|
|
@ -1 +0,0 @@
|
|||
2c6d2d24bc1ffcec1af415b031846d06f581cd4d2b8ba721fed55f98863a79f9 /boot/fiwix
|
|
@ -1 +0,0 @@
|
|||
https://github.com/mikaku/Fiwix/releases/download/v1.5.0-lb1/fiwix-1.5.0-lb1.tar.gz 6635f8b8a44694a374daccd528a8d22550e684d33dc967f7fa2d161b9d69deb4
|
|
@ -1,17 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2024 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
|
||||
# texinfo
|
||||
rm doc/*.info
|
||||
|
||||
# bison
|
||||
rm awkgram.c command.c
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
./configure --prefix="${PREFIX}"
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
https://mirrors.kernel.org/gnu/gawk/gawk-5.3.0.tar.xz ca9c16d3d11d0ff8c69d79dc0b47267e1329a69b39b799895604ed447d3ca90b
|
|
@ -1 +0,0 @@
|
|||
https://ftp.gnu.org/gnu/gcc/gcc-13.1.0/gcc-13.1.0.tar.xz 61d684f0aa5e76ac6585ad8898a2427aade8979ed5e7f85492286c4dfc13ee86
|
|
@ -1,39 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# SPDX-FileCopyrightText: 2021 Melg Eight <public.melg8@gmail.com>
|
||||
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||
# SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Regenerate unicode files
|
||||
pushd ../gnulib-d271f86/lib
|
||||
gcc -Iunictype -o gen-uni-tables gen-uni-tables.c
|
||||
mv ../../*.txt .
|
||||
./gen-uni-tables UnicodeData-9.0.0.txt PropList-9.0.0.txt DerivedCoreProperties-9.0.0.txt ArabicShaping-9.0.0.txt Scripts-9.0.0.txt Blocks-9.0.0.txt PropList-3.0.1.txt EastAsianWidth-9.0.0.txt LineBreak-9.0.0.txt WordBreakProperty-9.0.0.txt GraphemeBreakProperty-9.0.0.txt CompositionExclusions-9.0.0.txt SpecialCasing-9.0.0.txt CaseFolding-9.0.0.txt 9.0
|
||||
popd
|
||||
|
||||
../gnulib-d271f86/gnulib-tool --import --local-dir=gl \
|
||||
--lib=libgnu \
|
||||
--source-base=grub-core/lib/gnulib \
|
||||
--m4-base=m4 \
|
||||
--doc-base=doc \
|
||||
--tests-base=tests \
|
||||
--aux-dir=build-aux \
|
||||
--no-conditional-dependencies \
|
||||
--no-libtool \
|
||||
--macro-prefix=gl \
|
||||
--no-vc-files \
|
||||
argp \
|
||||
base64 \
|
||||
error \
|
||||
fnmatch \
|
||||
getdelim \
|
||||
getline \
|
||||
gettext-h \
|
||||
gitlog-to-changelog \
|
||||
mbswidth \
|
||||
progname \
|
||||
realloc-gnu \
|
||||
regex \
|
||||
save-cwd
|
|
@ -1,36 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
|
||||
# Remove pregenerated gnulib files
|
||||
pushd ../gnulib-d271f86
|
||||
rm lib/unictype/ctype*.h
|
||||
rm lib/unicase/tolower.h
|
||||
popd
|
||||
|
||||
. ../../import-gnulib.sh
|
||||
|
||||
for patchname in fix-base64 fix-null-deref fix-null-state-deref fix-regcomp-uninit-token \
|
||||
fix-regexec-null-deref fix-uninit-structure fix-unused-value fix-width no-abort; do
|
||||
patch -d grub-core/lib/gnulib -p2 < "grub-core/lib/gnulib-patches/$patchname.patch"
|
||||
done
|
||||
|
||||
./autogen.sh
|
||||
|
||||
cp -a INSTALL INSTALL.grub
|
||||
autoreconf-2.69 -vif
|
||||
mv INSTALL.grub INSTALL
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
CFLAGS="-Wno-error" ./configure --prefix="${PREFIX}" --sbindir="${PREFIX}/bin" --build=i686-pc-linux-musl
|
||||
}
|
||||
|
||||
src_install() {
|
||||
default
|
||||
rm "${DESTDIR}${PREFIX}/share/info/dir"
|
||||
rm "${DESTDIR}${PREFIX}/share/man/man8/grub-install.8"
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
https://mirrors.kernel.org/gnu/grub/grub-2.06.tar.xz b79ea44af91b93d17cd3fe80bdae6ed43770678a9a5ae192ccea803ebb657ee1
|
||||
https://git.savannah.gnu.org/cgit/gnulib.git/snapshot/gnulib-d271f86.tar.gz 31d69d3d251e39135b5194ddc6f897910d344059f7494d96a739aecbf7ac2b66
|
||||
https://files.bootstrapping.world/gnulib-d271f86.tar.gz 31d69d3d251e39135b5194ddc6f897910d344059f7494d96a739aecbf7ac2b66
|
||||
http://ftp.unicode.org/Public/9.0.0/ucd/UnicodeData.txt 68dfc414d28257b9b5d6ddbb8b466c768c00ebdf6cbf7784364a9b6cad55ee8f UnicodeData-9.0.0.txt
|
||||
http://ftp.unicode.org/Public/9.0.0/ucd/PropList.txt f413ea8dbd3858de72f3148b47dd0586019761357d1481e3b65f3a025bc27f82 PropList-9.0.0.txt
|
||||
http://ftp.unicode.org/Public/9.0.0/ucd/DerivedCoreProperties.txt 6662c7e30b572df5d948c092692f52bcc79ab36d49a063a73d6435042db6fb3b DerivedCoreProperties-9.0.0.txt
|
||||
http://ftp.unicode.org/Public/9.0.0/ucd/ArabicShaping.txt 47cb62a53beea6d0263e2147331c7e751853c9327225d95bbe2d9e1dc3e1aa44 ArabicShaping-9.0.0.txt
|
||||
http://ftp.unicode.org/Public/9.0.0/ucd/Scripts.txt fba415952f5654145acad220dc2b878f815c673474d2bb4928934e3ba6ccca1d Scripts-9.0.0.txt
|
||||
http://ftp.unicode.org/Public/9.0.0/ucd/Blocks.txt 612127d4889032e55d82522e4a0c19793bda8aa8da14ecb3c696d17c83e6be13 Blocks-9.0.0.txt
|
||||
http://ftp.unicode.org/Public/3.0-Update1/PropList-3.0.1.txt 909eef4adbeddbdddcd9487c856fe8cdbb8912aa8eb315ed7885b6ef65f4dc4c
|
||||
http://ftp.unicode.org/Public/9.0.0/ucd/EastAsianWidth.txt 3382cb4980e0021e9d4312f2d099315cfab6100ce0ff63a22d6937bfa720bcb7 EastAsianWidth-9.0.0.txt
|
||||
http://ftp.unicode.org/Public/9.0.0/ucd/LineBreak.txt e2698584982ccd96e0c688bbcd4d2c48a23805baa0a0084388ef2e50ebd30aad LineBreak-9.0.0.txt
|
||||
http://ftp.unicode.org/Public/9.0.0/ucd/auxiliary/WordBreakProperty.txt cb2db065c77287e0f1d35b8c9b473d848b7566a1670439f67c357ca393084043 WordBreakProperty-9.0.0.txt
|
||||
http://ftp.unicode.org/Public/9.0.0/ucd/auxiliary/GraphemeBreakProperty.txt 4bb8931857e0a698fd2ec4a51a84c6de33e48a50d8b4bf0b57d960c41d77a191 GraphemeBreakProperty-9.0.0.txt
|
||||
http://ftp.unicode.org/Public/9.0.0/ucd/CompositionExclusions.txt 5623df16856ad4007c60bdfff6f054e087521becd24cb4006be69c3a1d851aee CompositionExclusions-9.0.0.txt
|
||||
http://ftp.unicode.org/Public/9.0.0/ucd/SpecialCasing.txt dfc4f159c5c68328114ff17cd520451714a72ff48657287e5fe2f64344980695 SpecialCasing-9.0.0.txt
|
||||
http://ftp.unicode.org/Public/9.0.0/ucd/CaseFolding.txt 37d40cf8c2c35637f4a04e746814e1fc4eb764c272bed9238a87ee96a4866857 CaseFolding-9.0.0.txt
|
|
@ -1,64 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2024 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
../gnulib-5651802/gnulib-tool --import --local-dir=gl \
|
||||
--lib=libgzip \
|
||||
--source-base=lib \
|
||||
--m4-base=m4 \
|
||||
--doc-base=doc \
|
||||
--tests-base=tests \
|
||||
--aux-dir=build-aux \
|
||||
--makefile-name=gnulib.mk \
|
||||
--no-conditional-dependencies \
|
||||
--no-libtool \
|
||||
--macro-prefix=gl \
|
||||
--avoid=getline \
|
||||
--avoid=rpmatch \
|
||||
announce-gen \
|
||||
calloc-gnu \
|
||||
close \
|
||||
dirname-lgpl \
|
||||
fclose \
|
||||
fcntl \
|
||||
fcntl-safer \
|
||||
fdatasync \
|
||||
fdopendir \
|
||||
filename \
|
||||
fprintf-posix \
|
||||
fsync \
|
||||
getopt-gnu \
|
||||
git-version-gen \
|
||||
gitlog-to-changelog \
|
||||
gnu-make \
|
||||
gnu-web-doc-update \
|
||||
gnumakefile \
|
||||
gnupload \
|
||||
ignore-value \
|
||||
intprops \
|
||||
largefile \
|
||||
lib-ignore \
|
||||
lstat \
|
||||
maintainer-makefile \
|
||||
malloc-gnu \
|
||||
manywarnings \
|
||||
openat-safer \
|
||||
printf-posix \
|
||||
readme-release \
|
||||
realloc-gnu \
|
||||
savedir \
|
||||
sigaction \
|
||||
stat-time \
|
||||
strerror \
|
||||
sys_stat \
|
||||
time \
|
||||
unistd-safer \
|
||||
unlinkat \
|
||||
update-copyright \
|
||||
utimens \
|
||||
verify \
|
||||
xalloc \
|
||||
year2038 \
|
||||
yesno
|
|
@ -1,14 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2024 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
autoreconf-2.71 -fi
|
||||
|
||||
. ../../import-gnulib.sh
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
./configure --prefix="${PREFIX}"
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
https://mirrors.kernel.org/gnu/gzip/gzip-1.13.tar.xz 7454eb6935db17c6655576c2e1b0fabefd38b4d0936e0f87f48cd062ce91a057
|
||||
http://git.savannah.gnu.org/cgit/gnulib.git/snapshot/gnulib-5651802.tar.gz 56f1221eb682c3502ee097f583f44673570753cb452346ad4806d94560c3fac9
|
||||
https://files.bootstrapping.world/gnulib-5651802.tar.gz 56f1221eb682c3502ee097f583f44673570753cb452346ad4806d94560c3fac9
|
|
@ -1 +0,0 @@
|
|||
e5ddef55d9747552d3d29662312417d8223b125d6df423fdec303e2684e2c34c /usr/bin/gzip
|
|
@ -1,31 +0,0 @@
|
|||
SPDX-FileCopyrightText: 2023 Paul Dersey <pdersey@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
Modify makecrc so that it outputs C code to a file that
|
||||
can be appended to util.c
|
||||
|
||||
--- sample/makecrc.c
|
||||
+++ sample/makecrc.c
|
||||
@@ -47,7 +47,9 @@ main()
|
||||
e |= 1L << (31 - p[i]);
|
||||
|
||||
/* Compute and print table of CRC's, five per line */
|
||||
- printf(" 0x00000000L");
|
||||
+ FILE *output = fopen("crc.c", "w");
|
||||
+ fprintf(output, "ulg crc_32_tab[] = {\n");
|
||||
+ fprintf(output," 0x00000000L");
|
||||
for (i = 1; i < 256; i++)
|
||||
{
|
||||
c = i;
|
||||
@@ -56,8 +58,8 @@ main()
|
||||
*/
|
||||
for (k = 8; k; k--)
|
||||
c = c & 1 ? (c >> 1) ^ e : c >> 1;
|
||||
- printf(i % 5 ? ", 0x%08lxL" : ",\n 0x%08lxL", c);
|
||||
+ fprintf(output, i % 5 ? ", 0x%08lxL" : ",\n 0x%08lxL", c);
|
||||
}
|
||||
- putchar('\n');
|
||||
+ fprintf(output,"\n};\n");
|
||||
return 0;
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
SPDX-FileCopyrightText: 2023 Paul Dersey <pdersey@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
Remove generated CRC table
|
||||
|
||||
--- util.c
|
||||
+++ util.c
|
||||
@@ -406,57 +406,3 @@ voidp xmalloc (size)
|
||||
/* ========================================================================
|
||||
* Table of CRC-32's of all single-byte values (made by makecrc.c)
|
||||
*/
|
||||
-ulg crc_32_tab[] = {
|
||||
- 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
|
||||
- 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
|
||||
- 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
|
||||
- 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
|
||||
- 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
|
||||
- 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
|
||||
- 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
|
||||
- 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
|
||||
- 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
|
||||
- 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
|
||||
- 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
|
||||
- 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
|
||||
- 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
|
||||
- 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
|
||||
- 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
|
||||
- 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
|
||||
- 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
|
||||
- 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
|
||||
- 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
|
||||
- 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
|
||||
- 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
|
||||
- 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
|
||||
- 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
|
||||
- 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
|
||||
- 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
|
||||
- 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
|
||||
- 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
|
||||
- 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
|
||||
- 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
|
||||
- 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
|
||||
- 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
|
||||
- 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
|
||||
- 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
|
||||
- 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
|
||||
- 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
|
||||
- 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
|
||||
- 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
|
||||
- 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
|
||||
- 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
|
||||
- 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
|
||||
- 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
|
||||
- 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
|
||||
- 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
|
||||
- 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
|
||||
- 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
|
||||
- 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
|
||||
- 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
|
||||
- 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
|
||||
- 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
|
||||
- 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
|
||||
- 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
|
||||
- 0x2d02ef8dL
|
||||
-};
|
|
@ -1,21 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
|
||||
# SPDX-FileCopyrightText: 2021-22 fosslinux <fosslinux@aussies.space>
|
||||
# SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
src_compile() {
|
||||
cd lex
|
||||
make -f Makefile.mk CC=tcc AR=tcc\ -ar LDFLAGS=-static RANLIB=true
|
||||
cd ..
|
||||
}
|
||||
|
||||
src_install() {
|
||||
mkdir -p "${DESTDIR}${BINDIR}" "${DESTDIR}${LIBDIR}/lex"
|
||||
install lex/lex "${DESTDIR}${BINDIR}"
|
||||
install lex/libl.a "${DESTDIR}${LIBDIR}"
|
||||
install -m 644 lex/ncform "${DESTDIR}${LIBDIR}/lex"
|
||||
}
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# After bootstrap, drop to a shell if needed, then shut down cleanly.
|
||||
|
||||
. /steps/bootstrap.cfg
|
||||
. /steps/env
|
||||
|
||||
if [ -d /steps/after ]; then
|
||||
find /steps/after -maxdepth 1 -name '*.sh' -exec bash {} \;
|
||||
fi
|
||||
|
||||
if [ "${INTERACTIVE}" = True ]; then
|
||||
env - PATH=${PREFIX}/bin PS1="\w # " setsid openvt -fec1 -- bash -i
|
||||
fi
|
||||
|
||||
if [ "${CHROOT}" = False ]; then
|
||||
# ignore errors due to fstab or swapfile not existing
|
||||
swapoff -a &> /dev/null || true
|
||||
sync
|
||||
# sysrq to avoid device busy; then mount to wait for it to finish
|
||||
echo u > /proc/sysrq-trigger
|
||||
mount -o remount,ro /
|
||||
echo o > /proc/sysrq-trigger # power off
|
||||
while true; do sleep 1; done
|
||||
fi
|
|
@ -1,13 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Delete build artifacts to free up space for Linux kernel build
|
||||
|
||||
for pkg in $(ls "${SRCDIR}"); do
|
||||
if [ -d "${SRCDIR}/${pkg}/build" ]; then
|
||||
rm -rf "${SRCDIR}/${pkg}/build"
|
||||
fi
|
||||
done
|
||||
|
||||
rm -rf "/${ARCH_DIR}/artifact"
|
|
@ -1,49 +0,0 @@
|
|||
# SPDX-FileCopyrightText: 2023 Eduardo Sánchez Muñoz <eduardosm-dev@e64.io>
|
||||
# SPDX-FileCopyrightText: 2024 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Delete sources of packages before linux kernel
|
||||
|
||||
get_source_filename() {
|
||||
local url="${1}"
|
||||
local fname="${3}"
|
||||
# Default to basename of url if not given
|
||||
echo "${fname:-$(basename "${url}")}"
|
||||
}
|
||||
|
||||
# List all packages from linux kernel onwards
|
||||
# Ideally, we would use arrays here, but they are not supported by
|
||||
# the bash version we have at this point.
|
||||
pkgs="$(awk '/^build:/ { print $2 }' "${SRCDIR}/manifest" | awk '/^linux-[0-9]/,EOF { print $0 }')"
|
||||
|
||||
# Gather source names for all packages in pkgs, which we want to keep
|
||||
keep_sources=""
|
||||
for pkg in ${pkgs}; do
|
||||
while read line; do
|
||||
keep_sources="${keep_sources} $(get_source_filename ${line})"
|
||||
done < "${SRCDIR}/${pkg}/sources"
|
||||
done
|
||||
|
||||
for source in "${DISTFILES}/"*; do
|
||||
source_name="$(basename "${source}")"
|
||||
for keep_source in ${keep_sources}; do
|
||||
if [ "${keep_source}" = "${source_name}" ]; then
|
||||
# Countinue the outer loop to skip deletion
|
||||
continue 2
|
||||
fi
|
||||
done
|
||||
|
||||
# Delete this source
|
||||
rm "${source}"
|
||||
done
|
||||
|
||||
if [ -e "/external/repo-preseeded/linux-4.14.336_0.tar.bz2" ]; then
|
||||
# This is done in src_extract out of necessity usually -- I can't think of a better solution :(
|
||||
rm -f "${DISTFILES}/linux-4.14.336.tar.xz"
|
||||
fi
|
||||
|
||||
unset get_source_filename
|
||||
unset pkgs pkg line
|
||||
unset keep_sources keep_source
|
||||
unset source source_name
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/sh
|
||||
# SPDX-FileCopyrightText: 2024 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
rm -rf /external/repo-preseeded
|
||||
rm -rf /steps/*/build
|
||||
rm -rf /steps/*/src
|
|
@ -1,73 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
mkdir -p /etc /run /var/log /var/lock /var/spool /var/tmp /var/cache
|
||||
|
||||
# can't use /dev/null before mounting /dev
|
||||
mount | grep '/dev' &> /junk || (mkdir -p /dev; mount -t devtmpfs none /dev)
|
||||
rm /junk &> /dev/null || true
|
||||
|
||||
mount | grep '/proc' &> /dev/null || (mkdir -p /proc; mount -t proc proc /proc)
|
||||
mount | grep '/sys' &> /dev/null || (mkdir -p /sys; mount -t sysfs sysfs /sys)
|
||||
# Make /tmp a ramdisk (speeds up configure etc significantly)
|
||||
mount | grep '/tmp' &> /dev/null || (mkdir -p /tmp; mount -t tmpfs tmpfs /tmp)
|
||||
mount | grep '/dev/shm' &> /dev/null || (mkdir -p /dev/shm; mount -t tmpfs tmpfs /dev/shm)
|
||||
|
||||
if [ "${CHROOT}" = False ]; then
|
||||
rm /etc/mtab
|
||||
ln -s /proc/mounts /etc/mtab
|
||||
fi
|
||||
|
||||
# Add /etc/resolv.conf
|
||||
if [ ! -e "/etc/resolv.conf" ]; then
|
||||
echo 'nameserver 1.1.1.1' > /etc/resolv.conf
|
||||
fi
|
||||
if [ ! -e "/etc/resolv.conf/head" ]; then
|
||||
echo 'nameserver 1.1.1.1' > /etc/resolv.conf.head
|
||||
fi
|
||||
|
||||
# /etc/passwd -- taken from LFS
|
||||
if [ ! -e "/etc/passwd" ]; then
|
||||
cat > /etc/passwd << "EOF"
|
||||
root:x:0:0:root:/root:/bin/bash
|
||||
bin:x:1:1:bin:/dev/null:/usr/bin/false
|
||||
daemon:x:6:6:Daemon User:/dev/null:/usr/bin/false
|
||||
messagebus:x:18:18:D-Bus Message Daemon User:/run/dbus:/usr/bin/false
|
||||
uuidd:x:80:80:UUID Generation Daemon User:/dev/null:/usr/bin/false
|
||||
nobody:x:65534:65534:Unprivileged User:/dev/null:/usr/bin/false
|
||||
EOF
|
||||
fi
|
||||
|
||||
# /etc/group -- taken from LFS
|
||||
if [ ! -e "/etc/group" ]; then
|
||||
cat > /etc/group << "EOF"
|
||||
root:x:0:
|
||||
bin:x:1:daemon
|
||||
sys:x:2:
|
||||
kmem:x:3:
|
||||
tape:x:4:
|
||||
tty:x:5:
|
||||
daemon:x:6:
|
||||
floppy:x:7:
|
||||
disk:x:8:
|
||||
lp:x:9:
|
||||
dialout:x:10:
|
||||
audio:x:11:
|
||||
video:x:12:
|
||||
utmp:x:13:
|
||||
usb:x:14:
|
||||
cdrom:x:15:
|
||||
adm:x:16:
|
||||
messagebus:x:18:
|
||||
input:x:24:
|
||||
mail:x:34:
|
||||
kvm:x:61:
|
||||
uuidd:x:80:
|
||||
wheel:x:97:
|
||||
users:x:999:
|
||||
nogroup:x:65534:
|
||||
EOF
|
||||
fi
|
|
@ -1,14 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# Finalize job count once SMP support is available
|
||||
|
||||
cat >> /steps/bootstrap.cfg <<- EOF
|
||||
JOBS=${FINAL_JOBS}
|
||||
EOF
|
||||
|
||||
. /steps/bootstrap.cfg
|
||||
. /steps/env
|
|
@ -1,18 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
dhcpcd --waitip=4
|
||||
# Ensure network accessible
|
||||
timeout=120
|
||||
while ! curl example.com >/dev/null 2>&1; do
|
||||
sleep 1
|
||||
# shellcheck disable=SC2219
|
||||
let timeout--
|
||||
if [ "${timeout}" -le 0 ]; then
|
||||
echo "Timeout reached for internet to become accessible"
|
||||
false
|
||||
fi
|
||||
done
|
|
@ -1,69 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# find the physical disk name
|
||||
PHYSICAL=${DISK}
|
||||
|
||||
# take care of e.g. "sda1"
|
||||
if echo "${DISK}" | grep -Eq '^[a-z]{3}[0-9]+$'
|
||||
then
|
||||
PHYSICAL=$(echo "${DISK}" | sed -E 's/^([a-z]{3})[0-9]+$/\1/')
|
||||
fi
|
||||
|
||||
# take care of e.g. "mmcblk0p1"
|
||||
if echo "${DISK}" | grep -Eq '^[a-z0-9]{3,}p[0-9]+$'
|
||||
then
|
||||
PHYSICAL=$(echo "${DISK}" | sed -E 's/^([a-z0-9]{3,})p[0-9]+$/\1/')
|
||||
fi
|
||||
|
||||
grub-install "/dev/${PHYSICAL}"
|
||||
|
||||
cat > /boot/grub/grub.cfg <<- EOF
|
||||
set timeout=5
|
||||
set default=0
|
||||
menuentry 'Linux live-bootstrap' {
|
||||
insmod part_msdos
|
||||
set root='$(grub-probe -d /dev/${DISK} -t bios_hints | sed -e 's/ //g')'
|
||||
set gfxpayload=auto
|
||||
linux /boot/vmlinuz root=/dev/${DISK} rootwait rw $(cat /proc/cmdline)
|
||||
}
|
||||
EOF
|
||||
|
||||
cat > /init <<- 'EOF'
|
||||
#!/usr/bin/bash
|
||||
cd /steps
|
||||
. ./bootstrap.cfg
|
||||
. ./env
|
||||
. ./helpers.sh
|
||||
trap 'env PATH=${PREFIX}/bin PS1="[TRAP] \w # " bash -i' ERR
|
||||
# /dev is automounted by the kernel at this point
|
||||
mount | grep '/proc' &> /dev/null || (mkdir -p /proc; mount -t proc proc /proc)
|
||||
mount | grep '/sys' &> /dev/null || (mkdir -p /sys; mount -t sysfs sysfs /sys)
|
||||
# Make /tmp a ramdisk (speeds up configure etc significantly)
|
||||
mount | grep '/tmp' &> /dev/null || (mkdir -p /tmp; mount -t tmpfs tmpfs /tmp)
|
||||
mount | grep '/dev/shm' &> /dev/null || (mkdir -p /dev/shm; mount -t tmpfs tmpfs /dev/shm)
|
||||
|
||||
if test -f /swapfile; then
|
||||
swapon /swapfile
|
||||
fi
|
||||
|
||||
if [ "${CHROOT}" = False ]; then
|
||||
dhcpcd --waitip=4
|
||||
fi
|
||||
|
||||
env - PATH=${PREFIX}/bin PS1="\w # " setsid openvt -fec1 -- bash -i
|
||||
|
||||
# ignore errors due to fstab or swapfile not existing
|
||||
swapoff -a &> /dev/null || true
|
||||
sync
|
||||
# sysrq to avoid device busy; then mount to wait for it to finish
|
||||
echo u > /proc/sysrq-trigger
|
||||
mount -o remount,ro /
|
||||
echo o > /proc/sysrq-trigger # power off
|
||||
while true; do sleep 1; done
|
||||
EOF
|
||||
|
||||
chmod +x /init
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/sh
|
||||
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# Add the rest of the FHS that we will use and is not created pre-boot
|
||||
ln -s bin /usr/sbin
|
||||
for d in bin lib sbin; do
|
||||
ln -s "usr/${d}" "/${d}" || true # these might exist if rerunning
|
||||
done
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
sed -i "/^LIBDIR/d" /steps/env
|
||||
LIBDIR=${PREFIX}/lib/i386-unknown-linux-musl
|
||||
echo "LIBDIR=${LIBDIR}" >> /steps/env
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Set modified dates of all files to be 0 unix time.
|
||||
# This function needs `touch` that supports --no-dereference
|
||||
# (at least coreutils 8.1).
|
||||
find / -xdev -exec touch --no-dereference -t 197001010000.00 {} +
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
if bash --version | grep -q 'GPLv3'; then
|
||||
env - PATH=${PREFIX}/bin PS1="\w # " openvt -- bash -i
|
||||
else
|
||||
bash -c 'while true; do printf "[early Bash - use Ctrl+D] $(pwd) # "; eval "$(cat /dev/tty2)"; done' &> /dev/tty2 &
|
||||
fi
|
|
@ -1,41 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# http://www.linuxfromscratch.org/lfs/view/6.1/chapter06/devices.html
|
||||
mkdir -p "/dev"
|
||||
test -c "/dev/null" || (rm -f "/dev/null" &&
|
||||
mknod -m 666 "/dev/null" c 1 3)
|
||||
test -c "/dev/zero" || mknod -m 666 "/dev/zero" c 1 5
|
||||
test -c "/dev/random" || mknod -m 444 "/dev/random" c 1 8
|
||||
test -c "/dev/urandom" || mknod -m 444 "/dev/urandom" c 1 9
|
||||
|
||||
test -c "/dev/ptmx" || mknod -m 666 "/dev/ptmx" c 5 2
|
||||
test -c "/dev/tty" || mknod -m 666 "/dev/tty" c 5 0
|
||||
|
||||
test -e "/dev/stdout" || ln -s "/proc/self/fd/1" "/dev/stdout"
|
||||
|
||||
if mount --version >/dev/null 2>&1; then
|
||||
test -d "/dev/shm" || (mkdir /dev/shm && mount -t tmpfs tmpfs /dev/shm)
|
||||
test -d "/proc" || (mkdir /proc && mount -t proc proc /proc)
|
||||
fi
|
||||
|
||||
if [ "${CHROOT}" = False ]; then
|
||||
test -c "/dev/tty1" || mknod -m 666 "/dev/tty1" c 4 1
|
||||
test -c "/dev/tty2" || mknod -m 666 "/dev/tty2" c 4 2
|
||||
test -c "/dev/console" || mknod -m 666 "/dev/console" c 5 1
|
||||
test -b "/dev/sda" || mknod -m 600 "/dev/sda" b 8 0
|
||||
test -b "/dev/sda1" || mknod -m 600 "/dev/sda1" b 8 1
|
||||
test -b "/dev/sda2" || mknod -m 600 "/dev/sda2" b 8 2
|
||||
test -b "/dev/sda3" || mknod -m 600 "/dev/sda3" b 8 3
|
||||
test -b "/dev/sdb" || mknod -m 600 "/dev/sdb" b 8 16
|
||||
test -b "/dev/sdb1" || mknod -m 600 "/dev/sdb1" b 8 17
|
||||
test -b "/dev/sdb2" || mknod -m 600 "/dev/sdb2" b 8 18
|
||||
test -b "/dev/sdb2" || mknod -m 600 "/dev/sdb3" b 8 19
|
||||
test -b "/dev/sdc" || mknod -m 600 "/dev/sdc" b 8 32
|
||||
test -b "/dev/sdc1" || mknod -m 600 "/dev/sdc1" b 8 33
|
||||
test -b "/dev/sdc2" || mknod -m 600 "/dev/sdc2" b 8 34
|
||||
test -b "/dev/sdc3" || mknod -m 600 "/dev/sdc3" b 8 35
|
||||
fi
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
mkdir -p /external/repo
|
||||
|
||||
tar -cf - --exclude='/external/repo/*' --exclude='/external/repo-preseeded/*' --exclude='/external/distfiles/*' --exclude='/dev/*' --exclude='/proc/*' --exclude='/sys/*' --exclude='/tmp/*' / | bzip2 --best > /external/repo/base.tar.bz2
|
|
@ -1,18 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#
|
||||
# Set up swap
|
||||
|
||||
. /steps/bootstrap.cfg
|
||||
. /steps/env
|
||||
|
||||
if ! test -f /swapfile
|
||||
then
|
||||
echo "Making swap..."
|
||||
dd if=/dev/zero of=/swapfile bs=1M count=${SWAP_SIZE}
|
||||
mkswap /swapfile
|
||||
fi
|
||||
swapon /swapfile
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue