Skip to content
Snippets Groups Projects
Commit 493e6683 authored by Szybet's avatar Szybet
Browse files

some further work

parent f12ec224
No related merge requests found
FROM debian:11 FROM debian:11
RUN apt-get update && apt-get upgrade && apt-get install -y openssl sudo kmod RUN apt-get -y update
RUN apt-get -y upgrade
RUN apt-get install -y fish openssl sudo kmod qemu-utils htop psmisc git
WORKDIR /home/build/inkbox/imgtool/ WORKDIR /home/build/inkbox/imgtool/
# Specify the command to run when the container starts # Specify the command to run when the container starts
CMD ["/bin/bash"] CMD ["/usr/bin/fish"]
...@@ -9,10 +9,14 @@ Create the docker image: ...@@ -9,10 +9,14 @@ Create the docker image:
docker build -t inkbox_imgtool . docker build -t inkbox_imgtool .
``` ```
Run it ( yes, imgtool should be at `/home/build/inkbox/imgtool/` ): Before running, run this:
```
sudo rmmod nbd && sudo modprobe nbd max_part=16
```
Run it ( yes, imgtool should be at `/home/build/inkbox/imgtool/` ):
``` ```
docker run -it --rm --privileged --cap-add=ALL -v /dev:/dev -v /lib/modules:/lib/modules -v "$(pwd)":/home/build/inkbox/imgtool/ inkbox_imgtool docker run -it --rm --privileged --cap-add=ALL -v /home/build/inkbox/:/home/build/inkbox/ inkbox_imgtool
``` ```
You propably want your own keys, run this: You propably want your own keys, run this:
...@@ -21,15 +25,13 @@ openssl genrsa -out private.pem 2048 ...@@ -21,15 +25,13 @@ openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -out public.pem -outform PEM -pubout openssl rsa -in private.pem -out public.pem -outform PEM -pubout
``` ```
Stupid debian:
```
export PATH="/sbin/:$PATH"
```
and run, for example: and run, for example:
``` ```
./release.bash n306 public.pem root ./before_run.bash && ./clean.bash && KERNELDIR=/home/build/inkbox/ ./release.bash n306 public.pem root
``` ```
notes:
- if `/dev/nbd0p1` doesn't appear, try a fev times more...
links: links:
- https://www.tumblr.com/dummdida/117157045170/modprobe-in-a-docker-container - https://www.tumblr.com/dummdida/117157045170/modprobe-in-a-docker-container
#!/bin/bash -x
cp other/mkfs.conf /etc/mkfs.conf
cd /home/build/inkbox/
git clone https://github.com/Kobo-InkBox/kernel.git
cd /home/build/inkbox/imgtool
#!/bin/bash -x
qemu-nbd --disconnect /dev/nbd0
qemu-nbd --disconnect /dev/nbd0
qemu-nbd --disconnect /dev/nbd0
killall -9 qemu-nbd
killall -9 qemu-nbd
killall -9 qemu-nbd
umount -f /dev/nbd0
umount -f /dev/nbd0p1
umount -f /dev/nbd0p2
umount -f /dev/nbd0p3
umount -f /dev/nbd0p4
echo "Check manually in htop anyway..."
[defaults]
base_features = sparse_super,large_file,filetype,resize_inode,dir_index,ext_attr
default_mntopts = acl,user_xattr
enable_periodic_fsck = 0
blocksize = 4096
inode_size = 256
inode_ratio = 16384
[fs_types]
ext3 = {
features = has_journal
}
ext4 = {
features = has_journal,extent,huge_file,flex_bg,metadata_csum,metadata_csum_seed,64bit,dir_nlink,extra_isize,orphan_file
}
small = {
blocksize = 1024
inode_ratio = 4096
}
floppy = {
blocksize = 1024
inode_ratio = 8192
}
big = {
inode_ratio = 32768
}
huge = {
inode_ratio = 65536
}
news = {
inode_ratio = 4096
}
largefile = {
inode_ratio = 1048576
blocksize = -1
}
largefile4 = {
inode_ratio = 4194304
blocksize = -1
}
hurd = {
blocksize = 4096
inode_size = 128
warn_y2038_dates = 0
}
#!/bin/bash -e #!/bin/bash -xe
root_command() { root_command() {
if [ "${STRICT_ROOT_PERMISSION}" == 1 ]; then if [ "${STRICT_ROOT_PERMISSION}" == 1 ]; then
...@@ -39,17 +39,22 @@ build_base_sd_image() { ...@@ -39,17 +39,22 @@ build_base_sd_image() {
IMAGE_FILE="release/inkbox-${DEVICE}.img" IMAGE_FILE="release/inkbox-${DEVICE}.img"
pushd out/ pushd out/
# Load NBD module # Load NBD module
root_command modprobe nbd # root_command modprobe nbd
# Manually, on the host :)
# Create image file (3.6 GiB) # Create image file (3.6 GiB)
qemu-img create -f qcow2 "${IMAGE_FILE}" 3865470976 qemu-img create -f qcow2 "${IMAGE_FILE}" 3865470976
root_command qemu-nbd --connect /dev/nbd0 "${IMAGE_FILE}" root_command qemu-nbd --connect /dev/nbd0 "${IMAGE_FILE}"
# Partition image and write unpartitioned space # Partition image and write unpartitioned space
root_command dd if="${GITDIR}/sd/${DEVICE}.bin" of=/dev/nbd0 && sync root_command dd if="${GITDIR}/sd/${DEVICE}.bin" of=/dev/nbd0 && sync
# https://superuser.com/questions/1329362/qemu-nbd-not-creating-partions
# https://unix.stackexchange.com/questions/319922/error-cant-have-a-partition-outside-the-disk-even-though-number-of-sectors
dd if=/dev/zero bs=512 count=1 >> /dev/nbd0 && sync
# Format partitions # Format partitions
root_command mkfs.ext4 -O "^metadata_csum,^orphan_file" /dev/nbd0p1 root_command mkfs.ext4 -O "^metadata_csum" /dev/nbd0p1
root_command mkfs.ext4 -O "^metadata_csum,^orphan_file" /dev/nbd0p2 root_command mkfs.ext4 -O "^metadata_csum" /dev/nbd0p2
root_command mkfs.ext4 -O "^metadata_csum,^orphan_file" /dev/nbd0p3 root_command mkfs.ext4 -O "^metadata_csum" /dev/nbd0p3
root_command mkfs.ext4 -O "^metadata_csum,^orphan_file" /dev/nbd0p4 root_command mkfs.ext4 -O "^metadata_csum" /dev/nbd0p4
# Label partitions # Label partitions
root_command e2label /dev/nbd0p1 "boot" root_command e2label /dev/nbd0p1 "boot"
root_command e2label /dev/nbd0p2 "recoveryfs" root_command e2label /dev/nbd0p2 "recoveryfs"
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment