Code Monkey home page Code Monkey logo

seals's Introduction

SEALS

SEALS is an abbreviation for Simple Embedded ARM Linux System. It uses the powerful and FOSS Qemu (quick emulator!) to emulate a few target boards, helping us learn how to build a small (skeletal, really) embedded Linux system pretty muc from scratch!


NEW! (Oct / Dec 2023) : SEALS now supports:

  • A simple GUI at startup to select the target machine to deploy
  • New machines (platforms)!
    • the good 'ol PC (x86_64 or amd64) [Dec 2023]
    • the Raspberry Pi 3B (shows as the Compute Model 3 - CM3)

(Jan 2023): SEALS now supports both AArch32 and AArch64 platforms

The SEALS project consists of scripts that will enable you to build a simple yet complete skeletal ARM*/Linux system, emulated using the powerful QEMU emulator. The SEALS scripts automate the following tasks:

  • Using a simple ASCII text config file to precisely customize your environment
  • Using a cross-compiler
  • ARM* / Linux kernel config and build
  • Creating a skeletal root filesystem from scratch
  • Integrating the components together, using QEMU (qemu-system-arm, particularly) to run the same in an emulated environment.

*ARM can now be AArch32 or AArch64 platforms.
From v0.3, SEALS also supports the x86_64 / amd64 PC platform (so it isn't strictly only 'ARM' now!)


Getting Started

Please, FIRST READ
- the SEALS Getting Going! Tutorial

Then, in the Wiki section, the:
- SEAL's Wiki page - intro to SEALS, and
- SEAL's HOWTO page
to better understand how to build and use this project.

SEALS can prove very useful for developers / testers to prototype, try things out in a custom ARM/*Linux or emulated x86 PC simple guest system.


Install

  • Clone this repository:
    git clone https://github.com/kaiwan/seals.git
  • Run the run_and_log script.

A very brief tutorial on getting going with SEALS

I assume you're running in GUI mode (via Xorg or Xwayland).

Step 1. Perform the git clone (as mentioned above)

Step 2. If you immediately run the run_and_log script, it typically results in an error, saying that the "staging, busybox and kernel source folders" aren't present. This is typically the case when you start out.

FAQ: Where are the staging and other folders designated?
In the all-important build config file!
This file is, by default, named build.config and is a symbolic (or soft) link to the build.config.arm32_vexpress build config file - to build and run the (emulated) ARM-32 Verstaile Express board!

$ ls -l build.config
lrwxrwxrwx. 1 kaiwan kaiwan 18 Dec 14 15:43 build.config -> build.config.arm32_vexpress

It's very important to familiarize yourself with the board config files! Please browse through them, they're quite self-explanatory (with a lot of comments).

Here's a snippet from the build.config.arm32_vexpress file showing how these folders are designated:

STG=~/seals_staging/seals_staging_arm32
ROOTFS=${STG}/rootfs
IMAGES_FOLDER=${STG}/images
IMAGES_BKP_FOLDER=${STG}/images_bkp
CONFIGS_FOLDER=${STG}/configs

You're free to edit it... typically, just set the STG variable to point to your staging location on your build host's disk, the rest follow under it... (In a similar fashion, the board config files use simple shell variables to designate various board attributes, the root fs and kernel stuff, and more; you must browse through them.

So, back to the setup. To fix possible errors the first time you run SEALS, install the busybox and kernel folders and their source trees by running the install.sh script; here's a screenshot:

install script

(The script detects and deletes old source if required). When it's done, you should have the Linux busybox project and the Linux kernel source tree installed.

You can change the target board of course... by either manually updating the soft link, or, better, via our GUI! These are the 'prebuilt' target board config files we provide:

$ ls build.config*
build.config@  build.config.amd64  build.config.arm32_vexpress  build.config.arm64_qemuvirt  build.config.arm64_rpi3b_cm3

The one that the build.config soft link points to is the current one, the one that will get built and run (via Qemu). You can even define your own board config files using these as a template! (of course, introducing new variables will require your editing the build_SEALS.sh script as well). When you do do this and it works, consider contributing it!


Step 3. Run the run_and_log script. Now, if you do NOT have the staging, busybox and kernel source folders installed (Step 2), you'll get the following (or similar) error message (notice how it's both via the GUI and on the console (terminal window)):

first time error

(Hey, this is expected! Read it carefully; the project expects you to minimally setup a 'staging area' or work area (where the stuff gtes built at runtime) like this:

<staging-dir>
|--- linux-kernel-source-tree
|--- busybox-git-source-tree

).

Assuming these folders and the sources are in place (typically achived by running the install.sh script), all will be well and execution continues... The build_SEALS.sh script is the primary script (invoked by the run_and_log script) and the first thing it does is show you the currently selected target platform, and allows you to change it via this gui:

select target board

(TODO: A slight issue: when you select another board, the highlight bar still stays on the first one, but that's okay).

To go ahead with the current selection, simply press Esc here... Else, select another board by turning on it's radio button and thenclick on Select; a confirmation dialog pops up. (TODO: the new target board selection procedure's only via the GUI currently; need to update the console mode for it as well).

Step 4. You are now shown the currently selected target board configuration in detail (both via a gui dialog box and on the console):

config review

The config details are picked up from the board.config.<foo> file pertaining to the current board. This dialog allows you to review the current settings for it and decide if the current board config is fine; if your answer is:

  • Yes, it's fine: simply click the Yes button
  • No, I need to edit it: click the No button, and the script aborts. Edit the relevant build.config.<foo> file to your satisfaction, and then rerun the script.

Step 5. When happy with the state of the build config file, run the script:

After the 'usual' GUI dialogs, (the ones you've seen in the earlier steps), you will get the main menu GUI dialog:

main menu

Read the (blue color) notes on top carefully. Go ahead and select whichever options you'd like SEALS to perform! Click on OK when done.

Here's an example showing some selections made:

main menu sample selection

FAQ> What do the Wipe kernel / busybox config (Careful!*) options do?
Ans> Essentially, they have the underlying kbuild menu system to run it's make ARCH=<whatever> defconfig thus setting all config values to their default. So, it's typically useful to do this the first time you're performing the build. Once you've saved your won config, you can disable these toggles, thereby keeping your config (also, FYI, the config files, among others, can be saved / backed up (the second-to-last option).
If running in console (non-gui, on a terminal window) mode, it still works and will interactively ask you to select what you want it to do.


Perhaps it still generates errors. This could be due to missing packages (we only automate installation of required host packages on Ubuntu). More likely, the absence of the **cross toolchain** - specified in the board config file - is the issue (see the FAQ below).

FAQ> I'm getting errors regarding the toolchain
Ans> The (cross) toolchain is a required component when using any of the ARM-based boards. You'll have to install it on your build host (which can be a Linux VM, np). The detailed documentation to do so is in the Wiki section.


Example screenshots

All are wrt the default build config platform, the ARM-32 Versatile Express: (FYI, all carried out in an x86_64 Ubuntu 23.04 VirtualBox guest).

Kernel Build Portion:-

  • A screenshot showing a portion of the kernel build step, just before entering the kernel config:

kernel build sample 1

  • A screenshot showing a portion of the kernel build step, the kernel config:

kernel menuconfig sample

  • Some sample output while the kernel build just begins:

kernel pre build sample

  • Some sample output while the kernel is building:

kernel build sample

  • Some sample output after the kernel build is done:

kernel after build sample

Busybox (generates part of the target root fs: /bin, /sbin, /usr) config:-

  • Some sample output of the Busybox config menu:

bb config sample

  • Some sample output of the Busybox completion:

bb done sample

  • Some sample output of the Busybox step, root filesystem generation by SEALS:

bb rootfs sample

Sample output from the 'Generate Root Filesystem EXT4 image' menu :

gen ext4 image sample

Running it!

  • Some sample output just prior to running the AArch32 Vexpress target board under Qemu (via it's GUI menu; notice the complete Qemu command line!): (You can also run it via the run-qemu.sh 0 command).

pre run sample

  • Some sample output when running the AArch32 Vexpress target board under Qemu (notice the kernel startup, all the kernel printk's being emitted as it boots...) :

run sample

  • Some sample output running the AArch32 Vexpress target board under Qemu; once we reach our Busybox shell via (busybox) init :

post run sample

  • Some sample output running the AArch32 Vexpress target board under Qemu; on the Busybox shell :

post run sample 2

Excellent; we're running the ARM-32 Vexpress platform.


FAQ: Can I clean up everything (for the current board)?

Yes! You can do so via the cleanall script; but be CAREFUL; it will ask for confimation and then delete stuff (via the typical make clean type of command for the source, and via rm -rf ... for the root fs, images, etc).

Issues, Contribution

This project, like most FOSS ones, is ever-evolving... I urge you to not hesitate, to write in your comments, suggestions or anything. Please do raise issues or bugs in the Issues section of the GitHub repo. Any contributions would be awesome (have a look at the current Issues)! I solicit your participation and help to make this project better!

seals's People

Contributors

kaiwan avatar parampreetr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

seals's Issues

"run_and_log" script doesn't boot the kernel while running qemu-system-aarch64

[Mon_18Sep2023_07:23:29.550999406]
RUN: Running qemu-system-aarch64 now ...
DTB_BLOB_IMG =
[Mon_18Sep2023_07:23:29.566158229] qemu-system-aarch64 -m 512 -M vexpress-a15 -cpu max -smp 4,sockets=2 -cpu cortex-a15 -kernel /root/qemu/seals/SEALS_staging/SEALS_staging_vexpress/images/Image.gz -drive file=/root/qemu/seals/SEALS_staging/SEALS_staging_vexpress/images/rfs.img,format=raw,id=drive0 -append "console=ttyAMA0 root=/dev/mmcblk0 init=/sbin/init" -nographic -no-reboot

Ok? (after pressing ENTER, give it a moment ...)

Also, please exit by properly shutting down:
use the 'poweroff' command to do so.
(Worst case, typing Ctrl-a-x (abruptly) shuts Qemu down).

[Press ENTER to continue, or Ctrl-C to abort now...]

ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
alsa: Could not initialize DAC
alsa: Failed to open default': alsa: Reason: No such file or directory ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave alsa: Could not initialize DAC alsa: Failed to open default':
alsa: Reason: No such file or directory
audio: Failed to create voice `lm4549.out'

Networking

Need to setup networking within the VM... have been fiddling with it, but nothing concrete yet (using bridged tun/tap). Help is welcome!

Logging: fails with 'permission denied'

Duplicate with 'generate rootfs image' option:

why does the line:
./color.sh: line 143: log_seals.txt: Permission denied
appear??

$ ./build_SEALS.sh
[...]
2018-03-23.174150:./build_SEALS.sh:generate_rootfs_img_ext4:393
**./color.sh: line 143: log_seals.txt: Permission denied**
 SEALS ROOT FS: Generating ext4 image for root fs now:
 kai: SEALS Build: root fs image generation: enable umount. If asked, please enter password
./color.sh: line 143: log_seals.txt: Permission denied
 kai: SEALS Build: root fs image generation: enable mount. If asked, please enter password
./color.sh: line 143: log_seals.txt: Permission denied
  Now copying across rootfs data to /home/kai/scratchpad/SEALS_staging/SEALS_staging_vexpress/images/rfs.img ...
./color.sh: line 143: log_seals.txt: Permission denied
 kai: SEALS Build: root fs image generation: enable copying into SEALS root fs image. If asked, please enter password
./color.sh: line 143: log_seals.txt: Permission denied
 kai: SEALS Build: root fs image generation: enable unmount. If asked, please enter password
-rw-r--r--. 1 kai kai 768M Mar 23 17:42 /home/kai/scratchpad/SEALS_staging/SEALS_staging_vexpress/images/rfs.img
./color.sh: line 143: log_seals.txt: Permission denied
 ... and done.
2018-03-23.174205:./build_SEALS.sh:save_images_configs:463
 BACKUP: kernel, busybox images and config files now (as necessary) ...
  ... and done.
[...]

Toolchain error from `apt-get install` package

I was following a book and I got stuck in an issue.

I cloned this repo and as told I firstly installed toolchain by sudo apt install crossbuild-essential-armhf. But later I discovered, toolchain should be installed separately and I installed it and removed all packages installed from apt install ...... Now, I'm getting an error:

[+] Running in GUI mode.. (use '-c' option switch to run in console-only mode)
[+] build_SEALS.sh: initializing, pl wait ...
2021-05-22.223533:./build_SEALS.sh:check_installed_pkg:814
Password
[+] Running in GUI mode.. (use '-c' option switch to run in console-only mode)
[+] build_SEALS.sh: initializing, pl wait ...
2021-05-22.223557:./build_SEALS.sh:check_installed_pkg:814
Chances left: 4
Password
[crit]
Verification successful
[41mtalError :: Sorry, SEALS has encountered a fatal error.
Details: Sat 22 May 2021 10:35:57 PM IST:build_SEALS.sh:check_installed_pkg()
"There is an issue with the provided toolchain.

It appears to not have the toolchain 'sysroot' libraries, sbin and usr
components within it. This could (and usually does) happen if it was installed
via a simple package manager cmd like 'sudo apt install arm-linux-gnueabi'.

We insist you install a complete proper toolchain; to do so, pl follow the
detailed instructions provided here:
https://github.com/kaiwan/seals/wiki/HOWTO-Install-required-packages-on-the-Host-for-SEALS

Thanks.
"
If you feel this is a bug or issue, kindly copy the full output and email it here:
 [email protected]
Many thanks.

[titl]
[43mtack Call-trace:
   [frame #1] ./err_common.sh:cli_handle_error:147        <-- top of stack
   [frame #2] ./err_common.sh:FatalError:829
   [frame #3] ./build_SEALS.sh:check_installed_pkg:930
   [frame #4] ./build_SEALS.sh:main:0

I tried to solve this in many ways:

  • Added CXX and CXX_LOC to build.config with appropriate args.
  • I copied kernel generated config file to seals.
  • Looked up some recent commits and got last edited build.config.
  • Executed it with root priviledges.

When I used old build.config with required modifications in CXX and CXX_LOC. I got different error:

[+] Running in console mode..
[+] build_SEALS.sh: initializing, pl wait ...
2021-05-22.225840:./build_SEALS.sh:check_installed_pkg:814
2021-05-22.225840:./build_SEALS.sh:main:941
[crit]
 FatalError :: Sorry, SEALS has encountered a fatal error.
Details: Sat 22 May 2021 10:58:40 PM IST:build_SEALS.sh:main()                                                                                
"                                                                                                                                             
We expect that certain folders in the project 'staging area' are                                                                              
pre-populated with appropriate content, i.e., the source code for                                                                             
their resp projects:                                                                                                                          
                                                                                                                                              
STG              : the project staging folder                                                                                                 
  KERNEL_FOLDER  : kernel source tree                                                                                                         
  BB_FOLDER      : busybox source tree                                                                                                        
                                                                                                                                              
You must fix this by creating and populating these folders with the said                                                                      
source code; and if required, update them in the config file here:                                                                            
"./build.config"                                                                                                                              
                                                                                                                                              
TIP: the plcae to update these folders is within the above-mentioned                                                                          
config file.                                                                                                                                  
"                                                                                                                                             
If you feel this is a bug or issue, kindly copy the full output and email it here:                                                            
 [email protected]                                                                                                                  
Many thanks.                                                                                                                                  
                                                                                                                                              
[titl]                                                                                                                                        
  Stack Call-trace:
   [frame #1] ./err_common.sh:cli_handle_error:149        <-- top of stack                                                                    
   [frame #2] ./err_common.sh:FatalError:959                                                                                                  
   [frame #3] ./build_SEALS.sh:main:0 

So none worked for me.

Distro: Deepin Linux 20.2.1 (Ubuntu based)
Arch: amd64
Kernel: 5.10.29-amd64-desktop

Error on running "run_and_log"

./build_SEALS.sh: line 48: ./build.config: No such file or directory
build_SEALS.sh: source failed! ./build.config missing or invalid?
It seems build.config is symbolic link to other file that never exist!!
Where is "build.config.vexpress" ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.