linuxboot / heads

A minimal Linux that runs as a coreboot or LinuxBoot ROM payload to provide a secure, flexible boot environment for laptops, workstations and servers.
https://osresearch.net/
GNU General Public License v2.0
1.41k stars 185 forks source link

Consider moving away of busybox #1484

Open tlaurion opened 1 year ago

tlaurion commented 1 year ago

Some alternatives that might be a direct replacement:

Opening this issue because lack of wget/curl in https with cert verification is a still a problem if we want to be able to outsource some of the things currently packed in the evergrowing initrd under Heads

Note: haven't compared applets provided yet, while toybox from my limited experience under Android shell seems to be good enough.

We would have to pack all features in and see what breaks and go from there.

tlaurion commented 1 year ago

Here is PoC code (not functional) that I tried to create with my limited knowledge of python. Anyone that could make it functional would give us a clear view of what is there and what is missing to make a better decision for the project


user@heads-tests-deb12:~/heads$ cat compare_busybox.py 
# Import requests library to make HTTP requests
import requests

# Define the URLs of the applet lists
busybox_url = "https://busybox.net/BusyBox.html"
rustybox_url = "https://raw.githubusercontent.com/samuela/rustybox/master/applets.txt"
toybox_url = "https://landley.net/toybox/help.html"

# Get the HTML content of the applet lists
busybox_html = requests.get(busybox_url).text
rustybox_html = requests.get(rustybox_url).text
toybox_html = requests.get(toybox_url).text

# Define a function to extract the applet names from the HTML content
def extract_applets(html):
    # Initialize an empty set to store the applet names
    applets = set()
    # Split the HTML content by line breaks
    lines = html.split("\n")
    # Loop through each line
    for line in lines:
        # Check if the line starts with "<a name=" or "<li>"
        if line.startswith("<a name=") or line.startswith("<li>"):
            # Extract the applet name from the line
            applet = line.split(">")[1].split("<")[0]
            # Add the applet name to the set
            applets.add(applet)
    # Return the set of applet names
    return applets

# Extract the applet names from the HTML content
busybox_applets = extract_applets(busybox_html)
rustybox_applets = extract_applets(rustybox_html)
toybox_applets = extract_applets(toybox_html)

# Define a function to generate the markdown table from the applet sets
def generate_table(set1, set2, set3):
    # Initialize an empty list to store the table rows
    table = []
    # Add the table header row with the set names
    table.append(f"| BusyBox Applet | RustyBox Support | ToyBox Support |")
    # Add a separator row with dashes and pipes
    table.append(f"| -------------- | ---------------- | -------------- |")
    # Loop through each applet in set1 (assumed to be the largest set)
    for applet in sorted(set1):
        # Initialize an empty row with the applet name
        row = f"| {applet} "
        # Check if the applet is in set2 and add a Yes or No accordingly
        if applet in set2:
            row += f"| Yes "
        else:
            row += f"| No "
        # Check if the applet is in set3 and add a Yes or No accordingly
        if applet in set3:
            row += f"| Yes |"
        else:
            row += f"| No |"
        # Add the row to the table list
        table.append(row)
    # Join the table list by line breaks and return it as a string
    return "\n".join(table)

# Generate the markdown table from the applet sets and print it
table = generate_table(busybox_applets, rustybox_applets, toybox_applets)
print(table

@tasket, thinking of you but do not feel obligated in any way! @JonathonHall-Purism as usual, tagging you since that could be of a really good help going forward