Skip to content

Commit

Permalink
Add tweaks to use zram for swap and logging, extend README
Browse files Browse the repository at this point in the history
  • Loading branch information
Heisath committed Feb 28, 2021
1 parent d33b9f9 commit f968a3e
Show file tree
Hide file tree
Showing 5 changed files with 397 additions and 10 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# WD My Cloud Gen2 aka wdmc-gen2 based on Marvell ARMADA 375 ##
# build tools for wdmc-gen2
## WD My Cloud Gen2 based on Marvell ARMADA 375

* mainline kernel support
tested with 4.18.x / 5.6.x / 5.10.x
- device tree source ./dts/armada-375-wdmc-gen2.dts
- kernel config for various kernels included check ./config/
- some tweaks and pointers in txt files ./docs/
- toolchain for building is included as txz ./toolchain/ you might need to install this
- supports caching of kernel and rootfs so not everything needs to be rebuilt everytime
- built rootfs has zram support and uses it for swap and logging

* prerequisites for building
- `apt-get install build-essential bc libncurses5 u-boot-tools git libncurses-dev lib32z1 lib32ncurses5-dev flex bison debootstrap debian-archive-keyring qemu-user-static`
Expand All @@ -16,7 +19,7 @@
- adjust the path to the gcc in build.sh

* build.sh
- New way of building a kernel, rootfs and uRamdisk
- provides a way of building a kernel, rootfs and uRamdisk
- run build.sh as root (or with sudo)
- possible parameters are:
- `--release {debianrelease}` to select the debian release to use as rootfs
Expand All @@ -28,6 +31,8 @@
- `--nokernel` to only build the rootfs + uRamdisk
- `--noinitramfs` to build kernel and rootfs without uRamdisk
- `--changes` to pause and wait for changes in the rootfs before unmounting and packaging (this allows you to do customization)
- `--noclean` to compile kernel without resetting and fetching git
- `--noconfig` to skip menuconfig part of kernel
- if a parameters is not given, the default value is used. Check in build.sh for default and other usage
- if building a rootfs build.sh will include the tweaks from ./tweaks/ You can adjust fstab and various other stuff there

Expand Down Expand Up @@ -83,4 +88,5 @@

If you need custom initramfs or different kernel settings, check the code and build neccessary files yourself.
Thanks to AllesterFox (http://anionix.ddns.net/WDMyCloud/WDMyCloud-Gen2/) and https://github.com/Johns-Q/wdmc-gen2
Thanks to AllesterFox (http://anionix.ddns.net/WDMyCloud/WDMyCloud-Gen2/) and https://github.com/Johns-Q/wdmc-gen2 for their original work on the wdmc-gen2
And to ARMBIAN (https://github.com/armbian/build) for their awesome build script which gave lots of inspiration and the zram config :)
6 changes: 4 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ arch='armhf'
qemu_binary='qemu-arm-static'
components='main,contrib'
# Adjust package list here
includes="ccache,locales,git,ca-certificates,debhelper,rsync,python3,distcc,systemd,init,udev,kmod,busybox,ethtool,dirmngr,hdparm,ifupdown,iproute2,iputils-ping,logrotate,net-tools,nftables,powermgmt-base,procps,rename,resolvconf,rsyslog,ssh,sysstat,update-inetd,isc-dhcp-client,isc-dhcp-common,vim,dialog,apt-utils,nano,keyboard-configuration,console-setup,linux-base,cpio,u-boot-tools"
includes="ccache,locales,git,ca-certificates,debhelper,rsync,python3,distcc,systemd,init,udev,kmod,busybox,ethtool,dirmngr,hdparm,ifupdown,iproute2,iputils-ping,logrotate,net-tools,nftables,powermgmt-base,procps,rename,resolvconf,rsyslog,ssh,sysstat,update-inetd,isc-dhcp-client,isc-dhcp-common,vim,dialog,apt-utils,nano,keyboard-configuration,console-setup,linux-base,cpio,u-boot-tools,bc"
mirror_addr="http://httpredir.debian.org/debian/"

# Adjust default root pw
Expand Down Expand Up @@ -238,7 +238,6 @@ build_root_fs()

echo "### Creating rootfs cache for future builds"
cat << EOF > "${rootfs_dir}"/root/.debootstrap-info
#!/bin/bash
dbs_arch=${arch}
dbs_release=${release}
dbs_components=${components}
Expand Down Expand Up @@ -291,6 +290,9 @@ EOF

# Setup interfaces (eth0)
. tweaks/interfaces.sh

# Add files for zram (swap and logging)
. tweaks/zram.sh

if [ ${BUILD_KERNEL} = 'yes' ]
then
Expand Down
9 changes: 6 additions & 3 deletions config/linux-5.10.y.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm 5.10.2 Kernel Configuration
# Linux/arm 5.10.19 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="arm-none-eabi-gcc (15:7-2018-q2-6) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]"
CONFIG_CC_IS_GCC=y
Expand Down Expand Up @@ -724,7 +724,8 @@ CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
# CONFIG_CMA is not set
# CONFIG_ZPOOL is not set
# CONFIG_ZBUD is not set
# CONFIG_ZSMALLOC is not set
CONFIG_ZSMALLOC=m
# CONFIG_ZSMALLOC_STAT is not set
CONFIG_GENERIC_EARLY_IOREMAP=y
# CONFIG_IDLE_PAGE_TRACKING is not set
# CONFIG_PERCPU_STATS is not set
Expand Down Expand Up @@ -1451,6 +1452,9 @@ CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
CONFIG_BLK_DEV=y
# CONFIG_BLK_DEV_NULL_BLK is not set
# CONFIG_BLK_DEV_PCIESSD_MTIP32XX is not set
CONFIG_ZRAM=m
CONFIG_ZRAM_WRITEBACK=y
CONFIG_ZRAM_MEMORY_TRACKING=y
# CONFIG_BLK_DEV_UMEM is not set
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
Expand Down Expand Up @@ -2501,7 +2505,6 @@ CONFIG_BCMA_POSSIBLE=y
# CONFIG_MFD_RN5T618 is not set
# CONFIG_MFD_SEC_CORE is not set
# CONFIG_MFD_SI476X_CORE is not set
# CONFIG_MFD_SL28CPLD is not set
# CONFIG_MFD_SM501 is not set
# CONFIG_MFD_SKY81452 is not set
# CONFIG_ABX500_CORE is not set
Expand Down
4 changes: 2 additions & 2 deletions tweaks/fstab.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ cat << EOF > ${rootfs_dir}/etc/fstab
/dev/sdb1 /boot auto defaults 0 0
proc /proc proc defaults 0 0
#devpts /dev/pts devpts defaults,gid5,mode=620 0 0
devpts /dev/pts devpts defaults,gid5,mode=620 0 0
tmpfs /dev/shm tmpfs mode=0777 0 0
tmpfs /tmp tmpfs mode=1777 0 0
#tmpfs /#t#m#p tmpfs mode=1777 0 0
tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0
sysfs /sys sysfs defaults 0 0
Expand Down
Loading

0 comments on commit f968a3e

Please sign in to comment.